Completed
Branch BUG-7591-rescue-abandoned-TXNs (9a6c5b)
by
unknown
36:48 queued 18:43
created
admin_pages/events/Events_Admin_Page.core.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 	 * This just returns whatever is set as the _event object property
1322 1322
 	 *
1323 1323
 	 * //todo this will become obsolete once the models are in place
1324
-	 * @return object
1324
+	 * @return EE_Event
1325 1325
 	 */
1326 1326
 	public function get_event_object() {
1327 1327
 		return $this->_cpt_model_obj;
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
 
2199 2199
 
2200 2200
 	/**
2201
-	 * @return mixed
2201
+	 * @return string
2202 2202
 	 */
2203 2203
 	protected function _category_details_content() {
2204 2204
 		$editor_args['category_desc'] = array(
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -829,11 +829,11 @@  discard block
 block discarded – undo
829 829
 		if ( ! empty( $id ) ) {
830 830
 			$post = get_post( $id );
831 831
 			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
832
-			           . esc_html__( 'Shortcode', 'event_espresso' )
833
-			           . '</a> ';
832
+					   . esc_html__( 'Shortcode', 'event_espresso' )
833
+					   . '</a> ';
834 834
 			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
835
-			           . $post->ID
836
-			           . ']">';
835
+					   . $post->ID
836
+					   . ']">';
837 837
 		}
838 838
 		return $return;
839 839
 	}
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 			//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.
1046 1046
 			if ( ! empty( $dtt['DTT_ID'] ) ) {
1047 1047
 				$DTM = EE_Registry::instance()
1048
-				                  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
-				                  ->get_one_by_ID( $dtt['DTT_ID'] );
1048
+								  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
+								  ->get_one_by_ID( $dtt['DTT_ID'] );
1050 1050
 				$DTM->set_date_format( $incoming_date_formats[0] );
1051 1051
 				$DTM->set_time_format( $incoming_date_formats[1] );
1052 1052
 				foreach ( $datetime_values as $field => $value ) {
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 					) > 0 ? true : false;
1145 1145
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1146 1146
 					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' )
1147
-					                  && ! $TKT->get(
1147
+									  && ! $TKT->get(
1148 1148
 						'TKT_deleted'
1149 1149
 					) ? true : false;
1150 1150
 					$TKT->set_date_format( $incoming_date_formats[0] );
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		$first_datetime = reset( $times );
1455 1455
 		//do we get related tickets?
1456 1456
 		if ( $first_datetime instanceof EE_Datetime
1457
-		     && $first_datetime->ID() !== 0
1457
+			 && $first_datetime->ID() !== 0
1458 1458
 		) {
1459 1459
 			$existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' );
1460 1460
 			$template_args['time'] = $first_datetime;
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1530 1530
 			'TKT_sold'            => $skeleton ? 0 : $ticket->get( 'TKT_sold' ),
1531 1531
 			'trash_icon'          => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) )
1532
-			                         && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1532
+									 && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1533 1533
 				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1534 1534
 			'disabled'            => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? ''
1535 1535
 				: ' disabled=disabled',
@@ -1695,8 +1695,8 @@  discard block
 block discarded – undo
1695 1695
 			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1696 1696
 			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1697 1697
 			$end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) )
1698
-			                ->setTime( 23, 59, 59 )
1699
-			                ->format( implode( ' ', $start_formats ) );
1698
+							->setTime( 23, 59, 59 )
1699
+							->format( implode( ' ', $start_formats ) );
1700 1700
 			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1701 1701
 		}
1702 1702
 		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 		}
1717 1717
 		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1718 1718
 			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
-			     && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1719
+				 && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1720 1720
 			) {
1721 1721
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1722 1722
 			}
@@ -2213,13 +2213,13 @@  discard block
 block discarded – undo
2213 2213
 	protected function _template_settings() {
2214 2214
 		$this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' );
2215 2215
 		$this->_template_args['preview_img'] = '<img src="'
2216
-		                                       . EVENTS_ASSETS_URL
2217
-		                                       . DS
2218
-		                                       . 'images'
2219
-		                                       . DS
2220
-		                                       . 'caffeinated_template_features.jpg" alt="'
2221
-		                                       . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2222
-		                                       . '" />';
2216
+											   . EVENTS_ASSETS_URL
2217
+											   . DS
2218
+											   . 'images'
2219
+											   . DS
2220
+											   . 'caffeinated_template_features.jpg" alt="'
2221
+											   . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2222
+											   . '" />';
2223 2223
 		$this->_template_args['preview_text'] = '<strong>' . esc_html__(
2224 2224
 				'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2225 2225
 				'event_espresso'
Please login to merge, or discard this patch.
Spacing   +591 added lines, -591 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		);
64 64
 		add_action(
65 65
 			'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
66
-			array( $this, 'verify_event_edit' )
66
+			array($this, 'verify_event_edit')
67 67
 		);
68 68
 	}
69 69
 
@@ -79,22 +79,22 @@  discard block
 block discarded – undo
79 79
 		$this->_admin_page_title = EVENTS_LABEL;
80 80
 		$this->_labels = array(
81 81
 			'buttons'      => array(
82
-				'add'             => esc_html__( 'Add New Event', 'event_espresso' ),
83
-				'edit'            => esc_html__( 'Edit Event', 'event_espresso' ),
84
-				'delete'          => esc_html__( 'Delete Event', 'event_espresso' ),
85
-				'add_category'    => esc_html__( 'Add New Category', 'event_espresso' ),
86
-				'edit_category'   => esc_html__( 'Edit Category', 'event_espresso' ),
87
-				'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ),
82
+				'add'             => esc_html__('Add New Event', 'event_espresso'),
83
+				'edit'            => esc_html__('Edit Event', 'event_espresso'),
84
+				'delete'          => esc_html__('Delete Event', 'event_espresso'),
85
+				'add_category'    => esc_html__('Add New Category', 'event_espresso'),
86
+				'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
87
+				'delete_category' => esc_html__('Delete Category', 'event_espresso'),
88 88
 			),
89 89
 			'editor_title' => array(
90
-				'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ),
90
+				'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
91 91
 			),
92 92
 			'publishbox'   => array(
93
-				'create_new'        => esc_html__( 'Save New Event', 'event_espresso' ),
94
-				'edit'              => esc_html__( 'Update Event', 'event_espresso' ),
95
-				'add_category'      => esc_html__( 'Save New Category', 'event_espresso' ),
96
-				'edit_category'     => esc_html__( 'Update Category', 'event_espresso' ),
97
-				'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ),
93
+				'create_new'        => esc_html__('Save New Event', 'event_espresso'),
94
+				'edit'              => esc_html__('Update Event', 'event_espresso'),
95
+				'add_category'      => esc_html__('Save New Category', 'event_espresso'),
96
+				'edit_category'     => esc_html__('Update Category', 'event_espresso'),
97
+				'template_settings' => esc_html__('Update Settings', 'event_espresso'),
98 98
 			),
99 99
 		);
100 100
 	}
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 		//load formatter helper
106 106
 		//load field generator helper
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] )
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
109 109
 			? $this->_req_data['EVT_ID'] : 0;
110
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
110
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
111 111
 		$this->_page_routes = array(
112 112
 			'default'                       => array(
113 113
 				'func'       => '_events_overview_list_table',
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 			),
131 131
 			'trash_event'                   => array(
132 132
 				'func'       => '_trash_or_restore_event',
133
-				'args'       => array( 'event_status' => 'trash' ),
133
+				'args'       => array('event_status' => 'trash'),
134 134
 				'capability' => 'ee_delete_event',
135 135
 				'obj_id'     => $evt_id,
136 136
 				'noheader'   => true,
137 137
 			),
138 138
 			'trash_events'                  => array(
139 139
 				'func'       => '_trash_or_restore_events',
140
-				'args'       => array( 'event_status' => 'trash' ),
140
+				'args'       => array('event_status' => 'trash'),
141 141
 				'capability' => 'ee_delete_events',
142 142
 				'noheader'   => true,
143 143
 			),
144 144
 			'restore_event'                 => array(
145 145
 				'func'       => '_trash_or_restore_event',
146
-				'args'       => array( 'event_status' => 'draft' ),
146
+				'args'       => array('event_status' => 'draft'),
147 147
 				'capability' => 'ee_delete_event',
148 148
 				'obj_id'     => $evt_id,
149 149
 				'noheader'   => true,
150 150
 			),
151 151
 			'restore_events'                => array(
152 152
 				'func'       => '_trash_or_restore_events',
153
-				'args'       => array( 'event_status' => 'draft' ),
153
+				'args'       => array('event_status' => 'draft'),
154 154
 				'capability' => 'ee_delete_events',
155 155
 				'noheader'   => true,
156 156
 			),
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 			'add_category'                  => array(
187 187
 				'func'       => '_category_details',
188 188
 				'capability' => 'ee_edit_event_category',
189
-				'args'       => array( 'add' ),
189
+				'args'       => array('add'),
190 190
 			),
191 191
 			'edit_category'                 => array(
192 192
 				'func'       => '_category_details',
193 193
 				'capability' => 'ee_edit_event_category',
194
-				'args'       => array( 'edit' ),
194
+				'args'       => array('edit'),
195 195
 			),
196 196
 			'delete_categories'             => array(
197 197
 				'func'       => '_delete_categories',
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 			),
206 206
 			'insert_category' => array(
207 207
 				'func'       => '_insert_or_update_category',
208
-				'args'       => array( 'new_category' => true ),
208
+				'args'       => array('new_category' => true),
209 209
 				'capability' => 'ee_edit_event_category',
210 210
 				'noheader'   => true,
211 211
 			),
212 212
 			'update_category' => array(
213 213
 				'func'       => '_insert_or_update_category',
214
-				'args'       => array( 'new_category' => false ),
214
+				'args'       => array('new_category' => false),
215 215
 				'capability' => 'ee_edit_event_category',
216 216
 				'noheader'   => true,
217 217
 			),
@@ -228,29 +228,29 @@  discard block
 block discarded – undo
228 228
 		$this->_page_config = array(
229 229
 			'default'                => array(
230 230
 				'nav'           => array(
231
-					'label' => esc_html__( 'Overview', 'event_espresso' ),
231
+					'label' => esc_html__('Overview', 'event_espresso'),
232 232
 					'order' => 10,
233 233
 				),
234 234
 				'list_table'    => 'Events_Admin_List_Table',
235 235
 				'help_tabs'     => array(
236 236
 					'events_overview_help_tab'                       => array(
237
-						'title'    => esc_html__( 'Events Overview', 'event_espresso' ),
237
+						'title'    => esc_html__('Events Overview', 'event_espresso'),
238 238
 						'filename' => 'events_overview',
239 239
 					),
240 240
 					'events_overview_table_column_headings_help_tab' => array(
241
-						'title'    => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ),
241
+						'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
242 242
 						'filename' => 'events_overview_table_column_headings',
243 243
 					),
244 244
 					'events_overview_filters_help_tab'               => array(
245
-						'title'    => esc_html__( 'Events Overview Filters', 'event_espresso' ),
245
+						'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
246 246
 						'filename' => 'events_overview_filters',
247 247
 					),
248 248
 					'events_overview_view_help_tab'                  => array(
249
-						'title'    => esc_html__( 'Events Overview Views', 'event_espresso' ),
249
+						'title'    => esc_html__('Events Overview Views', 'event_espresso'),
250 250
 						'filename' => 'events_overview_views',
251 251
 					),
252 252
 					'events_overview_other_help_tab'                 => array(
253
-						'title'    => esc_html__( 'Events Overview Other', 'event_espresso' ),
253
+						'title'    => esc_html__('Events Overview Other', 'event_espresso'),
254 254
 						'filename' => 'events_overview_other',
255 255
 					),
256 256
 				),
@@ -265,218 +265,218 @@  discard block
 block discarded – undo
265 265
 			),
266 266
 			'create_new'             => array(
267 267
 				'nav'           => array(
268
-					'label'      => esc_html__( 'Add Event', 'event_espresso' ),
268
+					'label'      => esc_html__('Add Event', 'event_espresso'),
269 269
 					'order'      => 5,
270 270
 					'persistent' => false,
271 271
 				),
272
-				'metaboxes'     => array( '_register_event_editor_meta_boxes' ),
272
+				'metaboxes'     => array('_register_event_editor_meta_boxes'),
273 273
 				'help_tabs'     => array(
274 274
 					'event_editor_help_tab'                            => array(
275
-						'title'    => esc_html__( 'Event Editor', 'event_espresso' ),
275
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
276 276
 						'filename' => 'event_editor',
277 277
 					),
278 278
 					'event_editor_title_richtexteditor_help_tab'       => array(
279
-						'title'    => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ),
279
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
280 280
 						'filename' => 'event_editor_title_richtexteditor',
281 281
 					),
282 282
 					'event_editor_venue_details_help_tab'              => array(
283
-						'title'    => esc_html__( 'Event Venue Details', 'event_espresso' ),
283
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
284 284
 						'filename' => 'event_editor_venue_details',
285 285
 					),
286 286
 					'event_editor_event_datetimes_help_tab'            => array(
287
-						'title'    => esc_html__( 'Event Datetimes', 'event_espresso' ),
287
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
288 288
 						'filename' => 'event_editor_event_datetimes',
289 289
 					),
290 290
 					'event_editor_event_tickets_help_tab'              => array(
291
-						'title'    => esc_html__( 'Event Tickets', 'event_espresso' ),
291
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
292 292
 						'filename' => 'event_editor_event_tickets',
293 293
 					),
294 294
 					'event_editor_event_registration_options_help_tab' => array(
295
-						'title'    => esc_html__( 'Event Registration Options', 'event_espresso' ),
295
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
296 296
 						'filename' => 'event_editor_event_registration_options',
297 297
 					),
298 298
 					'event_editor_tags_categories_help_tab'            => array(
299
-						'title'    => esc_html__( 'Event Tags & Categories', 'event_espresso' ),
299
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
300 300
 						'filename' => 'event_editor_tags_categories',
301 301
 					),
302 302
 					'event_editor_questions_registrants_help_tab'      => array(
303
-						'title'    => esc_html__( 'Questions for Registrants', 'event_espresso' ),
303
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
304 304
 						'filename' => 'event_editor_questions_registrants',
305 305
 					),
306 306
 					'event_editor_save_new_event_help_tab'             => array(
307
-						'title'    => esc_html__( 'Save New Event', 'event_espresso' ),
307
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
308 308
 						'filename' => 'event_editor_save_new_event',
309 309
 					),
310 310
 					'event_editor_other_help_tab'                      => array(
311
-						'title'    => esc_html__( 'Event Other', 'event_espresso' ),
311
+						'title'    => esc_html__('Event Other', 'event_espresso'),
312 312
 						'filename' => 'event_editor_other',
313 313
 					),
314 314
 				),
315 315
 				'help_tour'     => array(
316 316
 					'Event_Editor_Help_Tour',
317 317
 				),
318
-				'qtips'         => array( 'EE_Event_Editor_Decaf_Tips' ),
318
+				'qtips'         => array('EE_Event_Editor_Decaf_Tips'),
319 319
 				'require_nonce' => false,
320 320
 			),
321 321
 			'edit'                   => array(
322 322
 				'nav'           => array(
323
-					'label'      => esc_html__( 'Edit Event', 'event_espresso' ),
323
+					'label'      => esc_html__('Edit Event', 'event_espresso'),
324 324
 					'order'      => 5,
325 325
 					'persistent' => false,
326
-					'url'        => isset( $this->_req_data['post'] )
326
+					'url'        => isset($this->_req_data['post'])
327 327
 						? EE_Admin_Page::add_query_args_and_nonce(
328
-							array( 'post' => $this->_req_data['post'], 'action' => 'edit' ),
328
+							array('post' => $this->_req_data['post'], 'action' => 'edit'),
329 329
 							$this->_current_page_view_url
330 330
 						)
331 331
 						: $this->_admin_base_url,
332 332
 				),
333
-				'metaboxes'     => array( '_register_event_editor_meta_boxes' ),
333
+				'metaboxes'     => array('_register_event_editor_meta_boxes'),
334 334
 				'help_tabs'     => array(
335 335
 					'event_editor_help_tab'                            => array(
336
-						'title'    => esc_html__( 'Event Editor', 'event_espresso' ),
336
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
337 337
 						'filename' => 'event_editor',
338 338
 					),
339 339
 					'event_editor_title_richtexteditor_help_tab'       => array(
340
-						'title'    => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ),
340
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
341 341
 						'filename' => 'event_editor_title_richtexteditor',
342 342
 					),
343 343
 					'event_editor_venue_details_help_tab'              => array(
344
-						'title'    => esc_html__( 'Event Venue Details', 'event_espresso' ),
344
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
345 345
 						'filename' => 'event_editor_venue_details',
346 346
 					),
347 347
 					'event_editor_event_datetimes_help_tab'            => array(
348
-						'title'    => esc_html__( 'Event Datetimes', 'event_espresso' ),
348
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
349 349
 						'filename' => 'event_editor_event_datetimes',
350 350
 					),
351 351
 					'event_editor_event_tickets_help_tab'              => array(
352
-						'title'    => esc_html__( 'Event Tickets', 'event_espresso' ),
352
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
353 353
 						'filename' => 'event_editor_event_tickets',
354 354
 					),
355 355
 					'event_editor_event_registration_options_help_tab' => array(
356
-						'title'    => esc_html__( 'Event Registration Options', 'event_espresso' ),
356
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
357 357
 						'filename' => 'event_editor_event_registration_options',
358 358
 					),
359 359
 					'event_editor_tags_categories_help_tab'            => array(
360
-						'title'    => esc_html__( 'Event Tags & Categories', 'event_espresso' ),
360
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
361 361
 						'filename' => 'event_editor_tags_categories',
362 362
 					),
363 363
 					'event_editor_questions_registrants_help_tab'      => array(
364
-						'title'    => esc_html__( 'Questions for Registrants', 'event_espresso' ),
364
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
365 365
 						'filename' => 'event_editor_questions_registrants',
366 366
 					),
367 367
 					'event_editor_save_new_event_help_tab'             => array(
368
-						'title'    => esc_html__( 'Save New Event', 'event_espresso' ),
368
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
369 369
 						'filename' => 'event_editor_save_new_event',
370 370
 					),
371 371
 					'event_editor_other_help_tab'                      => array(
372
-						'title'    => esc_html__( 'Event Other', 'event_espresso' ),
372
+						'title'    => esc_html__('Event Other', 'event_espresso'),
373 373
 						'filename' => 'event_editor_other',
374 374
 					),
375 375
 				),
376 376
 				/*'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),*/
379
-				'qtips'         => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips'         => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => false,
381 381
 			),
382 382
 			'default_event_settings' => array(
383 383
 				'nav'           => array(
384
-					'label' => esc_html__( 'Default Settings', 'event_espresso' ),
384
+					'label' => esc_html__('Default Settings', 'event_espresso'),
385 385
 					'order' => 40,
386 386
 				),
387
-				'metaboxes'     => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
387
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
388 388
 				'labels'        => array(
389
-					'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ),
389
+					'publishbox' => esc_html__('Update Settings', 'event_espresso'),
390 390
 				),
391 391
 				'help_tabs'     => array(
392 392
 					'default_settings_help_tab'        => array(
393
-						'title'    => esc_html__( 'Default Event Settings', 'event_espresso' ),
393
+						'title'    => esc_html__('Default Event Settings', 'event_espresso'),
394 394
 						'filename' => 'events_default_settings',
395 395
 					),
396 396
 					'default_settings_status_help_tab' => array(
397
-						'title'    => esc_html__( 'Default Registration Status', 'event_espresso' ),
397
+						'title'    => esc_html__('Default Registration Status', 'event_espresso'),
398 398
 						'filename' => 'events_default_settings_status',
399 399
 					),
400 400
 				),
401
-				'help_tour'     => array( 'Event_Default_Settings_Help_Tour' ),
401
+				'help_tour'     => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => false,
403 403
 			),
404 404
 			//template settings
405 405
 			'template_settings'      => array(
406 406
 				'nav'           => array(
407
-					'label' => esc_html__( 'Templates', 'event_espresso' ),
407
+					'label' => esc_html__('Templates', 'event_espresso'),
408 408
 					'order' => 30,
409 409
 				),
410 410
 				'metaboxes'     => $this->_default_espresso_metaboxes,
411 411
 				'help_tabs'     => array(
412 412
 					'general_settings_templates_help_tab' => array(
413
-						'title'    => esc_html__( 'Templates', 'event_espresso' ),
413
+						'title'    => esc_html__('Templates', 'event_espresso'),
414 414
 						'filename' => 'general_settings_templates',
415 415
 					),
416 416
 				),
417
-				'help_tour'     => array( 'Templates_Help_Tour' ),
417
+				'help_tour'     => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => false,
419 419
 			),
420 420
 			//event category stuff
421 421
 			'add_category'           => array(
422 422
 				'nav'           => array(
423
-					'label'      => esc_html__( 'Add Category', 'event_espresso' ),
423
+					'label'      => esc_html__('Add Category', 'event_espresso'),
424 424
 					'order'      => 15,
425 425
 					'persistent' => false,
426 426
 				),
427 427
 				'help_tabs'     => array(
428 428
 					'add_category_help_tab' => array(
429
-						'title'    => esc_html__( 'Add New Event Category', 'event_espresso' ),
429
+						'title'    => esc_html__('Add New Event Category', 'event_espresso'),
430 430
 						'filename' => 'events_add_category',
431 431
 					),
432 432
 				),
433
-				'help_tour'     => array( 'Event_Add_Category_Help_Tour' ),
434
-				'metaboxes'     => array( '_publish_post_box' ),
433
+				'help_tour'     => array('Event_Add_Category_Help_Tour'),
434
+				'metaboxes'     => array('_publish_post_box'),
435 435
 				'require_nonce' => false,
436 436
 			),
437 437
 			'edit_category'          => array(
438 438
 				'nav'           => array(
439
-					'label'      => esc_html__( 'Edit Category', 'event_espresso' ),
439
+					'label'      => esc_html__('Edit Category', 'event_espresso'),
440 440
 					'order'      => 15,
441 441
 					'persistent' => false,
442
-					'url'        => isset( $this->_req_data['EVT_CAT_ID'] )
442
+					'url'        => isset($this->_req_data['EVT_CAT_ID'])
443 443
 						? add_query_arg(
444
-							array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ),
444
+							array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']),
445 445
 							$this->_current_page_view_url
446 446
 						)
447 447
 						: $this->_admin_base_url,
448 448
 				),
449 449
 				'help_tabs'     => array(
450 450
 					'edit_category_help_tab' => array(
451
-						'title'    => esc_html__( 'Edit Event Category', 'event_espresso' ),
451
+						'title'    => esc_html__('Edit Event Category', 'event_espresso'),
452 452
 						'filename' => 'events_edit_category',
453 453
 					),
454 454
 				),
455 455
 				/*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/
456
-				'metaboxes'     => array( '_publish_post_box' ),
456
+				'metaboxes'     => array('_publish_post_box'),
457 457
 				'require_nonce' => false,
458 458
 			),
459 459
 			'category_list'          => array(
460 460
 				'nav'           => array(
461
-					'label' => esc_html__( 'Categories', 'event_espresso' ),
461
+					'label' => esc_html__('Categories', 'event_espresso'),
462 462
 					'order' => 20,
463 463
 				),
464 464
 				'list_table'    => 'Event_Categories_Admin_List_Table',
465 465
 				'help_tabs'     => array(
466 466
 					'events_categories_help_tab'                       => array(
467
-						'title'    => esc_html__( 'Event Categories', 'event_espresso' ),
467
+						'title'    => esc_html__('Event Categories', 'event_espresso'),
468 468
 						'filename' => 'events_categories',
469 469
 					),
470 470
 					'events_categories_table_column_headings_help_tab' => array(
471
-						'title'    => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ),
471
+						'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
472 472
 						'filename' => 'events_categories_table_column_headings',
473 473
 					),
474 474
 					'events_categories_view_help_tab'                  => array(
475
-						'title'    => esc_html__( 'Event Categories Views', 'event_espresso' ),
475
+						'title'    => esc_html__('Event Categories Views', 'event_espresso'),
476 476
 						'filename' => 'events_categories_views',
477 477
 					),
478 478
 					'events_categories_other_help_tab'                 => array(
479
-						'title'    => esc_html__( 'Event Categories Other', 'event_espresso' ),
479
+						'title'    => esc_html__('Event Categories Other', 'event_espresso'),
480 480
 						'filename' => 'events_categories_other',
481 481
 					),
482 482
 				),
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 	protected function _add_screen_options_category_list() {
507 507
 		$page_title = $this->_admin_page_title;
508
-		$this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' );
508
+		$this->_admin_page_title = esc_html__('Categories', 'event_espresso');
509 509
 		$this->_per_page_screen_option();
510 510
 		$this->_admin_page_title = $page_title;
511 511
 	}
@@ -521,20 +521,20 @@  discard block
 block discarded – undo
521 521
 	public function load_scripts_styles() {
522 522
 		wp_register_style(
523 523
 			'events-admin-css',
524
-			EVENTS_ASSETS_URL . 'events-admin-page.css',
524
+			EVENTS_ASSETS_URL.'events-admin-page.css',
525 525
 			array(),
526 526
 			EVENT_ESPRESSO_VERSION
527 527
 		);
528
-		wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
529
-		wp_enqueue_style( 'events-admin-css' );
530
-		wp_enqueue_style( 'ee-cat-admin' );
528
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
529
+		wp_enqueue_style('events-admin-css');
530
+		wp_enqueue_style('ee-cat-admin');
531 531
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
532 532
 		//registers for all views
533 533
 		//scripts
534 534
 		wp_register_script(
535 535
 			'event_editor_js',
536
-			EVENTS_ASSETS_URL . 'event_editor.js',
537
-			array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ),
536
+			EVENTS_ASSETS_URL.'event_editor.js',
537
+			array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'),
538 538
 			EVENT_ESPRESSO_VERSION,
539 539
 			true
540 540
 		);
@@ -560,22 +560,22 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function load_scripts_styles_edit() {
562 562
 		//styles
563
-		wp_enqueue_style( 'espresso-ui-theme' );
563
+		wp_enqueue_style('espresso-ui-theme');
564 564
 		wp_register_style(
565 565
 			'event-editor-css',
566
-			EVENTS_ASSETS_URL . 'event-editor.css',
567
-			array( 'ee-admin-css' ),
566
+			EVENTS_ASSETS_URL.'event-editor.css',
567
+			array('ee-admin-css'),
568 568
 			EVENT_ESPRESSO_VERSION
569 569
 		);
570
-		wp_enqueue_style( 'event-editor-css' );
570
+		wp_enqueue_style('event-editor-css');
571 571
 		//scripts
572 572
 		wp_register_script(
573 573
 			'event-datetime-metabox',
574
-			EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
575
-			array( 'event_editor_js', 'ee-datepicker' ),
574
+			EVENTS_ASSETS_URL.'event-datetime-metabox.js',
575
+			array('event_editor_js', 'ee-datepicker'),
576 576
 			EVENT_ESPRESSO_VERSION
577 577
 		);
578
-		wp_enqueue_script( 'event-datetime-metabox' );
578
+		wp_enqueue_script('event-datetime-metabox');
579 579
 	}
580 580
 
581 581
 
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		$this->_views = array(
596 596
 			'all' => array(
597 597
 				'slug'        => 'all',
598
-				'label'       => esc_html__( 'All', 'event_espresso' ),
598
+				'label'       => esc_html__('All', 'event_espresso'),
599 599
 				'count'       => 0,
600 600
 				'bulk_action' => array(
601
-					'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ),
601
+					'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
602 602
 				),
603 603
 			),
604 604
 		);
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
 	 * @access public
635 635
 	 * @return void
636 636
 	 */
637
-	public function verify_event_edit( $event = null ) {
637
+	public function verify_event_edit($event = null) {
638 638
 		// no event?
639
-		if ( empty( $event ) ) {
639
+		if (empty($event)) {
640 640
 			// set event
641 641
 			$event = $this->_cpt_model_obj;
642 642
 		}
643 643
 		// STILL no event?
644
-		if ( empty ( $event ) ) {
644
+		if (empty ($event)) {
645 645
 			return;
646 646
 		}
647 647
 		$orig_status = $event->status();
@@ -655,32 +655,32 @@  discard block
 block discarded – undo
655 655
 			return;
656 656
 		}
657 657
 		//made it here so it IS active... next check that any of the tickets are sold.
658
-		if ( $event->is_sold_out( true ) ) {
659
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
658
+		if ($event->is_sold_out(true)) {
659
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
660 660
 				EE_Error::add_attention(
661 661
 					sprintf(
662 662
 						esc_html__(
663 663
 							'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.',
664 664
 							'event_espresso'
665 665
 						),
666
-						EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' )
666
+						EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
667 667
 					)
668 668
 				);
669 669
 			}
670 670
 			return;
671
-		} else if ( $orig_status === EEM_Event::sold_out ) {
671
+		} else if ($orig_status === EEM_Event::sold_out) {
672 672
 			EE_Error::add_attention(
673 673
 				sprintf(
674 674
 					esc_html__(
675 675
 						'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
676 676
 						'event_espresso'
677 677
 					),
678
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
678
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
679 679
 				)
680 680
 			);
681 681
 		}
682 682
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
683
-		if ( ! $event->tickets_on_sale() ) {
683
+		if ( ! $event->tickets_on_sale()) {
684 684
 			return;
685 685
 		}
686 686
 		//made it here so show warning
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	protected function _edit_event_warning() {
700 700
 		// we don't want to add warnings during these requests
701
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
701
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
702 702
 			return;
703 703
 		}
704 704
 		EE_Error::add_attention(
@@ -715,29 +715,29 @@  discard block
 block discarded – undo
715 715
 		$this->_views = array(
716 716
 			'all'   => array(
717 717
 				'slug'        => 'all',
718
-				'label'       => esc_html__( 'View All Events', 'event_espresso' ),
718
+				'label'       => esc_html__('View All Events', 'event_espresso'),
719 719
 				'count'       => 0,
720 720
 				'bulk_action' => array(
721
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
721
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
722 722
 				),
723 723
 			),
724 724
 			'draft' => array(
725 725
 				'slug'        => 'draft',
726
-				'label'       => esc_html__( 'Draft', 'event_espresso' ),
726
+				'label'       => esc_html__('Draft', 'event_espresso'),
727 727
 				'count'       => 0,
728 728
 				'bulk_action' => array(
729
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
729
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
730 730
 				),
731 731
 			),
732 732
 		);
733
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
733
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
734 734
 			$this->_views['trash'] = array(
735 735
 				'slug'        => 'trash',
736
-				'label'       => esc_html__( 'Trash', 'event_espresso' ),
736
+				'label'       => esc_html__('Trash', 'event_espresso'),
737 737
 				'count'       => 0,
738 738
 				'bulk_action' => array(
739
-					'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ),
740
-					'delete_events'  => esc_html__( 'Delete Permanently', 'event_espresso' ),
739
+					'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
740
+					'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
741 741
 				),
742 742
 			);
743 743
 		}
@@ -752,50 +752,50 @@  discard block
 block discarded – undo
752 752
 		$items = array(
753 753
 			'view_details'   => array(
754 754
 				'class' => 'dashicons dashicons-search',
755
-				'desc'  => esc_html__( 'View Event', 'event_espresso' ),
755
+				'desc'  => esc_html__('View Event', 'event_espresso'),
756 756
 			),
757 757
 			'edit_event'     => array(
758 758
 				'class' => 'ee-icon ee-icon-calendar-edit',
759
-				'desc'  => esc_html__( 'Edit Event Details', 'event_espresso' ),
759
+				'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
760 760
 			),
761 761
 			'view_attendees' => array(
762 762
 				'class' => 'dashicons dashicons-groups',
763
-				'desc'  => esc_html__( 'View Registrations for Event', 'event_espresso' ),
763
+				'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
764 764
 			),
765 765
 		);
766
-		$items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
766
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
767 767
 		$statuses = array(
768 768
 			'sold_out_status'  => array(
769
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
770
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ),
769
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
770
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
771 771
 			),
772 772
 			'active_status'    => array(
773
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
774
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ),
773
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
774
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
775 775
 			),
776 776
 			'upcoming_status'  => array(
777
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
778
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ),
777
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
778
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
779 779
 			),
780 780
 			'postponed_status' => array(
781
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
782
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ),
781
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
782
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
783 783
 			),
784 784
 			'cancelled_status' => array(
785
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
786
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ),
785
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
786
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
787 787
 			),
788 788
 			'expired_status'   => array(
789
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
790
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ),
789
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
790
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
791 791
 			),
792 792
 			'inactive_status'  => array(
793
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
794
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ),
793
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
794
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
795 795
 			),
796 796
 		);
797
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
798
-		return array_merge( $items, $statuses );
797
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
798
+		return array_merge($items, $statuses);
799 799
 	}
800 800
 
801 801
 
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 	 * @return EEM_Event
807 807
 	 */
808 808
 	private function _event_model() {
809
-		if ( ! $this->_event_model instanceof EEM_Event ) {
810
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
809
+		if ( ! $this->_event_model instanceof EEM_Event) {
810
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
811 811
 		}
812 812
 		return $this->_event_model;
813 813
 	}
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	 * @param  string $new_slug  what the slug is
825 825
 	 * @return string            The new html string for the permalink area
826 826
 	 */
827
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
827
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
828 828
 		//make sure this is only when editing
829
-		if ( ! empty( $id ) ) {
830
-			$post = get_post( $id );
829
+		if ( ! empty($id)) {
830
+			$post = get_post($id);
831 831
 			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
832
-			           . esc_html__( 'Shortcode', 'event_espresso' )
832
+			           . esc_html__('Shortcode', 'event_espresso')
833 833
 			           . '</a> ';
834 834
 			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
835 835
 			           . $post->ID
@@ -848,14 +848,14 @@  discard block
 block discarded – undo
848 848
 	 * @return void
849 849
 	 */
850 850
 	protected function _events_overview_list_table() {
851
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
851
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
852 852
 		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(
853
-			get_post_type_archive_link( 'espresso_events' ),
854
-			esc_html__( "View Event Archive Page", "event_espresso" ),
853
+			get_post_type_archive_link('espresso_events'),
854
+			esc_html__("View Event Archive Page", "event_espresso"),
855 855
 			'button'
856 856
 		);
857
-		$this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() );
858
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
857
+		$this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items());
858
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
859 859
 				'create_new',
860 860
 				'add',
861 861
 				array(),
@@ -881,48 +881,48 @@  discard block
 block discarded – undo
881 881
 	 * @param string $post_id
882 882
 	 * @param object $post
883 883
 	 */
884
-	protected function _insert_update_cpt_item( $post_id, $post ) {
885
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
884
+	protected function _insert_update_cpt_item($post_id, $post) {
885
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
886 886
 			//get out we're not processing an event save.
887 887
 			return;
888 888
 		}
889 889
 		$event_values = array(
890
-			'EVT_display_desc'                => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0,
891
-			'EVT_display_ticket_selector'     => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
890
+			'EVT_display_desc'                => ! empty($this->_req_data['display_desc']) ? 1 : 0,
891
+			'EVT_display_ticket_selector'     => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
892 892
 			'EVT_additional_limit'            => min(
893
-				apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
894
-				! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null
893
+				apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
894
+				! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null
895 895
 			),
896
-			'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] )
896
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status'])
897 897
 				? $this->_req_data['EVT_default_registration_status']
898 898
 				: EE_Registry::instance()->CFG->registration->default_STS_ID,
899
-			'EVT_member_only'                 => ! empty( $this->_req_data['member_only'] ) ? 1 : 0,
900
-			'EVT_allow_overflow'              => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
901
-			'EVT_timezone_string'             => ! empty( $this->_req_data['timezone_string'] )
899
+			'EVT_member_only'                 => ! empty($this->_req_data['member_only']) ? 1 : 0,
900
+			'EVT_allow_overflow'              => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
901
+			'EVT_timezone_string'             => ! empty($this->_req_data['timezone_string'])
902 902
 				? $this->_req_data['timezone_string'] : null,
903
-			'EVT_external_URL'                => ! empty( $this->_req_data['externalURL'] )
903
+			'EVT_external_URL'                => ! empty($this->_req_data['externalURL'])
904 904
 				? $this->_req_data['externalURL'] : null,
905
-			'EVT_phone'                       => ! empty( $this->_req_data['event_phone'] )
905
+			'EVT_phone'                       => ! empty($this->_req_data['event_phone'])
906 906
 				? $this->_req_data['event_phone'] : null,
907 907
 		);
908 908
 		//update event
909
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
909
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
910 910
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
911
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
912
-		$event = $this->_event_model()->get_one( array( $get_one_where ) );
911
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
912
+		$event = $this->_event_model()->get_one(array($get_one_where));
913 913
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
914 914
 		$event_update_callbacks = apply_filters(
915 915
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
916
-			array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) )
916
+			array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))
917 917
 		);
918 918
 		$att_success = true;
919
-		foreach ( $event_update_callbacks as $e_callback ) {
920
-			$_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) );
919
+		foreach ($event_update_callbacks as $e_callback) {
920
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
921 921
 			$att_success = ! $att_success ? $att_success
922 922
 				: $_succ; //if ANY of these updates fail then we want the appropriate global error message
923 923
 		}
924 924
 		//any errors?
925
-		if ( $success && false === $att_success ) {
925
+		if ($success && false === $att_success) {
926 926
 			EE_Error::add_error(
927 927
 				esc_html__(
928 928
 					'Event Details saved successfully but something went wrong with saving attachments.',
@@ -932,9 +932,9 @@  discard block
 block discarded – undo
932 932
 				__FUNCTION__,
933 933
 				__LINE__
934 934
 			);
935
-		} else if ( $success === false ) {
935
+		} else if ($success === false) {
936 936
 			EE_Error::add_error(
937
-				esc_html__( 'Event Details did not save successfully.', 'event_espresso' ),
937
+				esc_html__('Event Details did not save successfully.', 'event_espresso'),
938 938
 				__FILE__,
939 939
 				__FUNCTION__,
940 940
 				__LINE__
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 	 * @param int $post_id
950 950
 	 * @param int $revision_id
951 951
 	 */
952
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
952
+	protected function _restore_cpt_item($post_id, $revision_id) {
953 953
 		//copy existing event meta to new post
954
-		$post_evt = $this->_event_model()->get_one_by_ID( $post_id );
955
-		if ( $post_evt instanceof EE_Event ) {
954
+		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
955
+		if ($post_evt instanceof EE_Event) {
956 956
 			//meta revision restore
957
-			$post_evt->restore_revision( $revision_id );
957
+			$post_evt->restore_revision($revision_id);
958 958
 			//related objs restore
959
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
959
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
960 960
 		}
961 961
 	}
962 962
 
@@ -969,49 +969,49 @@  discard block
 block discarded – undo
969 969
 	 * @param  array     $data   The request data from the form
970 970
 	 * @return bool           Success or fail.
971 971
 	 */
972
-	protected function _default_venue_update( \EE_Event $evtobj, $data ) {
973
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
974
-		$venue_model = EE_Registry::instance()->load_model( 'Venue' );
972
+	protected function _default_venue_update(\EE_Event $evtobj, $data) {
973
+		require_once(EE_MODELS.'EEM_Venue.model.php');
974
+		$venue_model = EE_Registry::instance()->load_model('Venue');
975 975
 		$rows_affected = null;
976
-		$venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null;
976
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null;
977 977
 		// very important.  If we don't have a venue name...
978 978
 		// then we'll get out because not necessary to create empty venue
979
-		if ( empty( $data['venue_title'] ) ) {
979
+		if (empty($data['venue_title'])) {
980 980
 			return false;
981 981
 		}
982 982
 		$venue_array = array(
983
-			'VNU_wp_user'         => $evtobj->get( 'EVT_wp_user' ),
984
-			'VNU_name'            => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null,
985
-			'VNU_desc'            => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null,
986
-			'VNU_identifier'      => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null,
987
-			'VNU_short_desc'      => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description']
983
+			'VNU_wp_user'         => $evtobj->get('EVT_wp_user'),
984
+			'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
985
+			'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
986
+			'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
987
+			'VNU_short_desc'      => ! empty($data['venue_short_description']) ? $data['venue_short_description']
988 988
 				: null,
989
-			'VNU_address'         => ! empty( $data['address'] ) ? $data['address'] : null,
990
-			'VNU_address2'        => ! empty( $data['address2'] ) ? $data['address2'] : null,
991
-			'VNU_city'            => ! empty( $data['city'] ) ? $data['city'] : null,
992
-			'STA_ID'              => ! empty( $data['state'] ) ? $data['state'] : null,
993
-			'CNT_ISO'             => ! empty( $data['countries'] ) ? $data['countries'] : null,
994
-			'VNU_zip'             => ! empty( $data['zip'] ) ? $data['zip'] : null,
995
-			'VNU_phone'           => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null,
996
-			'VNU_capacity'        => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null,
997
-			'VNU_url'             => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null,
998
-			'VNU_virtual_phone'   => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null,
999
-			'VNU_virtual_url'     => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null,
1000
-			'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
989
+			'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
990
+			'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
991
+			'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
992
+			'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
993
+			'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
994
+			'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
995
+			'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
996
+			'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
997
+			'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
998
+			'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
999
+			'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1000
+			'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1001 1001
 			'status'              => 'publish',
1002 1002
 		);
1003 1003
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1004
-		if ( ! empty( $venue_id ) ) {
1005
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
1006
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
1004
+		if ( ! empty($venue_id)) {
1005
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
1006
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
1007 1007
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
1008
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
1008
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1009 1009
 			return $rows_affected > 0 ? true : false;
1010 1010
 		} else {
1011 1011
 			//we insert the venue
1012
-			$venue_id = $venue_model->insert( $venue_array );
1013
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
1014
-			return ! empty( $venue_id ) ? true : false;
1012
+			$venue_id = $venue_model->insert($venue_array);
1013
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1014
+			return ! empty($venue_id) ? true : false;
1015 1015
 		}
1016 1016
 		//when we have the ancestor come in it's already been handled by the revision save.
1017 1017
 	}
@@ -1025,51 +1025,51 @@  discard block
 block discarded – undo
1025 1025
 	 * @param  array    $data   The request data from the form
1026 1026
 	 * @return array
1027 1027
 	 */
1028
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
1028
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
1029 1029
 		$success = true;
1030 1030
 		$saved_dtt = null;
1031 1031
 		$saved_tickets = array();
1032
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1033
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
1032
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
1033
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
1034 1034
 			//trim all values to ensure any excess whitespace is removed.
1035
-			$dtt = array_map( 'trim', $dtt );
1036
-			$dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end']
1035
+			$dtt = array_map('trim', $dtt);
1036
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end']
1037 1037
 				: $dtt['DTT_EVT_start'];
1038 1038
 			$datetime_values = array(
1039
-				'DTT_ID'        => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null,
1039
+				'DTT_ID'        => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
1040 1040
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
1041 1041
 				'DTT_EVT_end'   => $dtt['DTT_EVT_end'],
1042
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
1042
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
1043 1043
 				'DTT_order'     => $row,
1044 1044
 			);
1045 1045
 			//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.
1046
-			if ( ! empty( $dtt['DTT_ID'] ) ) {
1046
+			if ( ! empty($dtt['DTT_ID'])) {
1047 1047
 				$DTM = EE_Registry::instance()
1048
-				                  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
-				                  ->get_one_by_ID( $dtt['DTT_ID'] );
1050
-				$DTM->set_date_format( $incoming_date_formats[0] );
1051
-				$DTM->set_time_format( $incoming_date_formats[1] );
1052
-				foreach ( $datetime_values as $field => $value ) {
1053
-					$DTM->set( $field, $value );
1048
+				                  ->load_model('Datetime', array($evtobj->get_timezone()))
1049
+				                  ->get_one_by_ID($dtt['DTT_ID']);
1050
+				$DTM->set_date_format($incoming_date_formats[0]);
1051
+				$DTM->set_time_format($incoming_date_formats[1]);
1052
+				foreach ($datetime_values as $field => $value) {
1053
+					$DTM->set($field, $value);
1054 1054
 				}
1055 1055
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
1056
-				$saved_dtts[ $DTM->ID() ] = $DTM;
1056
+				$saved_dtts[$DTM->ID()] = $DTM;
1057 1057
 			} else {
1058
-				$DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false );
1059
-				$DTM->set_date_format( $incoming_date_formats[0] );
1060
-				$DTM->set_time_format( $incoming_date_formats[1] );
1061
-				$DTM->set_timezone( $evtobj->get_timezone() );
1062
-				foreach ( $datetime_values as $field => $value ) {
1063
-					$DTM->set( $field, $value );
1058
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false);
1059
+				$DTM->set_date_format($incoming_date_formats[0]);
1060
+				$DTM->set_time_format($incoming_date_formats[1]);
1061
+				$DTM->set_timezone($evtobj->get_timezone());
1062
+				foreach ($datetime_values as $field => $value) {
1063
+					$DTM->set($field, $value);
1064 1064
 				}
1065 1065
 			}
1066 1066
 			$DTM->save();
1067
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
1067
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
1068 1068
 			//load DTT helper
1069 1069
 			//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.
1070
-			if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) {
1071
-				$DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) );
1072
-				$DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' );
1070
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
1071
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1072
+				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1073 1073
 				$DTT->save();
1074 1074
 			}
1075 1075
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
@@ -1080,20 +1080,20 @@  discard block
 block discarded – undo
1080 1080
 		}
1081 1081
 		//no dtts get deleted so we don't do any of that logic here.
1082 1082
 		//update tickets next
1083
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array();
1084
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1085
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1083
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1084
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1085
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1086 1086
 			$update_prices = false;
1087
-			$ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] )
1088
-				? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0;
1087
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount'])
1088
+				? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1089 1089
 			// trim inputs to ensure any excess whitespace is removed.
1090
-			$tkt = array_map( 'trim', $tkt );
1091
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1090
+			$tkt = array_map('trim', $tkt);
1091
+			if (empty($tkt['TKT_start_date'])) {
1092 1092
 				//let's use now in the set timezone.
1093
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1094
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1093
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1094
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1095 1095
 			}
1096
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1096
+			if (empty($tkt['TKT_end_date'])) {
1097 1097
 				//use the start date of the first datetime
1098 1098
 				$dtt = $evtobj->first_datetime();
1099 1099
 				$tkt['TKT_end_date'] = $dtt->start_date_and_time(
@@ -1102,22 +1102,22 @@  discard block
 block discarded – undo
1102 1102
 				);
1103 1103
 			}
1104 1104
 			$TKT_values = array(
1105
-				'TKT_ID'          => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null,
1106
-				'TTM_ID'          => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1107
-				'TKT_name'        => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1108
-				'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1105
+				'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
1106
+				'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1107
+				'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1108
+				'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1109 1109
 				'TKT_start_date'  => $tkt['TKT_start_date'],
1110 1110
 				'TKT_end_date'    => $tkt['TKT_end_date'],
1111
-				'TKT_qty'         => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1112
-				'TKT_uses'        => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1113
-				'TKT_min'         => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1114
-				'TKT_max'         => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1111
+				'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1112
+				'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1113
+				'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1114
+				'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1115 1115
 				'TKT_row'         => $row,
1116
-				'TKT_order'       => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1116
+				'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1117 1117
 				'TKT_price'       => $ticket_price,
1118 1118
 			);
1119 1119
 			//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.
1120
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1120
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1121 1121
 				$TKT_values['TKT_ID'] = 0;
1122 1122
 				$TKT_values['TKT_is_default'] = 0;
1123 1123
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1126,110 +1126,110 @@  discard block
 block discarded – undo
1126 1126
 			//if we have a TKT_ID then we need to get that existing TKT_obj and update it
1127 1127
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1128 1128
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1129
-			if ( ! empty( $tkt['TKT_ID'] ) ) {
1129
+			if ( ! empty($tkt['TKT_ID'])) {
1130 1130
 				$TKT = EE_Registry::instance()
1131
-						->load_model( 'Ticket', array( $evtobj->get_timezone() ) )
1132
-						->get_one_by_ID( $tkt['TKT_ID'] );
1133
-				if ( $TKT instanceof EE_Ticket ) {
1131
+						->load_model('Ticket', array($evtobj->get_timezone()))
1132
+						->get_one_by_ID($tkt['TKT_ID']);
1133
+				if ($TKT instanceof EE_Ticket) {
1134 1134
 					$ticket_sold = $TKT->count_related(
1135 1135
 						'Registration',
1136 1136
 						array(
1137 1137
 							array(
1138 1138
 								'STS_ID' => array(
1139 1139
 									'NOT IN',
1140
-									array( EEM_Registration::status_id_incomplete ),
1140
+									array(EEM_Registration::status_id_incomplete),
1141 1141
 								),
1142 1142
 							),
1143 1143
 						)
1144 1144
 					) > 0 ? true : false;
1145 1145
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1146
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' )
1146
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price')
1147 1147
 					                  && ! $TKT->get(
1148 1148
 						'TKT_deleted'
1149 1149
 					) ? true : false;
1150
-					$TKT->set_date_format( $incoming_date_formats[0] );
1151
-					$TKT->set_time_format( $incoming_date_formats[1] );
1150
+					$TKT->set_date_format($incoming_date_formats[0]);
1151
+					$TKT->set_time_format($incoming_date_formats[1]);
1152 1152
 					//set new values
1153
-					foreach ( $TKT_values as $field => $value ) {
1154
-						if ( $field == 'TKT_qty' ) {
1155
-							$TKT->set_qty( $value );
1153
+					foreach ($TKT_values as $field => $value) {
1154
+						if ($field == 'TKT_qty') {
1155
+							$TKT->set_qty($value);
1156 1156
 						} else {
1157
-							$TKT->set( $field, $value );
1157
+							$TKT->set($field, $value);
1158 1158
 						}
1159 1159
 					}
1160 1160
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1161
-					if ( $create_new_TKT ) {
1161
+					if ($create_new_TKT) {
1162 1162
 						//archive the old ticket first
1163
-						$TKT->set( 'TKT_deleted', 1 );
1163
+						$TKT->set('TKT_deleted', 1);
1164 1164
 						$TKT->save();
1165 1165
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1166
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1166
+						$saved_tickets[$TKT->ID()] = $TKT;
1167 1167
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1168 1168
 						$TKT = clone $TKT;
1169
-						$TKT->set( 'TKT_ID', 0 );
1170
-						$TKT->set( 'TKT_deleted', 0 );
1171
-						$TKT->set( 'TKT_price', $ticket_price );
1172
-						$TKT->set( 'TKT_sold', 0 );
1169
+						$TKT->set('TKT_ID', 0);
1170
+						$TKT->set('TKT_deleted', 0);
1171
+						$TKT->set('TKT_price', $ticket_price);
1172
+						$TKT->set('TKT_sold', 0);
1173 1173
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1174 1174
 						$update_prices = true;
1175 1175
 					}
1176 1176
 					//make sure price is set if it hasn't been already
1177
-					$TKT->set( 'TKT_price', $ticket_price );
1177
+					$TKT->set('TKT_price', $ticket_price);
1178 1178
 				}
1179 1179
 			} else {
1180 1180
 				//no TKT_id so a new TKT
1181 1181
 				$TKT_values['TKT_price'] = $ticket_price;
1182
-				$TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false );
1183
-				if ( $TKT instanceof EE_Ticket ) {
1182
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false);
1183
+				if ($TKT instanceof EE_Ticket) {
1184 1184
 					//need to reset values to properly account for the date formats
1185
-					$TKT->set_date_format( $incoming_date_formats[0] );
1186
-					$TKT->set_time_format( $incoming_date_formats[1] );
1187
-					$TKT->set_timezone( $evtobj->get_timezone() );
1185
+					$TKT->set_date_format($incoming_date_formats[0]);
1186
+					$TKT->set_time_format($incoming_date_formats[1]);
1187
+					$TKT->set_timezone($evtobj->get_timezone());
1188 1188
 					//set new values
1189
-					foreach ( $TKT_values as $field => $value ) {
1190
-						if ( $field == 'TKT_qty' ) {
1191
-							$TKT->set_qty( $value );
1189
+					foreach ($TKT_values as $field => $value) {
1190
+						if ($field == 'TKT_qty') {
1191
+							$TKT->set_qty($value);
1192 1192
 						} else {
1193
-							$TKT->set( $field, $value );
1193
+							$TKT->set($field, $value);
1194 1194
 						}
1195 1195
 					}
1196 1196
 					$update_prices = true;
1197 1197
 				}
1198 1198
 			}
1199 1199
 			// cap ticket qty by datetime reg limits
1200
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1200
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1201 1201
 			//update ticket.
1202 1202
 			$TKT->save();
1203 1203
 			//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.
1204
-			if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) {
1205
-				$TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) );
1206
-				$TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' );
1204
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1205
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1206
+				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1207 1207
 				$TKT->save();
1208 1208
 			}
1209 1209
 			//initially let's add the ticket to the dtt
1210
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1211
-			$saved_tickets[ $TKT->ID() ] = $TKT;
1210
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1211
+			$saved_tickets[$TKT->ID()] = $TKT;
1212 1212
 			//add prices to ticket
1213
-			$this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices );
1213
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1214 1214
 		}
1215 1215
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1216
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1217
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1218
-		foreach ( $tickets_removed as $id ) {
1219
-			$id = absint( $id );
1216
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1217
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1218
+		foreach ($tickets_removed as $id) {
1219
+			$id = absint($id);
1220 1220
 			//get the ticket for this id
1221
-			$tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id );
1221
+			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
1222 1222
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1223
-			$dtts = $tkt_to_remove->get_many_related( 'Datetime' );
1224
-			foreach ( $dtts as $dtt ) {
1225
-				$tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' );
1223
+			$dtts = $tkt_to_remove->get_many_related('Datetime');
1224
+			foreach ($dtts as $dtt) {
1225
+				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1226 1226
 			}
1227 1227
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1228
-			$tkt_to_remove->delete_related_permanently( 'Price' );
1228
+			$tkt_to_remove->delete_related_permanently('Price');
1229 1229
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1230 1230
 			$tkt_to_remove->delete_permanently();
1231 1231
 		}
1232
-		return array( $saved_dtt, $saved_tickets );
1232
+		return array($saved_dtt, $saved_tickets);
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1246,29 +1246,29 @@  discard block
 block discarded – undo
1246 1246
 	 * @param bool      $new_prices Whether attach existing incoming prices or create new ones.
1247 1247
 	 * @return  void
1248 1248
 	 */
1249
-	private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) {
1250
-		foreach ( $prices as $row => $prc ) {
1249
+	private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) {
1250
+		foreach ($prices as $row => $prc) {
1251 1251
 			$PRC_values = array(
1252
-				'PRC_ID'         => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null,
1253
-				'PRT_ID'         => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null,
1254
-				'PRC_amount'     => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1255
-				'PRC_name'       => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1256
-				'PRC_desc'       => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1252
+				'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
1253
+				'PRT_ID'         => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null,
1254
+				'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1255
+				'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1256
+				'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1257 1257
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1258 1258
 				'PRC_order'      => $row,
1259 1259
 			);
1260
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1260
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1261 1261
 				$PRC_values['PRC_ID'] = 0;
1262
-				$PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false );
1262
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false);
1263 1263
 			} else {
1264
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1264
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1265 1265
 				//update this price with new values
1266
-				foreach ( $PRC_values as $field => $newprc ) {
1267
-					$PRC->set( $field, $newprc );
1266
+				foreach ($PRC_values as $field => $newprc) {
1267
+					$PRC->set($field, $newprc);
1268 1268
 				}
1269 1269
 				$PRC->save();
1270 1270
 			}
1271
-			$ticket->_add_relation_to( $PRC, 'Price' );
1271
+			$ticket->_add_relation_to($PRC, 'Price');
1272 1272
 		}
1273 1273
 	}
1274 1274
 
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 	private function _generate_publish_box_extra_content() {
1301 1301
 		//load formatter helper
1302 1302
 		//args for getting related registrations
1303
-		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1303
+		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1304 1304
 		$not_approved_query_args = array(
1305 1305
 			array(
1306 1306
 				'REG_deleted' => 0,
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1372 1372
 		// load template
1373 1373
 		EEH_Template::display_template(
1374
-			EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1374
+			EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php',
1375 1375
 			$publish_box_extra_args
1376 1376
 		);
1377 1377
 	}
@@ -1405,16 +1405,16 @@  discard block
 block discarded – undo
1405 1405
 		$this->verify_cpt_object();
1406 1406
 		add_meta_box(
1407 1407
 			'espresso_event_editor_tickets',
1408
-			esc_html__( 'Event Datetime & Ticket', 'event_espresso' ),
1409
-			array( $this, 'ticket_metabox' ),
1408
+			esc_html__('Event Datetime & Ticket', 'event_espresso'),
1409
+			array($this, 'ticket_metabox'),
1410 1410
 			$this->page_slug,
1411 1411
 			'normal',
1412 1412
 			'high'
1413 1413
 		);
1414 1414
 		add_meta_box(
1415 1415
 			'espresso_event_editor_event_options',
1416
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
1417
-			array( $this, 'registration_options_meta_box' ),
1416
+			esc_html__('Event Registration Options', 'event_espresso'),
1417
+			array($this, 'registration_options_meta_box'),
1418 1418
 			$this->page_slug,
1419 1419
 			'side',
1420 1420
 			'default'
@@ -1442,65 +1442,65 @@  discard block
 block discarded – undo
1442 1442
 			'trash_icon'               => 'ee-lock-icon',
1443 1443
 			'disabled'                 => '',
1444 1444
 		);
1445
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null;
1446
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1445
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1446
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1447 1447
 		/**
1448 1448
 		 * 1. Start with retrieving Datetimes
1449 1449
 		 * 2. Fore each datetime get related tickets
1450 1450
 		 * 3. For each ticket get related prices
1451 1451
 		 */
1452
-		$times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id );
1452
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1453 1453
 		/** @type EE_Datetime $first_datetime */
1454
-		$first_datetime = reset( $times );
1454
+		$first_datetime = reset($times);
1455 1455
 		//do we get related tickets?
1456
-		if ( $first_datetime instanceof EE_Datetime
1456
+		if ($first_datetime instanceof EE_Datetime
1457 1457
 		     && $first_datetime->ID() !== 0
1458 1458
 		) {
1459
-			$existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' );
1459
+			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1460 1460
 			$template_args['time'] = $first_datetime;
1461 1461
 			$related_tickets = $first_datetime->tickets(
1462 1462
 				array(
1463
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1463
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1464 1464
 					'default_where_conditions' => 'none',
1465 1465
 				)
1466 1466
 			);
1467
-			if ( ! empty( $related_tickets ) ) {
1468
-				$template_args['total_ticket_rows'] = count( $related_tickets );
1467
+			if ( ! empty($related_tickets)) {
1468
+				$template_args['total_ticket_rows'] = count($related_tickets);
1469 1469
 				$row = 0;
1470
-				foreach ( $related_tickets as $ticket ) {
1471
-					$existing_ticket_ids[] = $ticket->get( 'TKT_ID' );
1472
-					$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row );
1470
+				foreach ($related_tickets as $ticket) {
1471
+					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1472
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1473 1473
 					$row++;
1474 1474
 				}
1475 1475
 			} else {
1476 1476
 				$template_args['total_ticket_rows'] = 1;
1477 1477
 				/** @type EE_Ticket $ticket */
1478
-				$ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object();
1479
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1478
+				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1479
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1480 1480
 			}
1481 1481
 		} else {
1482 1482
 			$template_args['time'] = $times[0];
1483 1483
 			/** @type EE_Ticket $ticket */
1484
-			$ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets();
1485
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1484
+			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1485
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1486 1486
 			// NOTE: we're just sending the first default row
1487 1487
 			// (decaf can't manage default tickets so this should be sufficient);
1488 1488
 		}
1489 1489
 		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1490 1490
 			'event_editor_event_datetimes_help_tab'
1491 1491
 		);
1492
-		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' );
1493
-		$template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
1494
-		$template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
1492
+		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1493
+		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1494
+		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1495 1495
 		$template_args['ticket_js_structure'] = $this->_get_ticket_row(
1496
-			EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(),
1496
+			EE_Registry::instance()->load_model('Ticket')->create_default_object(),
1497 1497
 			true
1498 1498
 		);
1499 1499
 		$template = apply_filters(
1500 1500
 			'FHEE__Events_Admin_Page__ticket_metabox__template',
1501
-			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1501
+			EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'
1502 1502
 		);
1503
-		EEH_Template::display_template( $template, $template_args );
1503
+		EEH_Template::display_template($template, $template_args);
1504 1504
 	}
1505 1505
 
1506 1506
 
@@ -1514,74 +1514,74 @@  discard block
 block discarded – undo
1514 1514
 	 * @param int        $row
1515 1515
 	 * @return string generated html for the ticket row.
1516 1516
 	 */
1517
-	private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) {
1517
+	private function _get_ticket_row($ticket, $skeleton = false, $row = 0) {
1518 1518
 		$template_args = array(
1519
-			'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1519
+			'tkt_status_class'    => ' tkt-status-'.$ticket->ticket_status(),
1520 1520
 			'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1521 1521
 				: '',
1522 1522
 			'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1523
-			'TKT_ID'              => $ticket->get( 'TKT_ID' ),
1524
-			'TKT_name'            => $ticket->get( 'TKT_name' ),
1525
-			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ),
1526
-			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ),
1527
-			'TKT_is_default'      => $ticket->get( 'TKT_is_default' ),
1528
-			'TKT_qty'             => $ticket->get_pretty( 'TKT_qty', 'input' ),
1523
+			'TKT_ID'              => $ticket->get('TKT_ID'),
1524
+			'TKT_name'            => $ticket->get('TKT_name'),
1525
+			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1526
+			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1527
+			'TKT_is_default'      => $ticket->get('TKT_is_default'),
1528
+			'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1529 1529
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1530
-			'TKT_sold'            => $skeleton ? 0 : $ticket->get( 'TKT_sold' ),
1531
-			'trash_icon'          => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) )
1532
-			                         && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1530
+			'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1531
+			'trash_icon'          => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')))
1532
+			                         && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0)
1533 1533
 				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1534
-			'disabled'            => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? ''
1534
+			'disabled'            => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1535 1535
 				: ' disabled=disabled',
1536 1536
 		);
1537 1537
 		$price = $ticket->ID() !== 0
1538
-			? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) )
1539
-			: EE_Registry::instance()->load_model( 'Price' )->create_default_object();
1538
+			? $ticket->get_first_related('Price', array('default_where_conditions' => 'none'))
1539
+			: EE_Registry::instance()->load_model('Price')->create_default_object();
1540 1540
 		$price_args = array(
1541 1541
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1542
-			'PRC_amount'            => $price->get( 'PRC_amount' ),
1543
-			'PRT_ID'                => $price->get( 'PRT_ID' ),
1544
-			'PRC_ID'                => $price->get( 'PRC_ID' ),
1545
-			'PRC_is_default'        => $price->get( 'PRC_is_default' ),
1542
+			'PRC_amount'            => $price->get('PRC_amount'),
1543
+			'PRT_ID'                => $price->get('PRT_ID'),
1544
+			'PRC_ID'                => $price->get('PRC_ID'),
1545
+			'PRC_is_default'        => $price->get('PRC_is_default'),
1546 1546
 		);
1547 1547
 		//make sure we have default start and end dates if skeleton
1548 1548
 		//handle rows that should NOT be empty
1549
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1549
+		if (empty($template_args['TKT_start_date'])) {
1550 1550
 			//if empty then the start date will be now.
1551
-			$template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) );
1551
+			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1552 1552
 		}
1553
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1553
+		if (empty($template_args['TKT_end_date'])) {
1554 1554
 			//get the earliest datetime (if present);
1555 1555
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0
1556 1556
 				? $this->_cpt_model_obj->get_first_related(
1557 1557
 					'Datetime',
1558
-					array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) )
1558
+					array('order_by' => array('DTT_EVT_start' => 'ASC'))
1559 1559
 				)
1560 1560
 				: null;
1561
-			if ( ! empty( $earliest_dtt ) ) {
1562
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' );
1561
+			if ( ! empty($earliest_dtt)) {
1562
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1563 1563
 			} else {
1564 1564
 				$template_args['TKT_end_date'] = date(
1565 1565
 					'Y-m-d h:i a',
1566
-					mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) )
1566
+					mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))
1567 1567
 				);
1568 1568
 			}
1569 1569
 		}
1570
-		$template_args = array_merge( $template_args, $price_args );
1570
+		$template_args = array_merge($template_args, $price_args);
1571 1571
 		$template = apply_filters(
1572 1572
 			'FHEE__Events_Admin_Page__get_ticket_row__template',
1573
-			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1573
+			EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php',
1574 1574
 			$ticket
1575 1575
 		);
1576
-		return EEH_Template::display_template( $template, $template_args, true );
1576
+		return EEH_Template::display_template($template, $template_args, true);
1577 1577
 	}
1578 1578
 
1579 1579
 
1580 1580
 
1581 1581
 	public function registration_options_meta_box() {
1582 1582
 		$yes_no_values = array(
1583
-			array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ),
1584
-			array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ),
1583
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
1584
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
1585 1585
 		);
1586 1586
 		$default_reg_status_values = EEM_Registration::reg_status_array(
1587 1587
 			array(
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 		);
1594 1594
 		//$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1595 1595
 		$template_args['_event'] = $this->_cpt_model_obj;
1596
-		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false );
1596
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1597 1597
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1598 1598
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1599 1599
 			'default_reg_status',
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 			$default_reg_status_values
1622 1622
 		);
1623 1623
 		EEH_Template::display_template(
1624
-			EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1624
+			EVENTS_TEMPLATE_PATH.'event_registration_options.template.php',
1625 1625
 			$template_args
1626 1626
 		);
1627 1627
 	}
@@ -1640,97 +1640,97 @@  discard block
 block discarded – undo
1640 1640
 	 *                           that match the given _view and paging parameters.
1641 1641
 	 * @return array an array of event objects.
1642 1642
 	 */
1643
-	public function get_events( $per_page = 10, $current_page = 1, $count = false ) {
1643
+	public function get_events($per_page = 10, $current_page = 1, $count = false) {
1644 1644
 		$EEME = $this->_event_model();
1645
-		$offset = ( $current_page - 1 ) * $per_page;
1646
-		$limit = $count ? null : $offset . ',' . $per_page;
1647
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID';
1648
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC";
1649
-		if ( isset( $this->_req_data['month_range'] ) ) {
1650
-			$pieces = explode( ' ', $this->_req_data['month_range'], 3 );
1651
-			$month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : '';
1652
-			$year_r = ! empty( $pieces[1] ) ? $pieces[1] : '';
1645
+		$offset = ($current_page - 1) * $per_page;
1646
+		$limit = $count ? null : $offset.','.$per_page;
1647
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1648
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1649
+		if (isset($this->_req_data['month_range'])) {
1650
+			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1651
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1652
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1653 1653
 		}
1654 1654
 		$where = array();
1655
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
1655
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1656 1656
 		//determine what post_status our condition will have for the query.
1657
-		switch ( $status ) {
1657
+		switch ($status) {
1658 1658
 			case 'month' :
1659 1659
 			case 'today' :
1660 1660
 			case null :
1661 1661
 			case 'all' :
1662 1662
 				break;
1663 1663
 			case 'draft' :
1664
-				$where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) );
1664
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1665 1665
 				break;
1666 1666
 			default :
1667 1667
 				$where['status'] = $status;
1668 1668
 		}
1669 1669
 		//categories?
1670
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0
1670
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1671 1671
 			? $this->_req_data['EVT_CAT'] : null;
1672
-		if ( ! empty ( $category ) ) {
1672
+		if ( ! empty ($category)) {
1673 1673
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1674 1674
 			$where['Term_Taxonomy.term_id'] = $category;
1675 1675
 		}
1676 1676
 		//date where conditions
1677
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1678
-		if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) {
1677
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1678
+		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1679 1679
 			$DateTime = new DateTime(
1680
-				$year_r . '-' . $month_r . '-01 00:00:00',
1681
-				new DateTimeZone( EEM_Datetime::instance()->get_timezone() )
1680
+				$year_r.'-'.$month_r.'-01 00:00:00',
1681
+				new DateTimeZone(EEM_Datetime::instance()->get_timezone())
1682 1682
 			);
1683
-			$start = $DateTime->format( implode( ' ', $start_formats ) );
1684
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format(
1685
-				implode( ' ', $start_formats )
1683
+			$start = $DateTime->format(implode(' ', $start_formats));
1684
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(
1685
+				implode(' ', $start_formats)
1686 1686
 			);
1687
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1688
-		} else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) {
1689
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1690
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1691
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1692
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1693
-		} else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) {
1694
-			$now = date( 'Y-m-01' );
1695
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1696
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1697
-			$end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) )
1698
-			                ->setTime( 23, 59, 59 )
1699
-			                ->format( implode( ' ', $start_formats ) );
1700
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1687
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1688
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1689
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1690
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1691
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1692
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1693
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1694
+			$now = date('Y-m-01');
1695
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1696
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1697
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1698
+			                ->setTime(23, 59, 59)
1699
+			                ->format(implode(' ', $start_formats));
1700
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1701 1701
 		}
1702
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1702
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1703 1703
 			$where['EVT_wp_user'] = get_current_user_id();
1704 1704
 		} else {
1705
-			if ( ! isset( $where['status'] ) ) {
1706
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1705
+			if ( ! isset($where['status'])) {
1706
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1707 1707
 					$where['OR'] = array(
1708
-						'status*restrict_private' => array( '!=', 'private' ),
1708
+						'status*restrict_private' => array('!=', 'private'),
1709 1709
 						'AND'                     => array(
1710
-							'status*inclusive' => array( '=', 'private' ),
1710
+							'status*inclusive' => array('=', 'private'),
1711 1711
 							'EVT_wp_user'      => get_current_user_id(),
1712 1712
 						),
1713 1713
 					);
1714 1714
 				}
1715 1715
 			}
1716 1716
 		}
1717
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1718
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
-			     && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1717
+		if (isset($this->_req_data['EVT_wp_user'])) {
1718
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
+			     && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1720 1720
 			) {
1721 1721
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1722 1722
 			}
1723 1723
 		}
1724 1724
 		//search query handling
1725
-		if ( isset( $this->_req_data['s'] ) ) {
1726
-			$search_string = '%' . $this->_req_data['s'] . '%';
1725
+		if (isset($this->_req_data['s'])) {
1726
+			$search_string = '%'.$this->_req_data['s'].'%';
1727 1727
 			$where['OR'] = array(
1728
-				'EVT_name'       => array( 'LIKE', $search_string ),
1729
-				'EVT_desc'       => array( 'LIKE', $search_string ),
1730
-				'EVT_short_desc' => array( 'LIKE', $search_string ),
1728
+				'EVT_name'       => array('LIKE', $search_string),
1729
+				'EVT_desc'       => array('LIKE', $search_string),
1730
+				'EVT_short_desc' => array('LIKE', $search_string),
1731 1731
 			);
1732 1732
 		}
1733
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1733
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1734 1734
 		$query_params = apply_filters(
1735 1735
 			'FHEE__Events_Admin_Page__get_events__query_params',
1736 1736
 			array(
@@ -1743,23 +1743,23 @@  discard block
 block discarded – undo
1743 1743
 			$this->_req_data
1744 1744
 		);
1745 1745
 		//let's first check if we have special requests coming in.
1746
-		if ( isset( $this->_req_data['active_status'] ) ) {
1747
-			switch ( $this->_req_data['active_status'] ) {
1746
+		if (isset($this->_req_data['active_status'])) {
1747
+			switch ($this->_req_data['active_status']) {
1748 1748
 				case 'upcoming' :
1749
-					return $EEME->get_upcoming_events( $query_params, $count );
1749
+					return $EEME->get_upcoming_events($query_params, $count);
1750 1750
 					break;
1751 1751
 				case 'expired' :
1752
-					return $EEME->get_expired_events( $query_params, $count );
1752
+					return $EEME->get_expired_events($query_params, $count);
1753 1753
 					break;
1754 1754
 				case 'active' :
1755
-					return $EEME->get_active_events( $query_params, $count );
1755
+					return $EEME->get_active_events($query_params, $count);
1756 1756
 					break;
1757 1757
 				case 'inactive' :
1758
-					return $EEME->get_inactive_events( $query_params, $count );
1758
+					return $EEME->get_inactive_events($query_params, $count);
1759 1759
 					break;
1760 1760
 			}
1761 1761
 		}
1762
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1762
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1763 1763
 		return $events;
1764 1764
 	}
1765 1765
 
@@ -1770,9 +1770,9 @@  discard block
 block discarded – undo
1770 1770
 	 *
1771 1771
 	 * @param string $post_id
1772 1772
 	 */
1773
-	public function trash_cpt_item( $post_id ) {
1773
+	public function trash_cpt_item($post_id) {
1774 1774
 		$this->_req_data['EVT_ID'] = $post_id;
1775
-		$this->_trash_or_restore_event( 'trash', false );
1775
+		$this->_trash_or_restore_event('trash', false);
1776 1776
 	}
1777 1777
 
1778 1778
 
@@ -1780,9 +1780,9 @@  discard block
 block discarded – undo
1780 1780
 	/**
1781 1781
 	 * @param string $post_id
1782 1782
 	 */
1783
-	public function restore_cpt_item( $post_id ) {
1783
+	public function restore_cpt_item($post_id) {
1784 1784
 		$this->_req_data['EVT_ID'] = $post_id;
1785
-		$this->_trash_or_restore_event( 'draft', false );
1785
+		$this->_trash_or_restore_event('draft', false);
1786 1786
 	}
1787 1787
 
1788 1788
 
@@ -1790,9 +1790,9 @@  discard block
 block discarded – undo
1790 1790
 	/**
1791 1791
 	 * @param string $post_id
1792 1792
 	 */
1793
-	public function delete_cpt_item( $post_id ) {
1793
+	public function delete_cpt_item($post_id) {
1794 1794
 		$this->_req_data['EVT_ID'] = $post_id;
1795
-		$this->_delete_event( false );
1795
+		$this->_delete_event(false);
1796 1796
 	}
1797 1797
 
1798 1798
 
@@ -1804,23 +1804,23 @@  discard block
 block discarded – undo
1804 1804
 	 * @param  string $event_status
1805 1805
 	 * @param bool    $redirect_after
1806 1806
 	 */
1807
-	protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) {
1807
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) {
1808 1808
 		//determine the event id and set to array.
1809
-		$EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false;
1809
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false;
1810 1810
 		// loop thru events
1811
-		if ( $EVT_ID ) {
1811
+		if ($EVT_ID) {
1812 1812
 			// clean status
1813
-			$event_status = sanitize_key( $event_status );
1813
+			$event_status = sanitize_key($event_status);
1814 1814
 			// grab status
1815
-			if ( ! empty( $event_status ) ) {
1816
-				$success = $this->_change_event_status( $EVT_ID, $event_status );
1815
+			if ( ! empty($event_status)) {
1816
+				$success = $this->_change_event_status($EVT_ID, $event_status);
1817 1817
 			} else {
1818 1818
 				$success = false;
1819 1819
 				$msg = esc_html__(
1820 1820
 					'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
1821 1821
 					'event_espresso'
1822 1822
 				);
1823
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1823
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1824 1824
 			}
1825 1825
 		} else {
1826 1826
 			$success = false;
@@ -1828,11 +1828,11 @@  discard block
 block discarded – undo
1828 1828
 				'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
1829 1829
 				'event_espresso'
1830 1830
 			);
1831
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1831
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1832 1832
 		}
1833 1833
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1834
-		if ( $redirect_after ) {
1835
-			$this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) );
1834
+		if ($redirect_after) {
1835
+			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1836 1836
 		}
1837 1837
 	}
1838 1838
 
@@ -1845,18 +1845,18 @@  discard block
 block discarded – undo
1845 1845
 	 * @param  string $event_status
1846 1846
 	 * @return void
1847 1847
 	 */
1848
-	protected function _trash_or_restore_events( $event_status = 'trash' ) {
1848
+	protected function _trash_or_restore_events($event_status = 'trash') {
1849 1849
 		// clean status
1850
-		$event_status = sanitize_key( $event_status );
1850
+		$event_status = sanitize_key($event_status);
1851 1851
 		// grab status
1852
-		if ( ! empty( $event_status ) ) {
1852
+		if ( ! empty($event_status)) {
1853 1853
 			$success = true;
1854 1854
 			//determine the event id and set to array.
1855
-			$EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array();
1855
+			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1856 1856
 			// loop thru events
1857
-			foreach ( $EVT_IDs as $EVT_ID ) {
1858
-				if ( $EVT_ID = absint( $EVT_ID ) ) {
1859
-					$results = $this->_change_event_status( $EVT_ID, $event_status );
1857
+			foreach ($EVT_IDs as $EVT_ID) {
1858
+				if ($EVT_ID = absint($EVT_ID)) {
1859
+					$results = $this->_change_event_status($EVT_ID, $event_status);
1860 1860
 					$success = $results !== false ? $success : false;
1861 1861
 				} else {
1862 1862
 					$msg = sprintf(
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 						),
1867 1867
 						$EVT_ID
1868 1868
 					);
1869
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1869
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1870 1870
 					$success = false;
1871 1871
 				}
1872 1872
 			}
@@ -1876,12 +1876,12 @@  discard block
 block discarded – undo
1876 1876
 				'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
1877 1877
 				'event_espresso'
1878 1878
 			);
1879
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1879
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1880 1880
 		}
1881 1881
 		// in order to force a pluralized result message we need to send back a success status greater than 1
1882 1882
 		$success = $success ? 2 : false;
1883 1883
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1884
-		$this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) );
1884
+		$this->_redirect_after_action($success, 'Events', $action, array('action' => 'default'));
1885 1885
 	}
1886 1886
 
1887 1887
 
@@ -1894,30 +1894,30 @@  discard block
 block discarded – undo
1894 1894
 	 * @param  string $event_status
1895 1895
 	 * @return bool
1896 1896
 	 */
1897
-	private function _change_event_status( $EVT_ID = 0, $event_status = '' ) {
1897
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1898 1898
 		// grab event id
1899
-		if ( ! $EVT_ID ) {
1899
+		if ( ! $EVT_ID) {
1900 1900
 			$msg = esc_html__(
1901 1901
 				'An error occurred. No Event ID or an invalid Event ID was received.',
1902 1902
 				'event_espresso'
1903 1903
 			);
1904
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1904
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1905 1905
 			return false;
1906 1906
 		}
1907
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1907
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1908 1908
 		// clean status
1909
-		$event_status = sanitize_key( $event_status );
1909
+		$event_status = sanitize_key($event_status);
1910 1910
 		// grab status
1911
-		if ( empty( $event_status ) ) {
1911
+		if (empty($event_status)) {
1912 1912
 			$msg = esc_html__(
1913 1913
 				'An error occurred. No Event Status or an invalid Event Status was received.',
1914 1914
 				'event_espresso'
1915 1915
 			);
1916
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1916
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1917 1917
 			return false;
1918 1918
 		}
1919 1919
 		// was event trashed or restored ?
1920
-		switch ( $event_status ) {
1920
+		switch ($event_status) {
1921 1921
 			case 'draft' :
1922 1922
 				$action = 'restored from the trash';
1923 1923
 				$hook = 'AHEE_event_restored_from_trash';
@@ -1931,15 +1931,15 @@  discard block
 block discarded – undo
1931 1931
 				$hook = false;
1932 1932
 		}
1933 1933
 		//use class to change status
1934
-		$this->_cpt_model_obj->set_status( $event_status );
1934
+		$this->_cpt_model_obj->set_status($event_status);
1935 1935
 		$success = $this->_cpt_model_obj->save();
1936
-		if ( $success === false ) {
1937
-			$msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action );
1938
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1936
+		if ($success === false) {
1937
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1938
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1939 1939
 			return false;
1940 1940
 		}
1941
-		if ( $hook ) {
1942
-			do_action( $hook );
1941
+		if ($hook) {
1942
+			do_action($hook);
1943 1943
 		}
1944 1944
 		return true;
1945 1945
 	}
@@ -1952,34 +1952,34 @@  discard block
 block discarded – undo
1952 1952
 	 * @access protected
1953 1953
 	 * @param bool $redirect_after
1954 1954
 	 */
1955
-	protected function _delete_event( $redirect_after = true ) {
1955
+	protected function _delete_event($redirect_after = true) {
1956 1956
 		//determine the event id and set to array.
1957
-		$EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null;
1958
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1957
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null;
1958
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1959 1959
 		// loop thru events
1960
-		if ( $EVT_ID ) {
1961
-			$success = $this->_permanently_delete_event( $EVT_ID );
1960
+		if ($EVT_ID) {
1961
+			$success = $this->_permanently_delete_event($EVT_ID);
1962 1962
 			// get list of events with no prices
1963
-			$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() );
1963
+			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1964 1964
 			// remove this event from the list of events with no prices
1965
-			if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) {
1966
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1965
+			if (isset($espresso_no_ticket_prices[$EVT_ID])) {
1966
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1967 1967
 			}
1968
-			update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices );
1968
+			update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
1969 1969
 		} else {
1970 1970
 			$success = false;
1971 1971
 			$msg = esc_html__(
1972 1972
 				'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
1973 1973
 				'event_espresso'
1974 1974
 			);
1975
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1975
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1976 1976
 		}
1977
-		if ( $redirect_after ) {
1977
+		if ($redirect_after) {
1978 1978
 			$this->_redirect_after_action(
1979 1979
 				$success,
1980 1980
 				'Event',
1981 1981
 				'deleted',
1982
-				array( 'action' => 'default', 'status' => 'trash' )
1982
+				array('action' => 'default', 'status' => 'trash')
1983 1983
 			);
1984 1984
 		}
1985 1985
 	}
@@ -1995,30 +1995,30 @@  discard block
 block discarded – undo
1995 1995
 	protected function _delete_events() {
1996 1996
 		$success = true;
1997 1997
 		// get list of events with no prices
1998
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() );
1998
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1999 1999
 		//determine the event id and set to array.
2000
-		$EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array();
2000
+		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
2001 2001
 		// loop thru events
2002
-		foreach ( $EVT_IDs as $EVT_ID ) {
2003
-			$EVT_ID = absint( $EVT_ID );
2004
-			if ( $EVT_ID ) {
2005
-				$results = $this->_permanently_delete_event( $EVT_ID );
2002
+		foreach ($EVT_IDs as $EVT_ID) {
2003
+			$EVT_ID = absint($EVT_ID);
2004
+			if ($EVT_ID) {
2005
+				$results = $this->_permanently_delete_event($EVT_ID);
2006 2006
 				$success = $results !== false ? $success : false;
2007 2007
 				// remove this event from the list of events with no prices
2008
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
2008
+				unset($espresso_no_ticket_prices[$EVT_ID]);
2009 2009
 			} else {
2010 2010
 				$success = false;
2011 2011
 				$msg = esc_html__(
2012 2012
 					'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2013 2013
 					'event_espresso'
2014 2014
 				);
2015
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2015
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2016 2016
 			}
2017 2017
 		}
2018
-		update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices );
2018
+		update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2019 2019
 		// in order to force a pluralized result message we need to send back a success status greater than 1
2020 2020
 		$success = $success ? 2 : false;
2021
-		$this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) );
2021
+		$this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default'));
2022 2022
 	}
2023 2023
 
2024 2024
 
@@ -2030,70 +2030,70 @@  discard block
 block discarded – undo
2030 2030
 	 * @param  int $EVT_ID
2031 2031
 	 * @return bool
2032 2032
 	 */
2033
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
2033
+	private function _permanently_delete_event($EVT_ID = 0) {
2034 2034
 		// grab event id
2035
-		if ( ! $EVT_ID ) {
2035
+		if ( ! $EVT_ID) {
2036 2036
 			$msg = esc_html__(
2037 2037
 				'An error occurred. No Event ID or an invalid Event ID was received.',
2038 2038
 				'event_espresso'
2039 2039
 			);
2040
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2040
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2041 2041
 			return false;
2042 2042
 		}
2043 2043
 		if (
2044 2044
 			! $this->_cpt_model_obj instanceof EE_Event
2045 2045
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
2046 2046
 		) {
2047
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
2047
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2048 2048
 		}
2049
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
2049
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
2050 2050
 			return false;
2051 2051
 		}
2052 2052
 		//need to delete related tickets and prices first.
2053
-		$datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' );
2054
-		foreach ( $datetimes as $datetime ) {
2055
-			$this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' );
2056
-			$tickets = $datetime->get_many_related( 'Ticket' );
2057
-			foreach ( $tickets as $ticket ) {
2058
-				$ticket->_remove_relation_to( $datetime, 'Datetime' );
2059
-				$ticket->delete_related_permanently( 'Price' );
2053
+		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
2054
+		foreach ($datetimes as $datetime) {
2055
+			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
2056
+			$tickets = $datetime->get_many_related('Ticket');
2057
+			foreach ($tickets as $ticket) {
2058
+				$ticket->_remove_relation_to($datetime, 'Datetime');
2059
+				$ticket->delete_related_permanently('Price');
2060 2060
 				$ticket->delete_permanently();
2061 2061
 			}
2062 2062
 			$datetime->delete();
2063 2063
 		}
2064 2064
 		//what about related venues or terms?
2065
-		$venues = $this->_cpt_model_obj->get_many_related( 'Venue' );
2066
-		foreach ( $venues as $venue ) {
2067
-			$this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' );
2065
+		$venues = $this->_cpt_model_obj->get_many_related('Venue');
2066
+		foreach ($venues as $venue) {
2067
+			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
2068 2068
 		}
2069 2069
 		//any attached question groups?
2070
-		$question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' );
2071
-		if ( ! empty( $question_groups ) ) {
2072
-			foreach ( $question_groups as $question_group ) {
2073
-				$this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' );
2070
+		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
2071
+		if ( ! empty($question_groups)) {
2072
+			foreach ($question_groups as $question_group) {
2073
+				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
2074 2074
 			}
2075 2075
 		}
2076 2076
 		//Message Template Groups
2077
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
2077
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
2078 2078
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
2079 2079
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
2080
-		foreach ( $term_taxonomies as $term_taxonomy ) {
2081
-			$this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy );
2080
+		foreach ($term_taxonomies as $term_taxonomy) {
2081
+			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
2082 2082
 		}
2083 2083
 		$success = $this->_cpt_model_obj->delete_permanently();
2084 2084
 		// did it all go as planned ?
2085
-		if ( $success ) {
2086
-			$msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID );
2087
-			EE_Error::add_success( $msg );
2085
+		if ($success) {
2086
+			$msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
2087
+			EE_Error::add_success($msg);
2088 2088
 		} else {
2089 2089
 			$msg = sprintf(
2090
-				esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ),
2090
+				esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'),
2091 2091
 				$EVT_ID
2092 2092
 			);
2093
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2093
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2094 2094
 			return false;
2095 2095
 		}
2096
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
2096
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
2097 2097
 		return true;
2098 2098
 	}
2099 2099
 
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 * @return int
2107 2107
 	 */
2108 2108
 	public function total_events() {
2109
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
2109
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
2110 2110
 		return $count;
2111 2111
 	}
2112 2112
 
@@ -2120,9 +2120,9 @@  discard block
 block discarded – undo
2120 2120
 	 */
2121 2121
 	public function total_events_draft() {
2122 2122
 		$where = array(
2123
-			'status' => array( 'IN', array( 'draft', 'auto-draft' ) ),
2123
+			'status' => array('IN', array('draft', 'auto-draft')),
2124 2124
 		);
2125
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2125
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2126 2126
 		return $count;
2127 2127
 	}
2128 2128
 
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
 		$where = array(
2139 2139
 			'status' => 'trash',
2140 2140
 		);
2141
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2141
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2142 2142
 		return $count;
2143 2143
 	}
2144 2144
 
@@ -2169,12 +2169,12 @@  discard block
 block discarded – undo
2169 2169
 			EE_Registry::instance()->CFG->registration->default_STS_ID,
2170 2170
 			$this->_template_args['reg_status_array']
2171 2171
 		)
2172
-			? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID )
2172
+			? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID)
2173 2173
 			: EEM_Registration::status_id_pending_payment;
2174
-		$this->_set_add_edit_form_tags( 'update_default_event_settings' );
2175
-		$this->_set_publish_post_box_vars( null, false, false, null, false );
2174
+		$this->_set_add_edit_form_tags('update_default_event_settings');
2175
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
2176 2176
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2177
-			EVENTS_TEMPLATE_PATH . 'event_settings.template.php',
2177
+			EVENTS_TEMPLATE_PATH.'event_settings.template.php',
2178 2178
 			$this->_template_args,
2179 2179
 			true
2180 2180
 		);
@@ -2190,8 +2190,8 @@  discard block
 block discarded – undo
2190 2190
 	 * @return void
2191 2191
 	 */
2192 2192
 	protected function _update_default_event_settings() {
2193
-		EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] )
2194
-			? sanitize_text_field( $this->_req_data['default_reg_status'] )
2193
+		EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status'])
2194
+			? sanitize_text_field($this->_req_data['default_reg_status'])
2195 2195
 			: EEM_Registration::status_id_pending_payment;
2196 2196
 		$what = 'Default Event Settings';
2197 2197
 		$success = $this->_update_espresso_configuration(
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 			__FUNCTION__,
2202 2202
 			__LINE__
2203 2203
 		);
2204
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) );
2204
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings'));
2205 2205
 	}
2206 2206
 
2207 2207
 
@@ -2211,20 +2211,20 @@  discard block
 block discarded – undo
2211 2211
 
2212 2212
 
2213 2213
 	protected function _template_settings() {
2214
-		$this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' );
2214
+		$this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2215 2215
 		$this->_template_args['preview_img'] = '<img src="'
2216 2216
 		                                       . EVENTS_ASSETS_URL
2217 2217
 		                                       . DS
2218 2218
 		                                       . 'images'
2219 2219
 		                                       . DS
2220 2220
 		                                       . 'caffeinated_template_features.jpg" alt="'
2221
-		                                       . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2221
+		                                       . esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2222 2222
 		                                       . '" />';
2223
-		$this->_template_args['preview_text'] = '<strong>' . esc_html__(
2223
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__(
2224 2224
 				'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2225 2225
 				'event_espresso'
2226
-			) . '</strong>';
2227
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2226
+			).'</strong>';
2227
+		$this->display_admin_caf_preview_page('template_settings_tab');
2228 2228
 	}
2229 2229
 
2230 2230
 
@@ -2236,18 +2236,18 @@  discard block
 block discarded – undo
2236 2236
 	 * @return void
2237 2237
 	 */
2238 2238
 	private function _set_category_object() {
2239
-		if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) {
2239
+		if (isset($this->_category->id) && ! empty($this->_category->id)) {
2240 2240
 			return;
2241 2241
 		} //already have the category object so get out.
2242 2242
 		//set default category object
2243 2243
 		$this->_set_empty_category_object();
2244 2244
 		//only set if we've got an id
2245
-		if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) {
2245
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2246 2246
 			return;
2247 2247
 		}
2248
-		$category_id = absint( $this->_req_data['EVT_CAT_ID'] );
2249
-		$term = get_term( $category_id, 'espresso_event_categories' );
2250
-		if ( ! empty( $term ) ) {
2248
+		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2249
+		$term = get_term($category_id, 'espresso_event_categories');
2250
+		if ( ! empty($term)) {
2251 2251
 			$this->_category->category_name = $term->name;
2252 2252
 			$this->_category->category_identifier = $term->slug;
2253 2253
 			$this->_category->category_desc = $term->description;
@@ -2267,9 +2267,9 @@  discard block
 block discarded – undo
2267 2267
 
2268 2268
 
2269 2269
 	protected function _category_list_table() {
2270
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2271
-		$this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' );
2272
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
2270
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2271
+		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2272
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
2273 2273
 				'add_category',
2274 2274
 				'add_category',
2275 2275
 				array(),
@@ -2283,20 +2283,20 @@  discard block
 block discarded – undo
2283 2283
 	/**
2284 2284
 	 * @param $view
2285 2285
 	 */
2286
-	protected function _category_details( $view ) {
2286
+	protected function _category_details($view) {
2287 2287
 		//load formatter helper
2288 2288
 		//load field generator helper
2289 2289
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2290
-		$this->_set_add_edit_form_tags( $route );
2290
+		$this->_set_add_edit_form_tags($route);
2291 2291
 		$this->_set_category_object();
2292
-		$id = ! empty( $this->_category->id ) ? $this->_category->id : '';
2292
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2293 2293
 		$delete_action = 'delete_category';
2294 2294
 		//custom redirect
2295 2295
 		$redirect = EE_Admin_Page::add_query_args_and_nonce(
2296
-			array( 'action' => 'category_list' ),
2296
+			array('action' => 'category_list'),
2297 2297
 			$this->_admin_base_url
2298 2298
 		);
2299
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2299
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2300 2300
 		//take care of contents
2301 2301
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
2302 2302
 		$this->display_admin_page_with_sidebar();
@@ -2310,21 +2310,21 @@  discard block
 block discarded – undo
2310 2310
 	protected function _category_details_content() {
2311 2311
 		$editor_args['category_desc'] = array(
2312 2312
 			'type'          => 'wp_editor',
2313
-			'value'         => EEH_Formatter::admin_format_content( $this->_category->category_desc ),
2313
+			'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2314 2314
 			'class'         => 'my_editor_custom',
2315
-			'wpeditor_args' => array( 'media_buttons' => false ),
2315
+			'wpeditor_args' => array('media_buttons' => false),
2316 2316
 		);
2317
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2317
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2318 2318
 		$all_terms = get_terms(
2319
-			array( 'espresso_event_categories' ),
2320
-			array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) )
2319
+			array('espresso_event_categories'),
2320
+			array('hide_empty' => 0, 'exclude' => array($this->_category->id))
2321 2321
 		);
2322 2322
 		//setup category select for term parents.
2323 2323
 		$category_select_values[] = array(
2324
-			'text' => esc_html__( 'No Parent', 'event_espresso' ),
2324
+			'text' => esc_html__('No Parent', 'event_espresso'),
2325 2325
 			'id'   => 0,
2326 2326
 		);
2327
-		foreach ( $all_terms as $term ) {
2327
+		foreach ($all_terms as $term) {
2328 2328
 			$category_select_values[] = array(
2329 2329
 				'text' => $term->name,
2330 2330
 				'id'   => $term->term_id,
@@ -2338,28 +2338,28 @@  discard block
 block discarded – undo
2338 2338
 		$template_args = array(
2339 2339
 			'category'                 => $this->_category,
2340 2340
 			'category_select'          => $category_select,
2341
-			'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ),
2341
+			'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2342 2342
 			'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2343 2343
 			'disable'                  => '',
2344 2344
 			'disabled_message'         => false,
2345 2345
 		);
2346
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2347
-		return EEH_Template::display_template( $template, $template_args, true );
2346
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2347
+		return EEH_Template::display_template($template, $template_args, true);
2348 2348
 	}
2349 2349
 
2350 2350
 
2351 2351
 
2352 2352
 	protected function _delete_categories() {
2353
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID']
2353
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID']
2354 2354
 			: (array) $this->_req_data['category_id'];
2355
-		foreach ( $cat_ids as $cat_id ) {
2356
-			$this->_delete_category( $cat_id );
2355
+		foreach ($cat_ids as $cat_id) {
2356
+			$this->_delete_category($cat_id);
2357 2357
 		}
2358 2358
 		//doesn't matter what page we're coming from... we're going to the same place after delete.
2359 2359
 		$query_args = array(
2360 2360
 			'action' => 'category_list',
2361 2361
 		);
2362
-		$this->_redirect_after_action( 0, '', '', $query_args );
2362
+		$this->_redirect_after_action(0, '', '', $query_args);
2363 2363
 	}
2364 2364
 
2365 2365
 
@@ -2367,9 +2367,9 @@  discard block
 block discarded – undo
2367 2367
 	/**
2368 2368
 	 * @param $cat_id
2369 2369
 	 */
2370
-	protected function _delete_category( $cat_id ) {
2371
-		$cat_id = absint( $cat_id );
2372
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2370
+	protected function _delete_category($cat_id) {
2371
+		$cat_id = absint($cat_id);
2372
+		wp_delete_term($cat_id, 'espresso_event_categories');
2373 2373
 	}
2374 2374
 
2375 2375
 
@@ -2377,18 +2377,18 @@  discard block
 block discarded – undo
2377 2377
 	/**
2378 2378
 	 * @param $new_category
2379 2379
 	 */
2380
-	protected function _insert_or_update_category( $new_category ) {
2381
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true );
2380
+	protected function _insert_or_update_category($new_category) {
2381
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2382 2382
 		$success = 0; //we already have a success message so lets not send another.
2383
-		if ( $cat_id ) {
2383
+		if ($cat_id) {
2384 2384
 			$query_args = array(
2385 2385
 				'action'     => 'edit_category',
2386 2386
 				'EVT_CAT_ID' => $cat_id,
2387 2387
 			);
2388 2388
 		} else {
2389
-			$query_args = array( 'action' => 'add_category' );
2389
+			$query_args = array('action' => 'add_category');
2390 2390
 		}
2391
-		$this->_redirect_after_action( $success, '', '', $query_args, true );
2391
+		$this->_redirect_after_action($success, '', '', $query_args, true);
2392 2392
 	}
2393 2393
 
2394 2394
 
@@ -2397,14 +2397,14 @@  discard block
 block discarded – undo
2397 2397
 	 * @param bool $update
2398 2398
 	 * @return bool|mixed|string
2399 2399
 	 */
2400
-	private function _insert_category( $update = false ) {
2400
+	private function _insert_category($update = false) {
2401 2401
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2402
-		$category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2403
-		$category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2404
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2405
-		if ( empty( $category_name ) ) {
2406
-			$msg = esc_html__( 'You must add a name for the category.', 'event_espresso' );
2407
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2402
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2403
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2404
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2405
+		if (empty($category_name)) {
2406
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2407
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2408 2408
 			return false;
2409 2409
 		}
2410 2410
 		$term_args = array(
@@ -2413,22 +2413,22 @@  discard block
 block discarded – undo
2413 2413
 			'parent'      => $category_parent,
2414 2414
 		);
2415 2415
 		//was the category_identifier input disabled?
2416
-		if ( isset( $this->_req_data['category_identifier'] ) ) {
2416
+		if (isset($this->_req_data['category_identifier'])) {
2417 2417
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2418 2418
 		}
2419 2419
 		$insert_ids = $update
2420
-			? wp_update_term( $cat_id, 'espresso_event_categories', $term_args )
2421
-			: wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2422
-		if ( ! is_array( $insert_ids ) ) {
2420
+			? wp_update_term($cat_id, 'espresso_event_categories', $term_args)
2421
+			: wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2422
+		if ( ! is_array($insert_ids)) {
2423 2423
 			$msg = esc_html__(
2424 2424
 				'An error occurred and the category has not been saved to the database.',
2425 2425
 				'event_espresso'
2426 2426
 			);
2427
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2427
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2428 2428
 		} else {
2429 2429
 			$cat_id = $insert_ids['term_id'];
2430
-			$msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name );
2431
-			EE_Error::add_success( $msg );
2430
+			$msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2431
+			EE_Error::add_success($msg);
2432 2432
 		}
2433 2433
 		return $cat_id;
2434 2434
 	}
@@ -2441,28 +2441,28 @@  discard block
 block discarded – undo
2441 2441
 	 * @param bool $count
2442 2442
 	 * @return \EE_Base_Class[]|int
2443 2443
 	 */
2444
-	public function get_categories( $per_page = 10, $current_page = 1, $count = false ) {
2444
+	public function get_categories($per_page = 10, $current_page = 1, $count = false) {
2445 2445
 		//testing term stuff
2446
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2447
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2448
-		$limit = ( $current_page - 1 ) * $per_page;
2449
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2450
-		if ( isset( $this->_req_data['s'] ) ) {
2451
-			$sstr = '%' . $this->_req_data['s'] . '%';
2446
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2447
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2448
+		$limit = ($current_page - 1) * $per_page;
2449
+		$where = array('taxonomy' => 'espresso_event_categories');
2450
+		if (isset($this->_req_data['s'])) {
2451
+			$sstr = '%'.$this->_req_data['s'].'%';
2452 2452
 			$where['OR'] = array(
2453
-				'Term.name'   => array( 'LIKE', $sstr ),
2454
-				'description' => array( 'LIKE', $sstr ),
2453
+				'Term.name'   => array('LIKE', $sstr),
2454
+				'description' => array('LIKE', $sstr),
2455 2455
 			);
2456 2456
 		}
2457 2457
 		$query_params = array(
2458 2458
 			$where,
2459
-			'order_by'   => array( $orderby => $order ),
2460
-			'limit'      => $limit . ',' . $per_page,
2461
-			'force_join' => array( 'Term' ),
2459
+			'order_by'   => array($orderby => $order),
2460
+			'limit'      => $limit.','.$per_page,
2461
+			'force_join' => array('Term'),
2462 2462
 		);
2463 2463
 		$categories = $count
2464
-			? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' )
2465
-			: EEM_Term_Taxonomy::instance()->get_all( $query_params );
2464
+			? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2465
+			: EEM_Term_Taxonomy::instance()->get_all($query_params);
2466 2466
 		return $categories;
2467 2467
 	}
2468 2468
 
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * @param EE_Line_Item $line_item
57 57
 	 * @param array        $options
58
-	 * @return mixed
58
+	 * @return string
59 59
 	 */
60 60
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
61 61
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @param EE_Line_Item $line_item
137 137
 	 * @param array        $options
138
-	 * @return mixed
138
+	 * @return string
139 139
 	 */
140 140
 	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
141 141
 		// start of row
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @param EE_Line_Item $line_item
180 180
 	 * @param array        $options
181
-	 * @return mixed
181
+	 * @return string
182 182
 	 */
183 183
 	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
184 184
 		// start of row
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
 			);
285 285
 			$title = esc_attr__( 'Duplicate Event', 'event_espresso' );
286 286
 			$return .= '<a href="'
287
-			           . $href
288
-			           . '" title="'
289
-			           . $title
290
-			           . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'
291
-			           . $title
292
-			           . '</button>';
287
+					   . $href
288
+					   . '" title="'
289
+					   . $title
290
+					   . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'
291
+					   . $title
292
+					   . '</button>';
293 293
 		}
294 294
 		return $return;
295 295
 	}
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 			);
451 451
 			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
452 452
 			$action_links[] = '<a href="'
453
-			                  . $reports_link
454
-			                  . '" title="'
455
-			                  . esc_attr__( 'View Report', 'event_espresso' )
456
-			                  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
457
-			                  . "\n\t";
453
+							  . $reports_link
454
+							  . '" title="'
455
+							  . esc_attr__( 'View Report', 'event_espresso' )
456
+							  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
457
+							  . "\n\t";
458 458
 		}
459 459
 		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
460 460
 			EE_Registry::instance()->load_helper( 'MSG_Template' );
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param bool $routing
23 23
 	 */
24
-	public function __construct( $routing = true ) {
25
-		parent::__construct( $routing );
26
-		if ( ! defined( 'EVENTS_CAF_TEMPLATE_PATH' ) ) {
27
-			define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/' );
28
-			define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/' );
29
-			define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/' );
24
+	public function __construct($routing = true) {
25
+		parent::__construct($routing);
26
+		if ( ! defined('EVENTS_CAF_TEMPLATE_PATH')) {
27
+			define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/');
28
+			define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/');
29
+			define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/');
30 30
 		}
31 31
 	}
32 32
 
33 33
 
34 34
 
35 35
 	protected function _extend_page_config() {
36
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
36
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events';
37 37
 		//is there a evt_id in the request?
38
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] )
38
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
39 39
 			? $this->_req_data['EVT_ID']
40 40
 			: 0;
41
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
41
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
42 42
 		//tkt_id?
43
-		$tkt_id = ! empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] )
43
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
44 44
 			? $this->_req_data['TKT_ID']
45 45
 			: 0;
46 46
 		$new_page_routes = array(
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 				'capability' => 'ee_delete_default_ticket',
60 60
 				'obj_id'     => $tkt_id,
61 61
 				'noheader'   => true,
62
-				'args'       => array( 'trash' => true ),
62
+				'args'       => array('trash' => true),
63 63
 			),
64 64
 			'trash_tickets'            => array(
65 65
 				'func'       => '_trash_or_restore_ticket',
66 66
 				'capability' => 'ee_delete_default_tickets',
67 67
 				'noheader'   => true,
68
-				'args'       => array( 'trash' => true ),
68
+				'args'       => array('trash' => true),
69 69
 			),
70 70
 			'restore_ticket'           => array(
71 71
 				'func'       => '_trash_or_restore_ticket',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				'noheader'   => true,
125 125
 			),
126 126
 		);
127
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
127
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
128 128
 		//partial route/config override
129 129
 		$this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes;
130 130
 		$this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes';
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 		$this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
135 135
 		//add tickets tab but only if there are more than one default ticket!
136 136
 		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(
137
-			array( array( 'TKT_is_default' => 1 ) ),
137
+			array(array('TKT_is_default' => 1)),
138 138
 			'TKT_ID',
139 139
 			true
140 140
 		);
141
-		if ( $tkt_count > 1 ) {
141
+		if ($tkt_count > 1) {
142 142
 			$new_page_config = array(
143 143
 				'ticket_list_table' => array(
144 144
 					'nav'           => array(
145
-						'label' => esc_html__( 'Default Tickets', 'event_espresso' ),
145
+						'label' => esc_html__('Default Tickets', 'event_espresso'),
146 146
 						'order' => 60,
147 147
 					),
148 148
 					'list_table'    => 'Tickets_List_Table',
@@ -153,53 +153,53 @@  discard block
 block discarded – undo
153 153
 		//template settings
154 154
 		$new_page_config['template_settings'] = array(
155 155
 			'nav'           => array(
156
-				'label' => esc_html__( 'Templates', 'event_espresso' ),
156
+				'label' => esc_html__('Templates', 'event_espresso'),
157 157
 				'order' => 30,
158 158
 			),
159
-			'metaboxes'     => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
159
+			'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
160 160
 			'help_tabs'     => array(
161 161
 				'general_settings_templates_help_tab' => array(
162
-					'title'    => esc_html__( 'Templates', 'event_espresso' ),
162
+					'title'    => esc_html__('Templates', 'event_espresso'),
163 163
 					'filename' => 'general_settings_templates',
164 164
 				),
165 165
 			),
166
-			'help_tour'     => array( 'Templates_Help_Tour' ),
166
+			'help_tour'     => array('Templates_Help_Tour'),
167 167
 			'require_nonce' => false,
168 168
 		);
169
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
169
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
170 170
 		//add filters and actions
171 171
 		//modifying _views
172 172
 		add_filter(
173 173
 			'FHEE_event_datetime_metabox_add_additional_date_time_template',
174
-			array( $this, 'add_additional_datetime_button' ),
174
+			array($this, 'add_additional_datetime_button'),
175 175
 			10,
176 176
 			2
177 177
 		);
178 178
 		add_filter(
179 179
 			'FHEE_event_datetime_metabox_clone_button_template',
180
-			array( $this, 'add_datetime_clone_button' ),
180
+			array($this, 'add_datetime_clone_button'),
181 181
 			10,
182 182
 			2
183 183
 		);
184 184
 		add_filter(
185 185
 			'FHEE_event_datetime_metabox_timezones_template',
186
-			array( $this, 'datetime_timezones_template' ),
186
+			array($this, 'datetime_timezones_template'),
187 187
 			10,
188 188
 			2
189 189
 		);
190 190
 		//filters for event list table
191
-		add_filter( 'FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters' ), 10, 2 );
191
+		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2);
192 192
 		add_filter(
193 193
 			'FHEE__Events_Admin_List_Table__column_actions__action_links',
194
-			array( $this, 'extra_list_table_actions' ),
194
+			array($this, 'extra_list_table_actions'),
195 195
 			10,
196 196
 			2
197 197
 		);
198 198
 		//legend item
199
-		add_filter( 'FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items' ) );
200
-		add_action( 'admin_init', array( $this, 'admin_init' ) );
199
+		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items'));
200
+		add_action('admin_init', array($this, 'admin_init'));
201 201
 		//heartbeat stuff
202
-		add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 );
202
+		add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2);
203 203
 	}
204 204
 
205 205
 
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 					'Do you really want to delete this image? Please remember to update your event to complete the removal.',
216 216
 					'event_espresso'
217 217
 				),
218
-				'event_starts_on'        => esc_html__( 'Event Starts on', 'event_espresso' ),
219
-				'event_ends_on'          => esc_html__( 'Event Ends on', 'event_espresso' ),
220
-				'event_datetime_actions' => esc_html__( 'Actions', 'event_espresso' ),
221
-				'event_clone_dt_msg'     => esc_html__( 'Clone this Event Date and Time', 'event_espresso' ),
222
-				'remove_event_dt_msg'    => esc_html__( 'Remove this Event Time', 'event_espresso' ),
218
+				'event_starts_on'        => esc_html__('Event Starts on', 'event_espresso'),
219
+				'event_ends_on'          => esc_html__('Event Ends on', 'event_espresso'),
220
+				'event_datetime_actions' => esc_html__('Actions', 'event_espresso'),
221
+				'event_clone_dt_msg'     => esc_html__('Clone this Event Date and Time', 'event_espresso'),
222
+				'remove_event_dt_msg'    => esc_html__('Remove this Event Time', 'event_espresso'),
223 223
 			)
224 224
 		);
225 225
 	}
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	 * @param array $data     The incoming data package.
235 235
 	 * @return array  possibly appended response.
236 236
 	 */
237
-	public function heartbeat_response( $response, $data ) {
237
+	public function heartbeat_response($response, $data) {
238 238
 		/**
239 239
 		 * check whether count of tickets is approaching the potential
240 240
 		 * limits for the server.
241 241
 		 */
242
-		if ( ! empty( $data['input_count'] ) ) {
242
+		if ( ! empty($data['input_count'])) {
243 243
 			$response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check(
244 244
 				$data['input_count']
245 245
 			);
@@ -262,15 +262,15 @@  discard block
 block discarded – undo
262 262
 	 * @param string $new_slug
263 263
 	 * @return string
264 264
 	 */
265
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
266
-		$return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug );
265
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
266
+		$return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
267 267
 		//make sure this is only when editing
268
-		if ( ! empty( $id ) ) {
268
+		if ( ! empty($id)) {
269 269
 			$href = EE_Admin_Page::add_query_args_and_nonce(
270
-				array( 'action' => 'duplicate_event', 'EVT_ID' => $id ),
270
+				array('action' => 'duplicate_event', 'EVT_ID' => $id),
271 271
 				$this->_admin_base_url
272 272
 			);
273
-			$title = esc_attr__( 'Duplicate Event', 'event_espresso' );
273
+			$title = esc_attr__('Duplicate Event', 'event_espresso');
274 274
 			$return .= '<a href="'
275 275
 			           . $href
276 276
 			           . '" title="'
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 		$this->_views = array(
289 289
 			'all'     => array(
290 290
 				'slug'        => 'all',
291
-				'label'       => esc_html__( 'All', 'event_espresso' ),
291
+				'label'       => esc_html__('All', 'event_espresso'),
292 292
 				'count'       => 0,
293 293
 				'bulk_action' => array(
294
-					'trash_tickets' => esc_html__( 'Move to Trash', 'event_espresso' ),
294
+					'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'),
295 295
 				),
296 296
 			),
297 297
 			'trashed' => array(
298 298
 				'slug'        => 'trashed',
299
-				'label'       => esc_html__( 'Trash', 'event_espresso' ),
299
+				'label'       => esc_html__('Trash', 'event_espresso'),
300 300
 				'count'       => 0,
301 301
 				'bulk_action' => array(
302
-					'restore_tickets' => esc_html__( 'Restore from Trash', 'event_espresso' ),
303
-					'delete_tickets'  => esc_html__( 'Delete Permanently', 'event_espresso' ),
302
+					'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'),
303
+					'delete_tickets'  => esc_html__('Delete Permanently', 'event_espresso'),
304 304
 				),
305 305
 			),
306 306
 		);
@@ -311,19 +311,19 @@  discard block
 block discarded – undo
311 311
 	public function load_scripts_styles_edit() {
312 312
 		wp_register_script(
313 313
 			'ee-event-editor-heartbeat',
314
-			EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js',
315
-			array( 'ee_admin_js', 'heartbeat' ),
314
+			EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js',
315
+			array('ee_admin_js', 'heartbeat'),
316 316
 			EVENT_ESPRESSO_VERSION,
317 317
 			true
318 318
 		);
319 319
 		/**
320 320
 		 * load accounting js.
321 321
 		 */
322
-		add_filter( 'FHEE_load_accounting_js', '__return_true' );
322
+		add_filter('FHEE_load_accounting_js', '__return_true');
323 323
 		//styles
324
-		wp_enqueue_style( 'espresso-ui-theme' );
325
-		wp_enqueue_script( 'event_editor_js' );
326
-		wp_enqueue_script( 'ee-event-editor-heartbeat' );
324
+		wp_enqueue_style('espresso-ui-theme');
325
+		wp_enqueue_script('event_editor_js');
326
+		wp_enqueue_script('ee-event-editor-heartbeat');
327 327
 	}
328 328
 
329 329
 
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 	 * @param $template_args
334 334
 	 * @return mixed
335 335
 	 */
336
-	public function add_additional_datetime_button( $template, $template_args ) {
336
+	public function add_additional_datetime_button($template, $template_args) {
337 337
 		return EEH_Template::display_template(
338
-			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php',
338
+			EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php',
339 339
 			$template_args,
340 340
 			true
341 341
 		);
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	 * @param $template_args
349 349
 	 * @return mixed
350 350
 	 */
351
-	public function add_datetime_clone_button( $template, $template_args ) {
351
+	public function add_datetime_clone_button($template, $template_args) {
352 352
 		return EEH_Template::display_template(
353
-			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php',
353
+			EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php',
354 354
 			$template_args,
355 355
 			true
356 356
 		);
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 	 * @param $template_args
364 364
 	 * @return mixed
365 365
 	 */
366
-	public function datetime_timezones_template( $template, $template_args ) {
366
+	public function datetime_timezones_template($template, $template_args) {
367 367
 		return EEH_Template::display_template(
368
-			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php',
368
+			EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php',
369 369
 			$template_args,
370 370
 			true
371 371
 		);
@@ -378,22 +378,22 @@  discard block
 block discarded – undo
378 378
 		$new_views = array(
379 379
 			'today' => array(
380 380
 				'slug'        => 'today',
381
-				'label'       => esc_html__( 'Today', 'event_espresso' ),
381
+				'label'       => esc_html__('Today', 'event_espresso'),
382 382
 				'count'       => $this->total_events_today(),
383 383
 				'bulk_action' => array(
384
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
384
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
385 385
 				),
386 386
 			),
387 387
 			'month' => array(
388 388
 				'slug'        => 'month',
389
-				'label'       => esc_html__( 'This Month', 'event_espresso' ),
389
+				'label'       => esc_html__('This Month', 'event_espresso'),
390 390
 				'count'       => $this->total_events_this_month(),
391 391
 				'bulk_action' => array(
392
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
392
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
393 393
 				),
394 394
 			),
395 395
 		);
396
-		$this->_views = array_merge( $this->_views, $new_views );
396
+		$this->_views = array_merge($this->_views, $new_views);
397 397
 	}
398 398
 
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * @param \EE_Event $event
404 404
 	 * @return array
405 405
 	 */
406
-	public function extra_list_table_actions( array $action_links, \EE_Event $event ) {
406
+	public function extra_list_table_actions(array $action_links, \EE_Event $event) {
407 407
 		if (
408 408
 			EE_Registry::instance()->CAP->current_user_can(
409 409
 				'ee_read_registrations',
@@ -415,20 +415,20 @@  discard block
 block discarded – undo
415 415
 				'action' => 'reports',
416 416
 				'EVT_ID' => $event->ID(),
417 417
 			);
418
-			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
418
+			$reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
419 419
 			$action_links[] = '<a href="'
420 420
 			                  . $reports_link
421 421
 			                  . '" title="'
422
-			                  . esc_attr__( 'View Report', 'event_espresso' )
422
+			                  . esc_attr__('View Report', 'event_espresso')
423 423
 			                  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
424 424
 			                  . "\n\t";
425 425
 		}
426
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
427
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
426
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
427
+			EE_Registry::instance()->load_helper('MSG_Template');
428 428
 			$action_links[] = EEH_MSG_Template::get_message_action_link(
429 429
 				'see_notifications_for',
430 430
 				null,
431
-				array( 'EVT_ID' => $event->ID() )
431
+				array('EVT_ID' => $event->ID())
432 432
 			);
433 433
 		}
434 434
 		return $action_links;
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param $items
441 441
 	 * @return mixed
442 442
 	 */
443
-	public function additional_legend_items( $items ) {
443
+	public function additional_legend_items($items) {
444 444
 		if (
445 445
 			EE_Registry::instance()->CAP->current_user_can(
446 446
 				'ee_read_registrations',
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
 		) {
450 450
 			$items['reports'] = array(
451 451
 				'class' => 'dashicons dashicons-chart-bar',
452
-				'desc'  => esc_html__( 'Event Reports', 'event_espresso' ),
452
+				'desc'  => esc_html__('Event Reports', 'event_espresso'),
453 453
 			);
454 454
 		}
455
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
456
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
457
-			if ( isset( $related_for_icon['css_class'] ) && isset( $related_for_icon['label'] ) ) {
455
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
456
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
457
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
458 458
 				$items['view_related_messages'] = array(
459 459
 					'class' => $related_for_icon['css_class'],
460 460
 					'desc'  => $related_for_icon['label'],
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	protected function _duplicate_event() {
481 481
 		// first make sure the ID for the event is in the request.
482 482
 		//  If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?)
483
-		if ( ! isset( $this->_req_data['EVT_ID'] ) ) {
483
+		if ( ! isset($this->_req_data['EVT_ID'])) {
484 484
 			EE_Error::add_error(
485 485
 				esc_html__(
486 486
 					'In order to duplicate an event an Event ID is required.  None was given.',
@@ -490,15 +490,15 @@  discard block
 block discarded – undo
490 490
 				__FUNCTION__,
491 491
 				__LINE__
492 492
 			);
493
-			$this->_redirect_after_action( false, '', '', array(), true );
493
+			$this->_redirect_after_action(false, '', '', array(), true);
494 494
 			return;
495 495
 		}
496 496
 		//k we've got EVT_ID so let's use that to get the event we'll duplicate
497
-		$orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] );
498
-		if ( ! $orig_event instanceof EE_Event ) {
497
+		$orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
498
+		if ( ! $orig_event instanceof EE_Event) {
499 499
 			throw new EE_Error(
500 500
 				sprintf(
501
-					esc_html__( 'An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso' ),
501
+					esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'),
502 502
 					$this->_req_data['EVT_ID']
503 503
 				)
504 504
 			);
@@ -506,56 +506,56 @@  discard block
 block discarded – undo
506 506
 		//k now let's clone the $orig_event before getting relations
507 507
 		$new_event = clone $orig_event;
508 508
 		//original datetimes
509
-		$orig_datetimes = $orig_event->get_many_related( 'Datetime' );
509
+		$orig_datetimes = $orig_event->get_many_related('Datetime');
510 510
 		//other original relations
511
-		$orig_ven = $orig_event->get_many_related( 'Venue' );
511
+		$orig_ven = $orig_event->get_many_related('Venue');
512 512
 		//reset the ID and modify other details to make it clear this is a dupe
513
-		$new_event->set( 'EVT_ID', 0 );
514
-		$new_name = $new_event->name() . ' ' . esc_html__( '**DUPLICATE**', 'event_espresso' );
515
-		$new_event->set( 'EVT_name', $new_name );
513
+		$new_event->set('EVT_ID', 0);
514
+		$new_name = $new_event->name().' '.esc_html__('**DUPLICATE**', 'event_espresso');
515
+		$new_event->set('EVT_name', $new_name);
516 516
 		$new_event->set(
517 517
 			'EVT_slug',
518 518
 			wp_unique_post_slug(
519
-				sanitize_title( $orig_event->name() ),
519
+				sanitize_title($orig_event->name()),
520 520
 				0,
521 521
 				'publish',
522 522
 				'espresso_events',
523 523
 				0
524 524
 			)
525 525
 		);
526
-		$new_event->set( 'status', 'draft' );
526
+		$new_event->set('status', 'draft');
527 527
 		//duplicate discussion settings
528
-		$new_event->set( 'comment_status', $orig_event->get( 'comment_status' ) );
529
-		$new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) );
528
+		$new_event->set('comment_status', $orig_event->get('comment_status'));
529
+		$new_event->set('ping_status', $orig_event->get('ping_status'));
530 530
 		//save the new event
531 531
 		$new_event->save();
532 532
 		//venues
533
-		foreach ( $orig_ven as $ven ) {
534
-			$new_event->_add_relation_to( $ven, 'Venue' );
533
+		foreach ($orig_ven as $ven) {
534
+			$new_event->_add_relation_to($ven, 'Venue');
535 535
 		}
536 536
 		$new_event->save();
537 537
 		//now we need to get the question group relations and handle that
538 538
 		//first primary question groups
539 539
 		$orig_primary_qgs = $orig_event->get_many_related(
540 540
 			'Question_Group',
541
-			array( array( 'Event_Question_Group.EQG_primary' => 1 ) )
541
+			array(array('Event_Question_Group.EQG_primary' => 1))
542 542
 		);
543
-		if ( ! empty( $orig_primary_qgs ) ) {
544
-			foreach ( $orig_primary_qgs as $id => $obj ) {
545
-				if ( $obj instanceof EE_Question_Group ) {
546
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) );
543
+		if ( ! empty($orig_primary_qgs)) {
544
+			foreach ($orig_primary_qgs as $id => $obj) {
545
+				if ($obj instanceof EE_Question_Group) {
546
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1));
547 547
 				}
548 548
 			}
549 549
 		}
550 550
 		//next additional attendee question groups
551 551
 		$orig_additional_qgs = $orig_event->get_many_related(
552 552
 			'Question_Group',
553
-			array( array( 'Event_Question_Group.EQG_primary' => 0 ) )
553
+			array(array('Event_Question_Group.EQG_primary' => 0))
554 554
 		);
555
-		if ( ! empty( $orig_additional_qgs ) ) {
556
-			foreach ( $orig_additional_qgs as $id => $obj ) {
557
-				if ( $obj instanceof EE_Question_Group ) {
558
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) );
555
+		if ( ! empty($orig_additional_qgs)) {
556
+			foreach ($orig_additional_qgs as $id => $obj) {
557
+				if ($obj instanceof EE_Question_Group) {
558
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0));
559 559
 				}
560 560
 			}
561 561
 		}
@@ -563,70 +563,70 @@  discard block
 block discarded – undo
563 563
 		$new_event->save();
564 564
 		//k now that we have the new event saved we can loop through the datetimes and start adding relations.
565 565
 		$cloned_tickets = array();
566
-		foreach ( $orig_datetimes as $orig_dtt ) {
567
-			if ( ! $orig_dtt instanceof EE_Datetime ) {
566
+		foreach ($orig_datetimes as $orig_dtt) {
567
+			if ( ! $orig_dtt instanceof EE_Datetime) {
568 568
 				continue;
569 569
 			}
570 570
 			$new_dtt = clone $orig_dtt;
571 571
 			$orig_tkts = $orig_dtt->tickets();
572 572
 			//save new dtt then add to event
573
-			$new_dtt->set( 'DTT_ID', 0 );
574
-			$new_dtt->set( 'DTT_sold', 0 );
573
+			$new_dtt->set('DTT_ID', 0);
574
+			$new_dtt->set('DTT_sold', 0);
575 575
 			$new_dtt->save();
576
-			$new_event->_add_relation_to( $new_dtt, 'Datetime' );
576
+			$new_event->_add_relation_to($new_dtt, 'Datetime');
577 577
 			$new_event->save();
578 578
 			//now let's get the ticket relations setup.
579
-			foreach ( (array) $orig_tkts as $orig_tkt ) {
579
+			foreach ((array) $orig_tkts as $orig_tkt) {
580 580
 				//it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
581
-				if ( ! $orig_tkt instanceof EE_Ticket ) {
581
+				if ( ! $orig_tkt instanceof EE_Ticket) {
582 582
 					continue;
583 583
 				}
584 584
 				//is this ticket archived?  If it is then let's skip
585
-				if ( $orig_tkt->get( 'TKT_deleted' ) ) {
585
+				if ($orig_tkt->get('TKT_deleted')) {
586 586
 					continue;
587 587
 				}
588 588
 				// does this original ticket already exist in the clone_tickets cache?
589 589
 				//  If so we'll just use the new ticket from it.
590
-				if ( isset( $cloned_tickets[ $orig_tkt->ID() ] ) ) {
591
-					$new_tkt = $cloned_tickets[ $orig_tkt->ID() ];
590
+				if (isset($cloned_tickets[$orig_tkt->ID()])) {
591
+					$new_tkt = $cloned_tickets[$orig_tkt->ID()];
592 592
 				} else {
593 593
 					$new_tkt = clone $orig_tkt;
594 594
 					//get relations on the $orig_tkt that we need to setup.
595 595
 					$orig_prices = $orig_tkt->prices();
596
-					$new_tkt->set( 'TKT_ID', 0 );
597
-					$new_tkt->set( 'TKT_sold', 0 );
596
+					$new_tkt->set('TKT_ID', 0);
597
+					$new_tkt->set('TKT_sold', 0);
598 598
 					$new_tkt->save(); //make sure new ticket has ID.
599 599
 					//price relations on new ticket need to be setup.
600
-					foreach ( $orig_prices as $orig_price ) {
600
+					foreach ($orig_prices as $orig_price) {
601 601
 						$new_price = clone $orig_price;
602
-						$new_price->set( 'PRC_ID', 0 );
602
+						$new_price->set('PRC_ID', 0);
603 603
 						$new_price->save();
604
-						$new_tkt->_add_relation_to( $new_price, 'Price' );
604
+						$new_tkt->_add_relation_to($new_price, 'Price');
605 605
 						$new_tkt->save();
606 606
 					}
607 607
 				}
608 608
 				// k now we can add the new ticket as a relation to the new datetime
609 609
 				// and make sure its added to our cached $cloned_tickets array
610 610
 				// for use with later datetimes that have the same ticket.
611
-				$new_dtt->_add_relation_to( $new_tkt, 'Ticket' );
611
+				$new_dtt->_add_relation_to($new_tkt, 'Ticket');
612 612
 				$new_dtt->save();
613
-				$cloned_tickets[ $orig_tkt->ID() ] = $new_tkt;
613
+				$cloned_tickets[$orig_tkt->ID()] = $new_tkt;
614 614
 			}
615 615
 		}
616 616
 		//clone taxonomy information
617 617
 		$taxonomies_to_clone_with = apply_filters(
618 618
 			'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone',
619
-			array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' )
619
+			array('espresso_event_categories', 'espresso_event_type', 'post_tag')
620 620
 		);
621 621
 		//get terms for original event (notice)
622
-		$orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with );
622
+		$orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
623 623
 		//loop through terms and add them to new event.
624
-		foreach ( $orig_terms as $term ) {
625
-			wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true );
624
+		foreach ($orig_terms as $term) {
625
+			wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
626 626
 		}
627
-		do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event );
627
+		do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
628 628
 		//now let's redirect to the edit page for this duplicated event if we have a new event id.
629
-		if ( $new_event->ID() ) {
629
+		if ($new_event->ID()) {
630 630
 			$redirect_args = array(
631 631
 				'post'   => $new_event->ID(),
632 632
 				'action' => 'edit',
@@ -642,19 +642,19 @@  discard block
 block discarded – undo
642 642
 				'action' => 'default',
643 643
 			);
644 644
 			EE_Error::add_error(
645
-				esc_html__( 'Not able to duplicate event.  Something went wrong.', 'event_espresso' ),
645
+				esc_html__('Not able to duplicate event.  Something went wrong.', 'event_espresso'),
646 646
 				__FILE__,
647 647
 				__FUNCTION__,
648 648
 				__LINE__
649 649
 			);
650 650
 		}
651
-		$this->_redirect_after_action( false, '', '', $redirect_args, true );
651
+		$this->_redirect_after_action(false, '', '', $redirect_args, true);
652 652
 	}
653 653
 
654 654
 
655 655
 
656 656
 	protected function _import_page() {
657
-		$title = esc_html__( 'Import', 'event_espresso' );
657
+		$title = esc_html__('Import', 'event_espresso');
658 658
 		$intro = esc_html__(
659 659
 			'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ',
660 660
 			'event_espresso'
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
 		$form_url = EVENTS_ADMIN_URL;
663 663
 		$action = 'import_events';
664 664
 		$type = 'csv';
665
-		$this->_template_args['form'] = EE_Import::instance()->upload_form( $title, $intro, $form_url, $action, $type );
665
+		$this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type);
666 666
 		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(
667
-			array( 'action' => 'sample_export_file' ),
667
+			array('action' => 'sample_export_file'),
668 668
 			$this->_admin_base_url
669 669
 		);
670 670
 		$content = EEH_Template::display_template(
671
-			EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',
671
+			EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php',
672 672
 			$this->_template_args,
673 673
 			true
674 674
 		);
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 	 * @return void
686 686
 	 */
687 687
 	protected function _import_events() {
688
-		require_once( EE_CLASSES . 'EE_Import.class.php' );
688
+		require_once(EE_CLASSES.'EE_Import.class.php');
689 689
 		$success = EE_Import::instance()->import();
690
-		$this->_redirect_after_action( $success, 'Import File', 'ran', array( 'action' => 'import_page' ), true );
690
+		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true);
691 691
 	}
692 692
 
693 693
 
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 	 * @return void
701 701
 	 */
702 702
 	protected function _events_export() {
703
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
703
+		if (isset($this->_req_data['EVT_ID'])) {
704 704
 			$event_ids = $this->_req_data['EVT_ID'];
705
-		} elseif ( isset( $this->_req_data['EVT_IDs'] ) ) {
705
+		} elseif (isset($this->_req_data['EVT_IDs'])) {
706 706
 			$event_ids = $this->_req_data['EVT_IDs'];
707 707
 		} else {
708 708
 			$event_ids = null;
@@ -713,10 +713,10 @@  discard block
 block discarded – undo
713 713
 			'action' => 'all_event_data',
714 714
 			'EVT_ID' => $event_ids,
715 715
 		);
716
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
717
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php' ) ) {
718
-			require_once( EE_CLASSES . 'EE_Export.class.php' );
719
-			$EE_Export = EE_Export::instance( $this->_req_data );
716
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
717
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
718
+			require_once(EE_CLASSES.'EE_Export.class.php');
719
+			$EE_Export = EE_Export::instance($this->_req_data);
720 720
 			$EE_Export->export();
721 721
 		}
722 722
 	}
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 			'action'       => 'categories',
736 736
 			'category_ids' => $this->_req_data['EVT_CAT_ID'],
737 737
 		);
738
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
739
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php' ) ) {
740
-			require_once( EE_CLASSES . 'EE_Export.class.php' );
741
-			$EE_Export = EE_Export::instance( $this->_req_data );
738
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
739
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
740
+			require_once(EE_CLASSES.'EE_Export.class.php');
741
+			$EE_Export = EE_Export::instance($this->_req_data);
742 742
 			$EE_Export->export();
743 743
 		}
744 744
 	}
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
 			'FHEE__General_Settings_Admin_Page__template_settings__template_args',
767 767
 			$this->_template_args
768 768
 		);
769
-		$this->_set_add_edit_form_tags( 'update_template_settings' );
770
-		$this->_set_publish_post_box_vars( null, false, false, null, false );
769
+		$this->_set_add_edit_form_tags('update_template_settings');
770
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
771 771
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
772
-			EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php',
772
+			EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php',
773 773
 			$this->_template_args,
774 774
 			true
775 775
 		);
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
 		);
791 791
 		//update custom post type slugs and detect if we need to flush rewrite rules
792 792
 		$old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
793
-		EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] )
793
+		EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug'])
794 794
 			? EE_Registry::instance()->CFG->core->event_cpt_slug
795
-			: sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] );
795
+			: sanitize_title_with_dashes($this->_req_data['event_cpt_slug']);
796 796
 		$what = 'Template Settings';
797 797
 		$success = $this->_update_espresso_configuration(
798 798
 			$what,
@@ -801,10 +801,10 @@  discard block
 block discarded – undo
801 801
 			__FUNCTION__,
802 802
 			__LINE__
803 803
 		);
804
-		if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) {
805
-			update_option( 'ee_flush_rewrite_rules', true );
804
+		if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) {
805
+			update_option('ee_flush_rewrite_rules', true);
806 806
 		}
807
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) );
807
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings'));
808 808
 	}
809 809
 
810 810
 
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
 		$this->verify_cpt_object();
821 821
 		add_meta_box(
822 822
 			'espresso_event_editor_event_options',
823
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
824
-			array( $this, 'registration_options_meta_box' ),
823
+			esc_html__('Event Registration Options', 'event_espresso'),
824
+			array($this, 'registration_options_meta_box'),
825 825
 			$this->page_slug,
826 826
 			'side',
827 827
 			'core'
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 	 */
838 838
 	public function registration_options_meta_box() {
839 839
 		$yes_no_values = array(
840
-			array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ),
841
-			array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ),
840
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
841
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
842 842
 		);
843 843
 		$default_reg_status_values = EEM_Registration::reg_status_array(
844 844
 			array(
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 			),
850 850
 			true
851 851
 		);
852
-		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false );
852
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
853 853
 		$template_args['_event'] = $this->_cpt_model_obj;
854 854
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
855 855
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 			$default_reg_status_values
884 884
 		);
885 885
 		EEH_Template::display_template(
886
-			EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php',
886
+			EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php',
887 887
 			$template_args
888 888
 		);
889 889
 	}
@@ -901,20 +901,20 @@  discard block
 block discarded – undo
901 901
 	 * @param  array $list_table_obj the list table object
902 902
 	 * @return array                  new filters
903 903
 	 */
904
-	public function list_table_filters( $old_filters, $list_table_obj ) {
904
+	public function list_table_filters($old_filters, $list_table_obj) {
905 905
 		$filters = array();
906 906
 		//first month/year filters
907 907
 		$filters[] = $this->espresso_event_months_dropdown();
908
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
908
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
909 909
 		//active status dropdown
910
-		if ( $status !== 'draft' ) {
910
+		if ($status !== 'draft') {
911 911
 			$filter[] = $this->active_status_dropdown(
912
-				isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : ''
912
+				isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''
913 913
 			);
914 914
 		}
915 915
 		//category filter
916 916
 		$filters[] = $this->category_dropdown();
917
-		return array_merge( $old_filters, $filters );
917
+		return array_merge($old_filters, $filters);
918 918
 	}
919 919
 
920 920
 
@@ -928,15 +928,15 @@  discard block
 block discarded – undo
928 928
 	public function espresso_event_months_dropdown() {
929 929
 		// what we need to do is get all PRIMARY datetimes for all events to filter on.
930 930
 		// Note we need to include any other filters that are set!
931
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
931
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
932 932
 		//categories?
933
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0
933
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
934 934
 			? $this->_req_data['EVT_CAT']
935 935
 			: null;
936 936
 		//active status?
937
-		$active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : null;
938
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
939
-		return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status );
937
+		$active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null;
938
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
939
+		return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
940 940
 	}
941 941
 
942 942
 
@@ -947,18 +947,18 @@  discard block
 block discarded – undo
947 947
 	 * @param  string $current_value whatever the current active status is
948 948
 	 * @return string
949 949
 	 */
950
-	public function active_status_dropdown( $current_value = '' ) {
950
+	public function active_status_dropdown($current_value = '') {
951 951
 		$select_name = 'active_status';
952 952
 		$values = array(
953
-			'none'     => esc_html__( 'Show Active/Inactive', 'event_espresso' ),
954
-			'active'   => esc_html__( 'Active', 'event_espresso' ),
955
-			'upcoming' => esc_html__( 'Upcoming', 'event_espresso' ),
956
-			'expired'  => esc_html__( 'Expired', 'event_espresso' ),
957
-			'inactive' => esc_html__( 'Inactive', 'event_espresso' ),
953
+			'none'     => esc_html__('Show Active/Inactive', 'event_espresso'),
954
+			'active'   => esc_html__('Active', 'event_espresso'),
955
+			'upcoming' => esc_html__('Upcoming', 'event_espresso'),
956
+			'expired'  => esc_html__('Expired', 'event_espresso'),
957
+			'inactive' => esc_html__('Inactive', 'event_espresso'),
958 958
 		);
959 959
 		$id = 'id="espresso-active-status-dropdown-filter"';
960 960
 		$class = 'wide';
961
-		return EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class );
961
+		return EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class);
962 962
 	}
963 963
 
964 964
 
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 	 * @return string html
971 971
 	 */
972 972
 	public function category_dropdown() {
973
-		$cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
974
-		return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat );
973
+		$cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
974
+		return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
975 975
 	}
976 976
 
977 977
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
 	public function total_events_today() {
986 986
 		$start = EEM_Datetime::instance()->convert_datetime_for_query(
987 987
 			'DTT_EVT_start',
988
-			date( 'Y-m-d' ) . ' 00:00:00',
988
+			date('Y-m-d').' 00:00:00',
989 989
 			'Y-m-d H:i:s',
990 990
 			'UTC'
991 991
 		);
992 992
 		$end = EEM_Datetime::instance()->convert_datetime_for_query(
993 993
 			'DTT_EVT_start',
994
-			date( 'Y-m-d' ) . ' 23:59:59',
994
+			date('Y-m-d').' 23:59:59',
995 995
 			'Y-m-d H:i:s',
996 996
 			'UTC'
997 997
 		);
998 998
 		$where = array(
999
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array( $start, $end ) ),
999
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)),
1000 1000
 		);
1001
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1001
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1002 1002
 		return $count;
1003 1003
 	}
1004 1004
 
@@ -1012,25 +1012,25 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	public function total_events_this_month() {
1014 1014
 		//Dates
1015
-		$this_year_r = date( 'Y' );
1016
-		$this_month_r = date( 'm' );
1017
-		$days_this_month = date( 't' );
1015
+		$this_year_r = date('Y');
1016
+		$this_month_r = date('m');
1017
+		$days_this_month = date('t');
1018 1018
 		$start = EEM_Datetime::instance()->convert_datetime_for_query(
1019 1019
 			'DTT_EVT_start',
1020
-			$this_year_r . '-' . $this_month_r . '-01 00:00:00',
1020
+			$this_year_r.'-'.$this_month_r.'-01 00:00:00',
1021 1021
 			'Y-m-d H:i:s',
1022 1022
 			'UTC'
1023 1023
 		);
1024 1024
 		$end = EEM_Datetime::instance()->convert_datetime_for_query(
1025 1025
 			'DTT_EVT_start',
1026
-			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59',
1026
+			$this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59',
1027 1027
 			'Y-m-d H:i:s',
1028 1028
 			'UTC'
1029 1029
 		);
1030 1030
 		$where = array(
1031
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array( $start, $end ) ),
1031
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)),
1032 1032
 		);
1033
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1033
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1034 1034
 		return $count;
1035 1035
 	}
1036 1036
 
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 	/** DEFAULT TICKETS STUFF **/
1040 1040
 	public function _tickets_overview_list_table() {
1041
-		$this->_search_btn_label = esc_html__( 'Tickets', 'event_espresso' );
1041
+		$this->_search_btn_label = esc_html__('Tickets', 'event_espresso');
1042 1042
 		$this->display_admin_list_table_page_with_no_sidebar();
1043 1043
 	}
1044 1044
 
@@ -1050,46 +1050,46 @@  discard block
 block discarded – undo
1050 1050
 	 * @param bool $trashed
1051 1051
 	 * @return \EE_Soft_Delete_Base_Class[]|int
1052 1052
 	 */
1053
-	public function get_default_tickets( $per_page = 10, $count = false, $trashed = false ) {
1054
-		$orderby = empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby'];
1055
-		$order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order'];
1056
-		switch ( $orderby ) {
1053
+	public function get_default_tickets($per_page = 10, $count = false, $trashed = false) {
1054
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1055
+		$order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1056
+		switch ($orderby) {
1057 1057
 			case 'TKT_name' :
1058
-				$orderby = array( 'TKT_name' => $order );
1058
+				$orderby = array('TKT_name' => $order);
1059 1059
 				break;
1060 1060
 			case 'TKT_price' :
1061
-				$orderby = array( 'TKT_price' => $order );
1061
+				$orderby = array('TKT_price' => $order);
1062 1062
 				break;
1063 1063
 			case 'TKT_uses' :
1064
-				$orderby = array( 'TKT_uses' => $order );
1064
+				$orderby = array('TKT_uses' => $order);
1065 1065
 				break;
1066 1066
 			case 'TKT_min' :
1067
-				$orderby = array( 'TKT_min' => $order );
1067
+				$orderby = array('TKT_min' => $order);
1068 1068
 				break;
1069 1069
 			case 'TKT_max' :
1070
-				$orderby = array( 'TKT_max' => $order );
1070
+				$orderby = array('TKT_max' => $order);
1071 1071
 				break;
1072 1072
 			case 'TKT_qty' :
1073
-				$orderby = array( 'TKT_qty' => $order );
1073
+				$orderby = array('TKT_qty' => $order);
1074 1074
 				break;
1075 1075
 		}
1076
-		$current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] )
1076
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
1077 1077
 			? $this->_req_data['paged']
1078 1078
 			: 1;
1079
-		$per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] )
1079
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
1080 1080
 			? $this->_req_data['perpage']
1081 1081
 			: $per_page;
1082 1082
 		$_where = array(
1083 1083
 			'TKT_is_default' => 1,
1084 1084
 			'TKT_deleted'    => $trashed,
1085 1085
 		);
1086
-		$offset = ( $current_page - 1 ) * $per_page;
1087
-		$limit = array( $offset, $per_page );
1088
-		if ( isset( $this->_req_data['s'] ) ) {
1089
-			$sstr = '%' . $this->_req_data['s'] . '%';
1086
+		$offset = ($current_page - 1) * $per_page;
1087
+		$limit = array($offset, $per_page);
1088
+		if (isset($this->_req_data['s'])) {
1089
+			$sstr = '%'.$this->_req_data['s'].'%';
1090 1090
 			$_where['OR'] = array(
1091
-				'TKT_name'        => array( 'LIKE', $sstr ),
1092
-				'TKT_description' => array( 'LIKE', $sstr ),
1091
+				'TKT_name'        => array('LIKE', $sstr),
1092
+				'TKT_description' => array('LIKE', $sstr),
1093 1093
 			);
1094 1094
 		}
1095 1095
 		$query_params = array(
@@ -1098,10 +1098,10 @@  discard block
 block discarded – undo
1098 1098
 			'limit'    => $limit,
1099 1099
 			'group_by' => 'TKT_ID',
1100 1100
 		);
1101
-		if ( $count ) {
1102
-			return EEM_Ticket::instance()->count_deleted_and_undeleted( array( $_where ) );
1101
+		if ($count) {
1102
+			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
1103 1103
 		} else {
1104
-			return EEM_Ticket::instance()->get_all_deleted_and_undeleted( $query_params );
1104
+			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1105 1105
 		}
1106 1106
 	}
1107 1107
 
@@ -1110,34 +1110,34 @@  discard block
 block discarded – undo
1110 1110
 	/**
1111 1111
 	 * @param bool $trash
1112 1112
 	 */
1113
-	protected function _trash_or_restore_ticket( $trash = false ) {
1113
+	protected function _trash_or_restore_ticket($trash = false) {
1114 1114
 		$success = 1;
1115 1115
 		$TKT = EEM_Ticket::instance();
1116 1116
 		//checkboxes?
1117
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1117
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1118 1118
 			//if array has more than one element then success message should be plural
1119
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1119
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1120 1120
 			//cycle thru the boxes
1121
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1122
-				if ( $trash ) {
1123
-					if ( ! $TKT->delete_by_ID( $TKT_ID ) ) {
1121
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1122
+				if ($trash) {
1123
+					if ( ! $TKT->delete_by_ID($TKT_ID)) {
1124 1124
 						$success = 0;
1125 1125
 					}
1126 1126
 				} else {
1127
-					if ( ! $TKT->restore_by_ID( $TKT_ID ) ) {
1127
+					if ( ! $TKT->restore_by_ID($TKT_ID)) {
1128 1128
 						$success = 0;
1129 1129
 					}
1130 1130
 				}
1131 1131
 			}
1132 1132
 		} else {
1133 1133
 			//grab single id and trash
1134
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1135
-			if ( $trash ) {
1136
-				if ( ! $TKT->delete_by_ID( $TKT_ID ) ) {
1134
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1135
+			if ($trash) {
1136
+				if ( ! $TKT->delete_by_ID($TKT_ID)) {
1137 1137
 					$success = 0;
1138 1138
 				}
1139 1139
 			} else {
1140
-				if ( ! $TKT->restore_by_ID( $TKT_ID ) ) {
1140
+				if ( ! $TKT->restore_by_ID($TKT_ID)) {
1141 1141
 					$success = 0;
1142 1142
 				}
1143 1143
 			}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 			'action' => 'ticket_list_table',
1148 1148
 			'status' => $trash ? '' : 'trashed',
1149 1149
 		);
1150
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1150
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1151 1151
 	}
1152 1152
 
1153 1153
 
@@ -1155,20 +1155,20 @@  discard block
 block discarded – undo
1155 1155
 	protected function _delete_ticket() {
1156 1156
 		$success = 1;
1157 1157
 		//checkboxes?
1158
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1158
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1159 1159
 			//if array has more than one element then success message should be plural
1160
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1160
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1161 1161
 			//cycle thru the boxes
1162
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1162
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1163 1163
 				//delete
1164
-				if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1164
+				if ( ! $this->_delete_the_ticket($TKT_ID)) {
1165 1165
 					$success = 0;
1166 1166
 				}
1167 1167
 			}
1168 1168
 		} else {
1169 1169
 			//grab single id and trash
1170
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1171
-			if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1170
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1171
+			if ( ! $this->_delete_the_ticket($TKT_ID)) {
1172 1172
 				$success = 0;
1173 1173
 			}
1174 1174
 		}
@@ -1178,15 +1178,15 @@  discard block
 block discarded – undo
1178 1178
 			'status' => 'trashed',
1179 1179
 		);
1180 1180
 		//fail safe.  If the default ticket count === 1 then we need to redirect to event overview.
1181
-		if ( EEM_Ticket::instance()->count_deleted_and_undeleted(
1182
-			array( array( 'TKT_is_default' => 1 ) ),
1181
+		if (EEM_Ticket::instance()->count_deleted_and_undeleted(
1182
+			array(array('TKT_is_default' => 1)),
1183 1183
 			'TKT_ID',
1184 1184
 			true
1185 1185
 		)
1186 1186
 		) {
1187 1187
 			$query_args = array();
1188 1188
 		}
1189
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1189
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1190 1190
 	}
1191 1191
 
1192 1192
 
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
 	 * @param int $TKT_ID
1196 1196
 	 * @return bool|int
1197 1197
 	 */
1198
-	protected function _delete_the_ticket( $TKT_ID ) {
1199
-		$tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID );
1200
-		$tkt->_remove_relations( 'Datetime' );
1198
+	protected function _delete_the_ticket($TKT_ID) {
1199
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1200
+		$tkt->_remove_relations('Datetime');
1201 1201
 		//delete all related prices first
1202
-		$tkt->delete_related_permanently( 'Price' );
1202
+		$tkt->delete_related_permanently('Price');
1203 1203
 		return $tkt->delete_permanently();
1204 1204
 	}
1205 1205
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
54
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,103 +67,103 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.13.rc.000' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.13.rc.000');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
80
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
80
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
81 81
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
82
-	if ( ! defined( 'DS' ) ) {
83
-		define( 'DS', '/' );
82
+	if ( ! defined('DS')) {
83
+		define('DS', '/');
84 84
 	}
85
-	if ( ! defined( 'PS' ) ) {
86
-		define( 'PS', PATH_SEPARATOR );
85
+	if ( ! defined('PS')) {
86
+		define('PS', PATH_SEPARATOR);
87 87
 	}
88
-	if ( ! defined( 'SP' ) ) {
89
-		define( 'SP', ' ' );
88
+	if ( ! defined('SP')) {
89
+		define('SP', ' ');
90 90
 	}
91
-	if ( ! defined( 'EENL' ) ) {
92
-		define( 'EENL', "\n" );
91
+	if ( ! defined('EENL')) {
92
+		define('EENL', "\n");
93 93
 	}
94
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
94
+	define('EE_SUPPORT_EMAIL', '[email protected]');
95 95
 	// define the plugin directory and URL
96
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
98
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
96
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
98
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
99 99
 	// main root folder paths
100
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
101
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
102
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
103
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
104
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
105
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
106
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
107
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
100
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
101
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
102
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
103
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
104
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
105
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
106
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
107
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
108 108
 	// core system paths
109
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
110
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
111
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
112
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
113
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
114
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
115
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
116
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
117
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
118
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
119
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
120
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
109
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
110
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
111
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
112
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
113
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
114
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
115
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
116
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
117
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
118
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
119
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
120
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
121 121
 	// gateways
122
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
123
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
122
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
123
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
124 124
 	// asset URL paths
125
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
126
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
127
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
128
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
129
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
130
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
125
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
126
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
127
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
128
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
129
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
130
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
131 131
 	// define upload paths
132 132
 	$uploads = wp_upload_dir();
133 133
 	// define the uploads directory and URL
134
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
135
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
134
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
135
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
136 136
 	// define the templates directory and URL
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
138
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
137
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
138
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
139 139
 	// define the gateway directory and URL
140
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
141
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
141
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
142 142
 	// languages folder/path
143
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
144
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
143
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
144
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
145 145
 	//check for dompdf fonts in uploads
146
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
147
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
146
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
147
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
148 148
 	}
149 149
 	//ajax constants
150
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
151
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
150
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
151
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
152 152
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
153 153
 	//you're better to use this than its straight value (currently -1) in case you ever
154 154
 	//want to change its default value! or find when -1 means infinity
155
-	define( 'EE_INF_IN_DB', -1 );
156
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
157
-	define( 'EE_DEBUG', false );
155
+	define('EE_INF_IN_DB', -1);
156
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
157
+	define('EE_DEBUG', false);
158 158
 
159 159
 	/**
160 160
 	 *    espresso_plugin_activation
161 161
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
162 162
 	 */
163 163
 	function espresso_plugin_activation() {
164
-		update_option( 'ee_espresso_activation', true );
164
+		update_option('ee_espresso_activation', true);
165 165
 	}
166
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
166
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
167 167
 
168 168
 
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		//	}
178 178
 		//
179 179
 	}
180
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
180
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
181 181
 
182 182
 
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function espresso_load_error_handling() {
189 189
 		// load debugging tools
190
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
191
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
190
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
191
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
192 192
 			EEH_Debug_Tools::instance();
193 193
 		}
194 194
 		// load error handling
195
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
196
-			require_once( EE_CORE . 'EE_Error.core.php' );
195
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
196
+			require_once(EE_CORE.'EE_Error.core.php');
197 197
 		} else {
198
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
198
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
199 199
 		}
200 200
 	}
201 201
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 	 * @param    string $full_path_to_file
210 210
 	 * @throws    EE_Error
211 211
 	 */
212
-	function espresso_load_required( $classname, $full_path_to_file ) {
212
+	function espresso_load_required($classname, $full_path_to_file) {
213 213
 		static $error_handling_loaded = false;
214
-		if ( ! $error_handling_loaded ) {
214
+		if ( ! $error_handling_loaded) {
215 215
 			espresso_load_error_handling();
216 216
 			$error_handling_loaded = true;
217 217
 		}
218
-		if ( is_readable( $full_path_to_file ) ) {
219
-			require_once( $full_path_to_file );
218
+		if (is_readable($full_path_to_file)) {
219
+			require_once($full_path_to_file);
220 220
 		} else {
221
-			throw new EE_Error ( sprintf(
222
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
221
+			throw new EE_Error(sprintf(
222
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
223 223
 				$classname
224
-			) );
224
+			));
225 225
 		}
226 226
 	}
227 227
 
228
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
229
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
230
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
228
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
229
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
230
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
231 231
 	new EE_Bootstrap();
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 
238 238
 
239
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
239
+if ( ! function_exists('espresso_deactivate_plugin')) {
240 240
 	/**
241 241
 	*    deactivate_plugin
242 242
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
246 246
 	* @return    void
247 247
 	*/
248
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
249
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
250
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
248
+	function espresso_deactivate_plugin($plugin_basename = '') {
249
+		if ( ! function_exists('deactivate_plugins')) {
250
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
251 251
 		}
252
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
252
+		unset($_GET['activate'], $_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +580 added lines, -580 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					'order' => 15,
451 451
 					'url' => isset($this->_req_data['_REG_ID'])
452 452
 						? add_query_arg(
453
-							array('_REG_ID' => $this->_req_data['_REG_ID'] ),
453
+							array('_REG_ID' => $this->_req_data['_REG_ID']),
454 454
 							$this->_current_page_view_url
455 455
 						)
456 456
 						: $this->_admin_base_url,
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 						'filename' => 'registrations_details_registrant_details'
475 475
 					)
476 476
 				),
477
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
478
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
477
+				'help_tour' => array('Registration_Details_Help_Tour'),
478
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
479 479
 				'require_nonce' => FALSE
480 480
 			),
481 481
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 					'order' => 15,
500 500
 					'persistent' => FALSE
501 501
 				),
502
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
502
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
503 503
 				'require_nonce' => FALSE
504 504
 			),
505 505
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 					'label' => __('Edit Contact', 'event_espresso'),
509 509
 					'order' => 15,
510 510
 					'persistent' => FALSE,
511
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
511
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
512 512
 				),
513 513
 				'metaboxes' => array('attendee_editor_metaboxes'),
514 514
 				'require_nonce' => FALSE
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540 540
                 ),
541
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
541
+				'help_tour' => array('Contact_List_Help_Tour'),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
544 544
 			),
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	protected function _add_screen_options() {}
558 558
 	protected function _add_feature_pointers() {}
559 559
 	public function admin_init() {
560
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
560
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
561 561
 	}
562 562
 	public function admin_notices() {}
563 563
 	public function admin_footer_scripts() {}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	*		@return void
576 576
 	*/
577 577
 	private function _get_registration_status_array() {
578
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
578
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 	public function load_scripts_styles() {
599 599
 		//style
600 600
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
601
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
601
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
602 602
 		wp_enqueue_style('espresso_reg');
603 603
 
604 604
 		//script
605
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
605
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
606 606
 		wp_enqueue_script('espresso_reg');
607 607
 	}
608 608
 
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	public function load_scripts_styles_edit_attendee() {
612 612
 		//stuff to only show up on our attendee edit details page.
613 613
 		$attendee_details_translations = array(
614
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
614
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
615 615
 			);
616
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
616
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
617 617
 		wp_enqueue_script('jquery-validate');
618 618
 	}
619 619
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 		//styles
623 623
 		wp_enqueue_style('espresso-ui-theme');
624 624
 		//scripts
625
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
626
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
625
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
626
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 	public function load_scripts_styles_contact_list() {
635 635
 		wp_deregister_style('espresso_reg');
636
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
636
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
637 637
 		wp_enqueue_style('espresso_att');
638 638
 	}
639 639
 
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 
643 643
 
644 644
 	public function load_scripts_styles_new_registration() {
645
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
645
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
646 646
 		wp_enqueue_script('ee-spco-for-admin');
647
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
647
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
648 648
 		EE_Form_Section_Proper::wp_enqueue_scripts();
649 649
 		EED_Ticket_Selector::load_tckt_slctr_assets();
650 650
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		//for notification related bulk actions we need to make sure only active messengers have an option.
672 672
 		EED_Messages::set_autoloaders();
673 673
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
674
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
674
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
675 675
 		$active_mts = $message_resource_manager->list_of_active_message_types();
676 676
 		//key= bulk_action_slug, value= message type.
677 677
 		$match_array = array(
@@ -684,23 +684,23 @@  discard block
 block discarded – undo
684 684
 
685 685
 		/** setup reg status bulk actions **/
686 686
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
687
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
687
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
688 688
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
689 689
 		}
690 690
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
691
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
691
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
692 692
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
693 693
 		}
694 694
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
695
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
695
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
696 696
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
697 697
 		}
698 698
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
699
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
699
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
700 700
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
701 701
 		}
702 702
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
703
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
703
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
704 704
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
705 705
 		}
706 706
 
@@ -709,29 +709,29 @@  discard block
 block discarded – undo
709 709
 				'slug' => 'all',
710 710
 				'label' => __('View All Registrations', 'event_espresso'),
711 711
 				'count' => 0,
712
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
712
+				'bulk_action' => array_merge($def_reg_status_actions, array(
713 713
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
714
-					) )
714
+					))
715 715
 				),
716 716
 			'month' => array(
717 717
 				'slug' => 'month',
718 718
 				'label' => __('This Month', 'event_espresso'),
719 719
 				'count' => 0,
720
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
720
+				'bulk_action' => array_merge($def_reg_status_actions, array(
721 721
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
722 722
 					))
723 723
 				),
724 724
 			'today' => array(
725 725
 				'slug' => 'today',
726
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
726
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
727 727
 				'count' => 0,
728
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
728
+				'bulk_action' => array_merge($def_reg_status_actions, array(
729 729
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
730 730
 					))
731 731
 				)
732 732
 			);
733 733
 
734
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
734
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
735 735
 			$this->_views['incomplete'] = array(
736 736
 				'slug' => 'incomplete',
737 737
 				'label' => __('Incomplete', 'event_espresso'),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				)
768 768
 			);
769 769
 
770
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
770
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
771 771
 			$this->_views['trash'] = array(
772 772
 				'slug' => 'trash',
773 773
 				'label' => __('Trash', 'event_espresso'),
@@ -806,18 +806,18 @@  discard block
 block discarded – undo
806 806
 				'desc' => __('View Transaction Invoice', 'event_espresso')
807 807
 				),
808 808
  			);
809
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
809
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
810 810
 			$fc_items['resend_registration'] = array(
811 811
 				'class' => 'dashicons dashicons-email-alt',
812 812
 				'desc' => __('Resend Registration Details', 'event_espresso')
813 813
 				);
814 814
 		} else {
815
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
815
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
816 816
 		}
817 817
 
818
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
819
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
820
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
818
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
819
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
820
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
821 821
 				$fc_items['view_related_messages'] = array(
822 822
 					'class' => $related_for_icon['css_class'],
823 823
 					'desc' => $related_for_icon['label'],
@@ -827,35 +827,35 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$sc_items = array(
829 829
 			'approved_status' => array(
830
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
831
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
830
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
831
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
832 832
 				),
833 833
 			'pending_status' => array(
834
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
835
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
834
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
835
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
836 836
 				),
837 837
 			'wait_list' => array(
838
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
839
-				'desc'  => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' )
838
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
839
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence')
840 840
 			),
841 841
 			'incomplete_status' => array(
842
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
843
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
842
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
843
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
844 844
 			),
845 845
 			'not_approved' => array(
846
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
847
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
846
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
847
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
848 848
 				),
849 849
 			'declined_status' => array(
850
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
851
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
850
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
851
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
852 852
 				),
853 853
 			'cancelled_status' => array(
854
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
855
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
854
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
855
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
856 856
 				)
857 857
 			);
858
-		return array_merge( $fc_items, $sc_items );
858
+		return array_merge($fc_items, $sc_items);
859 859
 	}
860 860
 
861 861
 
@@ -869,45 +869,45 @@  discard block
 block discarded – undo
869 869
 	 */
870 870
 	protected function _registrations_overview_list_table() {
871 871
 		$this->_template_args['admin_page_header'] = '';
872
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
873
-		if ( $EVT_ID ) {
874
-			if ( EE_Registry::instance()->CAP->current_user_can(
872
+		$EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0;
873
+		if ($EVT_ID) {
874
+			if (EE_Registry::instance()->CAP->current_user_can(
875 875
 				'ee_edit_registrations',
876 876
 				'espresso_registrations_new_registration',
877 877
 				$EVT_ID
878 878
 				)
879 879
 			) {
880
-				$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
880
+				$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
881 881
 					'new_registration',
882 882
 					'add-registrant',
883
-					array( 'event_id' => $EVT_ID ),
883
+					array('event_id' => $EVT_ID),
884 884
 					'add-new-h2'
885 885
 				);
886 886
 			}
887
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
888
-			if ( $event instanceof EE_Event ) {
887
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
888
+			if ($event instanceof EE_Event) {
889 889
 				$this->_template_args['admin_page_header'] = sprintf(
890
-					__( '%s Viewing registrations for the event: %s%s', 'event_espresso' ),
890
+					__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
891 891
 					'<h3 style="line-height:1.5em;">',
892
-					'<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce(
893
-						array( 'action' => 'edit', 'post' => $event->ID() ),
892
+					'<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce(
893
+						array('action' => 'edit', 'post' => $event->ID()),
894 894
 						EVENTS_ADMIN_URL
895
-					) . '">&nbsp;' . $event->get( 'EVT_name' ) . '&nbsp;</a>&nbsp;',
895
+					).'">&nbsp;'.$event->get('EVT_name').'&nbsp;</a>&nbsp;',
896 896
 					'</h3>'
897 897
 				);
898 898
 			}
899
-			$DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0;
900
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID );
901
-			if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) {
902
-				$this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 );
899
+			$DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0;
900
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
901
+			if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') {
902
+				$this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5);
903 903
 				$this->_template_args['admin_page_header'] .= ' &nbsp;<span class="drk-grey-text">';
904 904
 				$this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>';
905 905
 				$this->_template_args['admin_page_header'] .= $datetime->name();
906
-				$this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )';
906
+				$this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )';
907 907
 				$this->_template_args['admin_page_header'] .= '</span></h3>';
908 908
 			}
909 909
 		}
910
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
910
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
911 911
 		$this->display_admin_list_table_page_with_no_sidebar();
912 912
 	}
913 913
 
@@ -922,19 +922,19 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	private function _set_registration_object() {
924 924
 		//get out if we've already set the object
925
-		if ( is_object( $this->_registration )) {
925
+		if (is_object($this->_registration)) {
926 926
 			return TRUE;
927 927
 		}
928 928
 
929 929
 	    $REG = EEM_Registration::instance();
930 930
 
931
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
931
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
932 932
 
933
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
933
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
934 934
 			return TRUE;
935 935
 		else {
936
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
937
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
936
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
937
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
938 938
 			$this->_registration = NULL;
939 939
 			return FALSE;
940 940
 		}
@@ -952,25 +952,25 @@  discard block
 block discarded – undo
952 952
 	 * @throws \EE_Error
953 953
 	 * @return mixed (int|array)  int = count || array of registration objects
954 954
 	 */
955
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
956
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
957
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
958
-		$DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null;
959
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
960
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
961
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
955
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
956
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
957
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
958
+		$DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null;
959
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
960
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
961
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
963 963
 		$start_date = FALSE;
964 964
 		$end_date = FALSE;
965 965
 		$_where = array();
966
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
966
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
968 968
 
969 969
 		//set orderby
970 970
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
971 971
 
972 972
 
973
-		switch ( $this->_req_data['orderby'] ) {
973
+		switch ($this->_req_data['orderby']) {
974 974
 			case '_REG_ID':
975 975
 				$orderby = 'REG_ID';
976 976
 				break;
@@ -990,30 +990,30 @@  discard block
 block discarded – undo
990 990
 				$orderby = 'REG_date';
991 991
 		}
992 992
 
993
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
994
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
995
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
993
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
994
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
995
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
996 996
 
997 997
 
998
-		$offset = ($current_page-1)*$per_page;
999
-		$limit = $count  ? NULL : array( $offset, $per_page );
998
+		$offset = ($current_page - 1) * $per_page;
999
+		$limit = $count ? NULL : array($offset, $per_page);
1000 1000
 
1001
-		if($EVT_ID){
1002
-			$_where['EVT_ID']=$EVT_ID;
1001
+		if ($EVT_ID) {
1002
+			$_where['EVT_ID'] = $EVT_ID;
1003 1003
 		}
1004
-		if($CAT_ID){
1004
+		if ($CAT_ID) {
1005 1005
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
1006 1006
 		}
1007 1007
 		//if DTT is included we filter by that datetime.
1008
-		if ( $DTT_ID ) {
1008
+		if ($DTT_ID) {
1009 1009
 			$_where['Ticket.Datetime.DTT_ID'] = $DTT_ID;
1010 1010
 		}
1011
-		if ( $incomplete ) {
1011
+		if ($incomplete) {
1012 1012
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
1013 1013
 		} else if ( ! $trash) {
1014
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
1014
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
1015 1015
 		}
1016
-		if($reg_status){
1016
+		if ($reg_status) {
1017 1017
 			$_where['STS_ID'] = $reg_status;
1018 1018
 		}
1019 1019
 
@@ -1025,103 +1025,103 @@  discard block
 block discarded – undo
1025 1025
 		$time_start = ' 00:00:00';
1026 1026
 		$time_end = ' 23:59:59';
1027 1027
 
1028
-		if($today_a || $today ){
1028
+		if ($today_a || $today) {
1029 1029
 			$curdate = date('Y-m-d', current_time('timestamp'));
1030
-			$_where['REG_date']= array('BETWEEN',
1030
+			$_where['REG_date'] = array('BETWEEN',
1031 1031
 				array(
1032
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
1033
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
1032
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
1033
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
1034 1034
 			));
1035
-		}elseif($this_month_a || $this_month){
1035
+		}elseif ($this_month_a || $this_month) {
1036 1036
 			$this_month_r = date('m', current_time('timestamp'));
1037
-			$days_this_month = date( 't', current_time('timestamp') );
1038
-			$_where['REG_date']= array('BETWEEN',
1037
+			$days_this_month = date('t', current_time('timestamp'));
1038
+			$_where['REG_date'] = array('BETWEEN',
1039 1039
 				array(
1040
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1041
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
1040
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1041
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
1042 1042
 			));
1043
-		}elseif($month_range){
1043
+		}elseif ($month_range) {
1044 1044
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1045
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1046
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1047
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1048
-			$_where['REG_date']= array('BETWEEN',
1049
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1050
-		}elseif($start_date && $end_date){
1045
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1046
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1047
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1048
+			$_where['REG_date'] = array('BETWEEN',
1049
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1050
+		}elseif ($start_date && $end_date) {
1051 1051
 			throw new EE_Error("not yet supported");
1052
-		}elseif($start_date){
1052
+		}elseif ($start_date) {
1053 1053
 			throw new EE_Error("not yet supported");
1054
-		}elseif($end_date){
1054
+		}elseif ($end_date) {
1055 1055
 			throw new EE_Error("not yet supported");
1056 1056
 		}
1057 1057
 
1058
-		if ( ! empty( $this->_req_data['s'] ) ) {
1059
-			$sstr = '%' . $this->_req_data['s'] . '%';
1058
+		if ( ! empty($this->_req_data['s'])) {
1059
+			$sstr = '%'.$this->_req_data['s'].'%';
1060 1060
 			$_where['OR'] = array(
1061
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1062
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1063
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1064
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1065
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1066
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1067
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1068
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1069
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1070
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1071
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1072
-				'REG_final_price' => array( 'LIKE', $sstr ),
1073
-				'REG_code' => array( 'LIKE', $sstr ),
1074
-				'REG_count' => array( 'LIKE' , $sstr ),
1075
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1076
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1077
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1078
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1061
+				'Event.EVT_name' => array('LIKE', $sstr),
1062
+				'Event.EVT_desc' => array('LIKE', $sstr),
1063
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1064
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1065
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1066
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1067
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1068
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1069
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1070
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1071
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1072
+				'REG_final_price' => array('LIKE', $sstr),
1073
+				'REG_code' => array('LIKE', $sstr),
1074
+				'REG_count' => array('LIKE', $sstr),
1075
+				'REG_group_size' => array('LIKE', $sstr),
1076
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1077
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1078
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1079 1079
 			);
1080 1080
 		}
1081 1081
 
1082 1082
 		//capability checks
1083
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1083
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1084 1084
 			$_where['AND'] = array(
1085 1085
 				'Event.EVT_wp_user' => get_current_user_id()
1086 1086
 				);
1087 1087
 		}
1088 1088
 
1089
-		if( $count ){
1090
-			if ( $trash ) {
1091
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1092
-			} else if ( $incomplete ) {
1093
-				return EEM_Registration::instance()->count( array( $_where ));
1089
+		if ($count) {
1090
+			if ($trash) {
1091
+				return EEM_Registration::instance()->count_deleted(array($_where));
1092
+			} else if ($incomplete) {
1093
+				return EEM_Registration::instance()->count(array($_where));
1094 1094
 			} else {
1095
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1095
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1096 1096
 			}
1097 1097
 		} else {
1098 1098
 			//make sure we remove default where conditions cause all registrations matching query are returned
1099
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1100
-			if ( $per_page !== -1 ) {
1099
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1100
+			if ($per_page !== -1) {
1101 1101
 				$query_params['limit'] = $limit;
1102 1102
 			}
1103
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1103
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1104 1104
 
1105
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1105
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1106 1106
 				$first_registration = $registrations[0];
1107 1107
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1108 1108
 				$event_name = $first_registration->event_obj()->name();
1109
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1109
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1110 1110
 				// edit event link
1111
-				if ( $event_name != '' ) {
1112
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1113
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1114
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1111
+				if ($event_name != '') {
1112
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1113
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1114
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1115 1115
 				}
1116 1116
 
1117
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1118
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1117
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1118
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1119 1119
 
1120 1120
 				$this->_template_args['before_admin_page_content'] = '
1121 1121
 			<div id="admin-page-header">
1122
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1123
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1124
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1122
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1123
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1124
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1125 1125
 			</div>
1126 1126
 			';
1127 1127
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		$this->_set_registration_object();
1161 1161
 
1162
-		if ( is_object( $this->_registration )) {
1162
+		if (is_object($this->_registration)) {
1163 1163
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1164 1164
 			$this->_session = $transaction->session_data();
1165 1165
 
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 
1169 1169
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1170
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1170
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1171 1171
 
1172
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1173
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1172
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1173
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1174 1174
 
1175 1175
 			$this->_template_args['grand_total'] = $transaction->total();
1176 1176
 
@@ -1178,19 +1178,19 @@  discard block
 block discarded – undo
1178 1178
 			// link back to overview
1179 1179
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1180 1180
 			$this->_template_args['registration'] = $this->_registration;
1181
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1182
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1183
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1181
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1182
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1183
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1184 1184
 
1185 1185
 			//next and previous links
1186
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1187
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1188
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1189
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1186
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1187
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1188
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1189
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1190 1190
 
1191 1191
 			// grab header
1192
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1193
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1192
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1193
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1194 1194
 
1195 1195
 		} else {
1196 1196
 
@@ -1209,17 +1209,17 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 
1211 1211
 	protected function _registration_details_metaboxes() {
1212
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1212
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1213 1213
 		$this->_set_registration_object();
1214 1214
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1215
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1216
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1217
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1218
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1215
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1216
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1217
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1218
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1219 1219
 		}
1220
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1221
-		if ( $this->_registration->group_size() > 1 ) {
1222
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1220
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1221
+		if ($this->_registration->group_size() > 1) {
1222
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1223 1223
 		}
1224 1224
 	}
1225 1225
 
@@ -1261,25 +1261,25 @@  discard block
 block discarded – undo
1261 1261
 				'html_id'         => 'reg-status-change-form',
1262 1262
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1263 1263
 				'subsections'     => array(
1264
-					'return' => new EE_Hidden_Input( array(
1264
+					'return' => new EE_Hidden_Input(array(
1265 1265
 						'name'    => 'return',
1266 1266
 						'default' => 'view_registration'
1267
-					) ),
1268
-					'REG_ID' => new EE_Hidden_Input( array(
1267
+					)),
1268
+					'REG_ID' => new EE_Hidden_Input(array(
1269 1269
 						'name'    => 'REG_ID',
1270 1270
 						'default' => $this->_registration->ID()
1271
-					) ),
1271
+					)),
1272 1272
 					'current_status' => new EE_Form_Section_HTML(
1273 1273
 						EEH_HTML::tr(
1274 1274
 							EEH_HTML::th(
1275 1275
 								EEH_HTML::label(
1276
-									EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) )
1276
+									EEH_HTML::strong(__('Current Registration Status', 'event_espresso'))
1277 1277
 								)
1278
-							) .
1278
+							).
1279 1279
 							EEH_HTML::td(
1280 1280
 								EEH_HTML::strong(
1281 1281
 									$this->_registration->pretty_status(),
1282
-									'', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1282
+									'', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1283 1283
 								)
1284 1284
 							)
1285 1285
 						)
@@ -1287,22 +1287,22 @@  discard block
 block discarded – undo
1287 1287
 					'reg_status' => new EE_Select_Input(
1288 1288
 						$this->_get_reg_statuses(),
1289 1289
 						array(
1290
-							'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ),
1290
+							'html_label_text' => __('Change Registration Status to', 'event_espresso'),
1291 1291
 							'default'         => $this->_registration->status_ID(),
1292 1292
 						)
1293 1293
 					),
1294 1294
 					'send_notifications' => new EE_Yes_No_Input(
1295 1295
 						array(
1296
-							'html_label_text' => __( 'Send Related Messages', 'event_espresso' ),
1296
+							'html_label_text' => __('Send Related Messages', 'event_espresso'),
1297 1297
 							'default'         => false,
1298
-							'html_help_text'  => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ),
1298
+							'html_help_text'  => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'),
1299 1299
 						)
1300 1300
 					),
1301
-					'submit' => new EE_Submit_Input( array(
1301
+					'submit' => new EE_Submit_Input(array(
1302 1302
 						'html_class'      => 'button-primary',
1303 1303
 						'html_label_text' => '&nbsp;',
1304
-						'default'         => __( 'Update Registration Status', 'event_espresso' )
1305
-					) ),
1304
+						'default'         => __('Update Registration Status', 'event_espresso')
1305
+					)),
1306 1306
 				),
1307 1307
 			)
1308 1308
 		);
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 	 * Returns an array of all the buttons for the various statuses and switch status actions
1316 1316
 	 * @return string
1317 1317
 	 */
1318
-	protected function _get_current_reg_status_help_text( $STS_ID = '' ) {
1318
+	protected function _get_current_reg_status_help_text($STS_ID = '') {
1319 1319
 		//$reg_status_help_text = array(
1320 1320
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
1321 1321
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
@@ -1348,14 +1348,14 @@  discard block
 block discarded – undo
1348 1348
 	 */
1349 1349
 	protected function _get_reg_statuses() {
1350 1350
 		$reg_status_array = EEM_Registration::instance()->reg_status_array();
1351
-		unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] );
1351
+		unset ($reg_status_array[EEM_Registration::status_id_incomplete]);
1352 1352
 		// get current reg status
1353 1353
 		$current_status = $this->_registration->status_ID();
1354 1354
 		// is registration for free event? This will determine whether to display the pending payment option
1355
-		if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) {
1356
-			unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] );
1355
+		if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) {
1356
+			unset($reg_status_array[EEM_Registration::status_id_pending_payment]);
1357 1357
 		}
1358
-		return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' );
1358
+		return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence');
1359 1359
 	}
1360 1360
 
1361 1361
 
@@ -1368,15 +1368,15 @@  discard block
 block discarded – undo
1368 1368
 	 *
1369 1369
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1370 1370
 	 */
1371
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1372
-		if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) {
1373
-			$REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] )
1374
-				? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ]
1371
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1372
+		if (isset($this->_req_data['reg_status_change_form'])) {
1373
+			$REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID'])
1374
+				? (array) $this->_req_data['reg_status_change_form']['REG_ID']
1375 1375
 				: array();
1376 1376
 		} else {
1377
-			$REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array();
1377
+			$REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1378 1378
 		}
1379
-		$success = $this->_set_registration_status( $REG_IDs, $status );
1379
+		$success = $this->_set_registration_status($REG_IDs, $status);
1380 1380
 		//notify?
1381 1381
 		if (
1382 1382
 			$success
@@ -1403,21 +1403,21 @@  discard block
 block discarded – undo
1403 1403
 	 * @param bool $status
1404 1404
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1405 1405
 	 */
1406
-	protected function _set_registration_status( $REG_IDs = array(), $status = false ) {
1406
+	protected function _set_registration_status($REG_IDs = array(), $status = false) {
1407 1407
 		$success = false;
1408 1408
 		// typecast $REG_IDs
1409
-		$REG_IDs = (array)$REG_IDs;
1410
-		if ( ! empty( $REG_IDs ) ) {
1409
+		$REG_IDs = (array) $REG_IDs;
1410
+		if ( ! empty($REG_IDs)) {
1411 1411
 			$success = true;
1412 1412
 			// set default status if none is passed
1413 1413
 			$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1414 1414
 			// sanitize $REG_IDs
1415
-			$REG_IDs = array_filter( $REG_IDs, 'absint' );
1415
+			$REG_IDs = array_filter($REG_IDs, 'absint');
1416 1416
 			//loop through REG_ID's and change status
1417
-			foreach ( $REG_IDs as $REG_ID ) {
1418
-				$registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID );
1419
-				if ( $registration instanceof EE_Registration ) {
1420
-					$registration->set_status( $status );
1417
+			foreach ($REG_IDs as $REG_ID) {
1418
+				$registration = EEM_Registration::instance()->get_one_by_ID($REG_ID);
1419
+				if ($registration instanceof EE_Registration) {
1420
+					$registration->set_status($status);
1421 1421
 					$result = $registration->save();
1422 1422
 					// verifying explicit fails because update *may* just return 0 for 0 rows affected
1423 1423
 					$success = $result !== false ? $success : false;
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
 		//reset _req_data['_REG_ID'] for any potential future messages notifications
1428 1428
 		$this->_req_data['_REG_ID'] = $REG_IDs;
1429 1429
 		//return $success and processed registrations
1430
-		return array( 'REG_ID' => $REG_IDs, 'success' => $success );
1430
+		return array('REG_ID' => $REG_IDs, 'success' => $success);
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1439,49 +1439,49 @@  discard block
 block discarded – undo
1439 1439
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1440 1440
 	 * @return void
1441 1441
 	 */
1442
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1443
-		$result = ! empty( $STS_ID )
1444
-            ? $this->_set_registration_status_from_request( $STS_ID, $notify )
1445
-            : array( 'success' => false );
1446
-		$success = isset( $result['success'] ) && $result['success'];
1442
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1443
+		$result = ! empty($STS_ID)
1444
+            ? $this->_set_registration_status_from_request($STS_ID, $notify)
1445
+            : array('success' => false);
1446
+		$success = isset($result['success']) && $result['success'];
1447 1447
 		//setup success message
1448
-		if ( $success ) {
1449
-			if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) {
1448
+		if ($success) {
1449
+			if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1450 1450
 				$msg = sprintf(
1451
-					__( 'Registration status has been set to %s', 'event_espresso' ),
1452
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1451
+					__('Registration status has been set to %s', 'event_espresso'),
1452
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1453 1453
 				);
1454 1454
 			} else {
1455 1455
 				$msg = sprintf(
1456
-					__( 'Registrations have been set to %s.', 'event_espresso' ),
1457
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1456
+					__('Registrations have been set to %s.', 'event_espresso'),
1457
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1458 1458
 				);
1459 1459
 			}
1460
-			EE_Error::add_success( $msg );
1460
+			EE_Error::add_success($msg);
1461 1461
 		} else {
1462 1462
 			EE_Error::add_error(
1463
-				__( 'Something went wrong, and the status was not changed', 'event_espresso' ),
1463
+				__('Something went wrong, and the status was not changed', 'event_espresso'),
1464 1464
 				__FILE__, __LINE__, __FUNCTION__
1465 1465
 			);
1466 1466
 		}
1467
-		if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) {
1468
-			$route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) );
1467
+		if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') {
1468
+			$route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID']));
1469 1469
 		} else {
1470
-			$route = array( 'action' => 'default' );
1470
+			$route = array('action' => 'default');
1471 1471
 		}
1472 1472
 		//unset nonces
1473
-		foreach ( $this->_req_data as $ref => $value ) {
1474
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1475
-				unset( $this->_req_data[$ref] );
1473
+		foreach ($this->_req_data as $ref => $value) {
1474
+			if (strpos($ref, 'nonce') !== false) {
1475
+				unset($this->_req_data[$ref]);
1476 1476
 				continue;
1477 1477
 			}
1478 1478
 
1479
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1479
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1480 1480
 			$this->_req_data[$ref] = $value;
1481 1481
 		}
1482 1482
 		//merge request vars so that the reloaded list table contains any existing filter query params
1483
-		$route = array_merge( $this->_req_data, $route );
1484
-		$this->_redirect_after_action( $success, '', '', $route, true );
1483
+		$route = array_merge($this->_req_data, $route);
1484
+		$this->_redirect_after_action($success, '', '', $route, true);
1485 1485
 	}
1486 1486
 
1487 1487
 
@@ -1492,51 +1492,51 @@  discard block
 block discarded – undo
1492 1492
 	protected function _change_reg_status() {
1493 1493
 		$this->_req_data['return'] = 'view_registration';
1494 1494
 		//set notify based on whether the send notifications toggle is set or not
1495
-		$notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] );
1495
+		$notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']);
1496 1496
 		//$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1497
-		$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset(
1498
-			$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1497
+		$this->_req_data['reg_status_change_form']['reg_status'] = isset(
1498
+			$this->_req_data['reg_status_change_form']['reg_status']
1499 1499
 		)
1500
-			? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1500
+			? $this->_req_data['reg_status_change_form']['reg_status']
1501 1501
 			: '';
1502 1502
 
1503
-		switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) {
1503
+		switch ($this->_req_data['reg_status_change_form']['reg_status']) {
1504 1504
 
1505 1505
 			case EEM_Registration::status_id_approved :
1506
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1507
-				$this->approve_registration( $notify );
1506
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1507
+				$this->approve_registration($notify);
1508 1508
 				break;
1509 1509
 
1510 1510
 			case EEM_Registration::status_id_pending_payment :
1511
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1512
-				$this->pending_registration( $notify );
1511
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1512
+				$this->pending_registration($notify);
1513 1513
 				break;
1514 1514
 
1515 1515
 			case EEM_Registration::status_id_not_approved :
1516
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1517
-				$this->not_approve_registration( $notify );
1516
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1517
+				$this->not_approve_registration($notify);
1518 1518
 				break;
1519 1519
 
1520 1520
 			case EEM_Registration::status_id_declined :
1521
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1522
-				$this->decline_registration( $notify );
1521
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1522
+				$this->decline_registration($notify);
1523 1523
 				break;
1524 1524
 
1525 1525
 			case EEM_Registration::status_id_cancelled :
1526
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1527
-				$this->cancel_registration( $notify );
1526
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1527
+				$this->cancel_registration($notify);
1528 1528
 				break;
1529 1529
 
1530 1530
 			case EEM_Registration::status_id_wait_list :
1531
-			case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) :
1532
-				$this->waitlist_registration( $notify );
1531
+			case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') :
1532
+				$this->waitlist_registration($notify);
1533 1533
 				break;
1534 1534
 
1535 1535
 			case EEM_Registration::status_id_incomplete :
1536 1536
 			default :
1537 1537
 				$result['success'] = false;
1538
-				unset( $this->_req_data['return'] );
1539
-				$this->_reg_status_change_return( '', false );
1538
+				unset($this->_req_data['return']);
1539
+				$this->_reg_status_change_return('', false);
1540 1540
 				break;
1541 1541
 		}
1542 1542
 	}
@@ -1550,8 +1550,8 @@  discard block
 block discarded – undo
1550 1550
 	 * @param bool $notify whether or not to notify the registrant about their approval.
1551 1551
 	 * @return void
1552 1552
 	 */
1553
-	protected function approve_registration( $notify = false ) {
1554
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1553
+	protected function approve_registration($notify = false) {
1554
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1555 1555
 	}
1556 1556
 
1557 1557
 
@@ -1563,8 +1563,8 @@  discard block
 block discarded – undo
1563 1563
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1564 1564
 	 * @return void
1565 1565
 	 */
1566
-	protected function decline_registration( $notify = false ) {
1567
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1566
+	protected function decline_registration($notify = false) {
1567
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1568 1568
 	}
1569 1569
 
1570 1570
 
@@ -1576,8 +1576,8 @@  discard block
 block discarded – undo
1576 1576
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1577 1577
 	 * @return void
1578 1578
 	 */
1579
-	protected function cancel_registration( $notify = false ) {
1580
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1579
+	protected function cancel_registration($notify = false) {
1580
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1581 1581
 	}
1582 1582
 
1583 1583
 
@@ -1589,8 +1589,8 @@  discard block
 block discarded – undo
1589 1589
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1590 1590
 	 * @return void
1591 1591
 	 */
1592
-	protected function not_approve_registration( $notify = false ) {
1593
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1592
+	protected function not_approve_registration($notify = false) {
1593
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1594 1594
 	}
1595 1595
 
1596 1596
 
@@ -1602,8 +1602,8 @@  discard block
 block discarded – undo
1602 1602
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1603 1603
 	 * @return void
1604 1604
 	 */
1605
-	protected function pending_registration( $notify = false ) {
1606
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1605
+	protected function pending_registration($notify = false) {
1606
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1607 1607
 	}
1608 1608
 
1609 1609
 
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1616 1616
 	 * @return void
1617 1617
 	 */
1618
-	protected function waitlist_registration( $notify = false ) {
1619
-		$this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify );
1618
+	protected function waitlist_registration($notify = false) {
1619
+		$this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1620 1620
 	}
1621 1621
 
1622 1622
 
@@ -1630,14 +1630,14 @@  discard block
 block discarded – undo
1630 1630
 	public function _reg_details_meta_box() {
1631 1631
 		EEH_Autoloader::register_line_item_display_autoloaders();
1632 1632
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1633
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1633
+		EE_Registry::instance()->load_helper('Line_Item');
1634 1634
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1635 1635
 		$this->_session = $transaction->session_data();
1636 1636
 
1637 1637
 		$filters = new EE_Line_Item_Filter_Collection();
1638 1638
 		//$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1639
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1640
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1639
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1640
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1641 1641
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1642 1642
 		$line_item_display = new EE_Line_Item_Display(
1643 1643
 			'reg_admin_table',
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
 		);
1646 1646
 		$this->_template_args['line_item_table'] = $line_item_display->display_line_item(
1647 1647
 			$filtered_line_item_tree,
1648
-			array( 'EE_Registration' => $this->_registration )
1648
+			array('EE_Registration' => $this->_registration)
1649 1649
 		);
1650 1650
 		$attendee = $this->_registration->attendee();
1651 1651
 
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 				'espresso_transactions_view_transaction'
1656 1656
 			)
1657 1657
 		) {
1658
-			$this->_template_args[ 'view_transaction_button' ] =  EEH_Template::get_button_or_link(
1658
+			$this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
1659 1659
 				EE_Admin_Page::add_query_args_and_nonce(
1660 1660
 					array(
1661 1661
 						'action' => 'view_transaction',
@@ -1663,12 +1663,12 @@  discard block
 block discarded – undo
1663 1663
 					),
1664 1664
 					TXN_ADMIN_URL
1665 1665
 				),
1666
-				esc_html__( ' View Transaction' ),
1666
+				esc_html__(' View Transaction'),
1667 1667
 				'button secondary-button right',
1668 1668
 				'dashicons dashicons-cart'
1669 1669
 			);
1670 1670
 		} else {
1671
-			$this->_template_args[ 'view_transaction_button' ] = '';
1671
+			$this->_template_args['view_transaction_button'] = '';
1672 1672
 		}
1673 1673
 
1674 1674
 		if (
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 				'espresso_registrations_resend_registration'
1679 1679
 			)
1680 1680
 		) {
1681
-			$this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link(
1681
+			$this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
1682 1682
 				EE_Admin_Page::add_query_args_and_nonce(
1683 1683
 					array(
1684 1684
 						'action' 		=> 'resend_registration',
@@ -1687,55 +1687,55 @@  discard block
 block discarded – undo
1687 1687
 					),
1688 1688
 					REG_ADMIN_URL
1689 1689
 				),
1690
-				esc_html__( ' Resend Registration' ),
1690
+				esc_html__(' Resend Registration'),
1691 1691
 				'button secondary-button right',
1692 1692
 				'dashicons dashicons-email-alt'
1693 1693
 			);
1694 1694
 		} else {
1695
-			$this->_template_args[ 'resend_registration_button' ] = '';
1695
+			$this->_template_args['resend_registration_button'] = '';
1696 1696
 		}
1697 1697
 
1698 1698
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1699
-		$payment = $transaction->get_first_related( 'Payment' );
1699
+		$payment = $transaction->get_first_related('Payment');
1700 1700
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1701
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1701
+		$payment_method = $payment->get_first_related('Payment_Method');
1702 1702
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1703 1703
 
1704 1704
 		$reg_details = array(
1705 1705
 			'payment_method' => $payment_method->name(),
1706 1706
 			'response_msg' => $payment->gateway_response(),
1707
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1707
+			'registration_id' => $this->_registration->get('REG_code'),
1708 1708
 			'registration_session' => $this->_registration->session_ID(),
1709
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1710
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1709
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1710
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1711 1711
 		);
1712 1712
 
1713 1713
 
1714
-		if ( isset( $reg_details['registration_id'] )) {
1714
+		if (isset($reg_details['registration_id'])) {
1715 1715
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1716
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1716
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1717 1717
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1718 1718
 		}
1719 1719
 
1720
-		if ( isset( $reg_details['payment_method'] ) ) {
1720
+		if (isset($reg_details['payment_method'])) {
1721 1721
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1722
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1722
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1723 1723
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1724 1724
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1725
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1725
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1726 1726
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1727 1727
 		}
1728 1728
 
1729 1729
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1730
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1730
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1731 1731
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1732 1732
 
1733 1733
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1734
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1734
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1735 1735
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1736 1736
 
1737 1737
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1738
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1738
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1739 1739
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1740 1740
 
1741 1741
 		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(
@@ -1748,8 +1748,8 @@  discard block
 block discarded – undo
1748 1748
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1749 1749
 		$this->_template_args['event_id'] = $this->_registration->event_ID();
1750 1750
 
1751
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1752
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1751
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1752
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1753 1753
 
1754 1754
 	}
1755 1755
 
@@ -1763,14 +1763,14 @@  discard block
 block discarded – undo
1763 1763
 	*/
1764 1764
 	public function _reg_questions_meta_box() {
1765 1765
 		//allow someone to override this method entirely
1766
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1767
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1768
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1766
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1767
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1768
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1769 1769
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1770 1770
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1771 1771
 
1772
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1773
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1772
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1773
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1774 1774
 		}
1775 1775
 	}
1776 1776
 
@@ -1784,12 +1784,12 @@  discard block
 block discarded – undo
1784 1784
 	 * @param        string $output
1785 1785
 	 * @return        string
1786 1786
 	 */
1787
-	public function form_before_question_group( $output ) {
1787
+	public function form_before_question_group($output) {
1788 1788
 		EE_Error::doing_it_wrong(
1789
-			__CLASS__ . '::' . __FUNCTION__,
1790
-			__( 'This method would have been protected but was used on a filter callback'
1789
+			__CLASS__.'::'.__FUNCTION__,
1790
+			__('This method would have been protected but was used on a filter callback'
1791 1791
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1792
-				'event_espresso' ),
1792
+				'event_espresso'),
1793 1793
 			'4.8.32.rc.000'
1794 1794
 		);
1795 1795
 		return '
@@ -1808,20 +1808,20 @@  discard block
 block discarded – undo
1808 1808
 	 * @param        string $output
1809 1809
 	 * @return        string
1810 1810
 	 */
1811
-	public function form_after_question_group( $output ) {
1811
+	public function form_after_question_group($output) {
1812 1812
 		EE_Error::doing_it_wrong(
1813
-			__CLASS__ . '::' . __FUNCTION__,
1814
-			__( 'This method would have been protected but was used on a filter callback'
1813
+			__CLASS__.'::'.__FUNCTION__,
1814
+			__('This method would have been protected but was used on a filter callback'
1815 1815
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1816
-				'event_espresso' ),
1816
+				'event_espresso'),
1817 1817
 			'4.8.32.rc.000'
1818 1818
 		);
1819 1819
 		return  '
1820 1820
 			<tr class="hide-if-no-js">
1821 1821
 				<th> </th>
1822 1822
 				<td class="reg-admin-edit-attendee-question-td">
1823
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1824
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1823
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1824
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1825 1825
 						<div class="dashicons dashicons-edit"></div>
1826 1826
 					</a>
1827 1827
 				</td>
@@ -1841,18 +1841,18 @@  discard block
 block discarded – undo
1841 1841
 	 * @param        string $label
1842 1842
 	 * @return        string
1843 1843
 	 */
1844
-	public function form_form_field_label_wrap( $label ) {
1844
+	public function form_form_field_label_wrap($label) {
1845 1845
 		EE_Error::doing_it_wrong(
1846
-			__CLASS__ . '::' . __FUNCTION__,
1847
-			__( 'This method would have been protected but was used on a filter callback'
1846
+			__CLASS__.'::'.__FUNCTION__,
1847
+			__('This method would have been protected but was used on a filter callback'
1848 1848
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1849
-				'event_espresso' ),
1849
+				'event_espresso'),
1850 1850
 			'4.8.32.rc.000'
1851 1851
 		);
1852 1852
 		return '
1853 1853
 			<tr>
1854 1854
 				<th>
1855
-					' . $label  . '
1855
+					' . $label.'
1856 1856
 				</th>';
1857 1857
 	}
1858 1858
 
@@ -1866,17 +1866,17 @@  discard block
 block discarded – undo
1866 1866
 	 * @param        string $input
1867 1867
 	 * @return        string
1868 1868
 	 */
1869
-	public function form_form_field_input__wrap( $input ) {
1869
+	public function form_form_field_input__wrap($input) {
1870 1870
 		EE_Error::doing_it_wrong(
1871
-			__CLASS__ . '::' . __FUNCTION__,
1872
-			__( 'This method would have been protected but was used on a filter callback'
1871
+			__CLASS__.'::'.__FUNCTION__,
1872
+			__('This method would have been protected but was used on a filter callback'
1873 1873
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1874
-				'event_espresso' ),
1874
+				'event_espresso'),
1875 1875
 			'4.8.32.rc.000'
1876 1876
 		);
1877 1877
 		return '
1878 1878
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1879
-					' . $input . '
1879
+					' . $input.'
1880 1880
 				</td>
1881 1881
 			</tr>';
1882 1882
 	}
@@ -1890,14 +1890,14 @@  discard block
 block discarded – undo
1890 1890
 	 * @return void
1891 1891
 	 */
1892 1892
 	protected function _update_attendee_registration_form() {
1893
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1894
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1895
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1896
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1897
-			if( $success ) {
1893
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1894
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1895
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1896
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1897
+			if ($success) {
1898 1898
 				$what = __('Registration Form', 'event_espresso');
1899
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1900
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1899
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1900
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1901 1901
 			}
1902 1902
 		}
1903 1903
 	}
@@ -1908,11 +1908,11 @@  discard block
 block discarded – undo
1908 1908
 	 * @param int $REG_ID
1909 1909
 	 * @return EE_Registration_Custom_Questions_Form
1910 1910
 	 */
1911
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1912
-		if( ! $this->_reg_custom_questions_form ) {
1913
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1914
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1915
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1911
+	protected function _get_reg_custom_questions_form($REG_ID) {
1912
+		if ( ! $this->_reg_custom_questions_form) {
1913
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1914
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1915
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1916 1916
 		}
1917 1917
 		return $this->_reg_custom_questions_form;
1918 1918
 	}
@@ -1925,17 +1925,17 @@  discard block
 block discarded – undo
1925 1925
 	 * @param bool $REG_ID
1926 1926
 	 * @return bool
1927 1927
 	 */
1928
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1928
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1929 1929
 
1930 1930
 		if ( ! $REG_ID) {
1931
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1931
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1932 1932
 		}
1933
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1934
-		$form->receive_form_submission( $this->_req_data );
1933
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1934
+		$form->receive_form_submission($this->_req_data);
1935 1935
 		$success = false;
1936
-		if( $form->is_valid() ) {
1937
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1938
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1936
+		if ($form->is_valid()) {
1937
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1938
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1939 1939
 					$where_conditions = array(
1940 1940
 							'QST_ID' => $question_id,
1941 1941
 							'REG_ID' => $REG_ID
@@ -1943,19 +1943,19 @@  discard block
 block discarded – undo
1943 1943
 					$possibly_new_values = array(
1944 1944
 							'ANS_value' => $input->normalized_value()
1945 1945
 						);
1946
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1947
-					if( $answer instanceof EE_Answer ) {
1948
-						$success = $answer->save( $possibly_new_values );
1946
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1947
+					if ($answer instanceof EE_Answer) {
1948
+						$success = $answer->save($possibly_new_values);
1949 1949
 					} else {
1950 1950
 						//insert it then
1951
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1952
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1951
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1952
+						$answer = EE_Answer::new_instance($cols_n_vals);
1953 1953
 						$success = $answer->save();
1954 1954
 					}
1955 1955
 				}
1956 1956
 			}
1957 1957
 		} else {
1958
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1958
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1959 1959
 		}
1960 1960
 		return $success;
1961 1961
 	}
@@ -1973,31 +1973,31 @@  discard block
 block discarded – undo
1973 1973
 		$registrations = $REG->get_all(array(
1974 1974
 			array(
1975 1975
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1976
-				'REG_ID'=>array('!=',$this->_registration->ID())
1976
+				'REG_ID'=>array('!=', $this->_registration->ID())
1977 1977
 			),
1978 1978
 			'force_join'=>array('Attendee')));
1979 1979
 
1980 1980
 		$this->_template_args['attendees'] = array();
1981 1981
 		$this->_template_args['attendee_notice'] = '';
1982
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1983
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1982
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1983
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1984 1984
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1985 1985
 		} else {
1986 1986
 
1987 1987
 			$att_nmbr = 1;
1988
-			foreach ( $registrations as $registration ) {
1988
+			foreach ($registrations as $registration) {
1989 1989
 				/* @var $registration EE_Registration */
1990 1990
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1991
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1992
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1993
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1994
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1995
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1991
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1992
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1993
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1994
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1995
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1996 1996
 
1997
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1997
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1998 1998
 
1999
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2000
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
1999
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2000
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
2001 2001
 
2002 2002
 				$att_nmbr++;
2003 2003
 			}
@@ -2007,8 +2007,8 @@  discard block
 block discarded – undo
2007 2007
 
2008 2008
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
2009 2009
 		}
2010
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2011
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2010
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
2011
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2012 2012
 
2013 2013
 	}
2014 2014
 
@@ -2029,14 +2029,14 @@  discard block
 block discarded – undo
2029 2029
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
2030 2030
 
2031 2031
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not)
2032
-		if ( ! $this->_registration->is_primary_registrant() ) {
2032
+		if ( ! $this->_registration->is_primary_registrant()) {
2033 2033
 
2034 2034
 			$primary_registration = $this->_registration->get_primary_registration();
2035 2035
 			$primary_attendee = $primary_registration instanceof EE_Registration
2036 2036
 				? $primary_registration->attendee()
2037 2037
 				: null;
2038 2038
 
2039
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
2039
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2040 2040
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
2041 2041
 				$primary_registration = NULL;
2042 2042
 			}
@@ -2045,27 +2045,27 @@  discard block
 block discarded – undo
2045 2045
 		}
2046 2046
 
2047 2047
 		$this->_template_args['ATT_ID'] = $attendee->ID();
2048
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
2049
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
2050
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
2048
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
2049
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
2050
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
2051 2051
 		$this->_template_args['phone'] = $attendee->phone();
2052 2052
 
2053
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
2053
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2054 2054
 
2055 2055
 
2056 2056
 		//edit link
2057
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2057
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2058 2058
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
2059 2059
 
2060 2060
 		//create link
2061
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
2061
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
2062 2062
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
2063 2063
 
2064 2064
 		$this->_template_args['att_check'] = $att_check;
2065 2065
 
2066 2066
 
2067
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2068
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2067
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
2068
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2069 2069
 	}
2070 2070
 
2071 2071
 
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
 	 * @access protected
2079 2079
 	 * @return void
2080 2080
 	 */
2081
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
2081
+	protected function _trash_or_restore_registrations($trash = TRUE) {
2082 2082
 		$REGM = EEM_Registration::instance();
2083 2083
 
2084 2084
 		$success = 1;
@@ -2088,26 +2088,26 @@  discard block
 block discarded – undo
2088 2088
 		$dtts = array();
2089 2089
 
2090 2090
 		//if empty _REG_ID then get out because there's nothing to do
2091
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
2091
+		if (empty($this->_req_data['_REG_ID'])) {
2092 2092
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
2093
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
2094
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
2093
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
2094
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
2095 2095
 		}
2096 2096
 
2097 2097
 		//Checkboxes
2098
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2098
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2099 2099
 			// if array has more than one element than success message should be plural
2100
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2100
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2101 2101
 			// cycle thru checkboxes
2102
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2102
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2103 2103
 				/** @var EE_Registration $REG */
2104
-				$REG = $REGM->get_one_by_ID( $REG_ID);
2104
+				$REG = $REGM->get_one_by_ID($REG_ID);
2105 2105
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
2106
-				if ( $payment_count > 0 ) {
2107
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
2106
+				if ($payment_count > 0) {
2107
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
2108 2108
 					$error = 1;
2109 2109
 					$success = 0;
2110
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
2110
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
2111 2111
 					continue; //can't trash this registration because it has payments.
2112 2112
 				}
2113 2113
 				$ticket = $REG->get_first_related('Ticket');
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
 				$dtts = array_merge($dtts, $dtt);
2117 2117
 
2118 2118
 				$updated = $trash ? $REG->delete() : $REG->restore();
2119
-				if ( !$updated ) {
2119
+				if ( ! $updated) {
2120 2120
 					$success = 0;
2121 2121
 				} else {
2122 2122
 					$success = 2;
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 			$tickets[$ticket->ID()] = $ticket;
2132 2132
 			$dtts = $ticket->get_many_related('Datetime');
2133 2133
 			$updated = $trash ? $REG->delete() : $REG->restore();
2134
-			if ( ! $updated ) {
2134
+			if ( ! $updated) {
2135 2135
 				$success = 0;
2136 2136
 			}
2137 2137
 
@@ -2141,10 +2141,10 @@  discard block
 block discarded – undo
2141 2141
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
2142 2142
 		EEM_Datetime::instance()->update_sold($dtts);
2143 2143
 
2144
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2145
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2144
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2145
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2146 2146
 		$overwrite_msgs = $error ? TRUE : FALSE;
2147
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
2147
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
2148 2148
 	}
2149 2149
 
2150 2150
 
@@ -2168,16 +2168,16 @@  discard block
 block discarded – undo
2168 2168
 		$success = 1;
2169 2169
 
2170 2170
 		//Checkboxes
2171
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2171
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2172 2172
 			// if array has more than one element than success message should be plural
2173
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2173
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2174 2174
 			// cycle thru checkboxes
2175
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2175
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2176 2176
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2177
-				if ( ! $REG instanceof EE_Registration )
2177
+				if ( ! $REG instanceof EE_Registration)
2178 2178
 					continue;
2179 2179
 				$deleted = $this->_delete_registration($REG);
2180
-				if ( !$deleted ) {
2180
+				if ( ! $deleted) {
2181 2181
 					$success = 0;
2182 2182
 				}
2183 2183
 			}
@@ -2187,15 +2187,15 @@  discard block
 block discarded – undo
2187 2187
 			$REG_ID = $this->_req_data['_REG_ID'];
2188 2188
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2189 2189
 			$deleted = $this->_delete_registration($REG);
2190
-			if ( ! $deleted ) {
2190
+			if ( ! $deleted) {
2191 2191
 				$success = 0;
2192 2192
 			}
2193 2193
 
2194 2194
 		}
2195 2195
 
2196
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2197
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2198
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2196
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2197
+		$action_desc = __('permanently deleted.', 'event_espresso');
2198
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2199 2199
 	}
2200 2200
 
2201 2201
 
@@ -2207,31 +2207,31 @@  discard block
 block discarded – undo
2207 2207
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2208 2208
 	 * @return boolean              true = successful deletion, false = fail.
2209 2209
 	 */
2210
-	protected function _delete_registration( EE_Registration $REG ) {
2210
+	protected function _delete_registration(EE_Registration $REG) {
2211 2211
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
2212 2212
 		$TXN = $REG->get_first_related('Transaction');
2213 2213
 		$REGS = $TXN->get_many_related('Registration');
2214 2214
 
2215 2215
 		$all_trashed = TRUE;
2216
-		foreach ( $REGS as $registration ) {
2217
-			if ( ! $registration->get('REG_deleted') )
2216
+		foreach ($REGS as $registration) {
2217
+			if ( ! $registration->get('REG_deleted'))
2218 2218
 				$all_trashed = FALSE;
2219 2219
 		}
2220 2220
 
2221
-		if ( ! $all_trashed ) {
2222
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2221
+		if ( ! $all_trashed) {
2222
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2223 2223
 			return false;
2224 2224
 		}
2225 2225
 
2226 2226
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
2227
-		foreach ( $REGS as $registration ) {
2227
+		foreach ($REGS as $registration) {
2228 2228
 
2229 2229
 			//delete related answers
2230 2230
 			$registration->delete_related_permanently('Answer');
2231 2231
 
2232 2232
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2233 2233
 			$attendee = $registration->get_first_related('Attendee');
2234
-			if ( $attendee instanceof EE_Attendee ) {
2234
+			if ($attendee instanceof EE_Attendee) {
2235 2235
 				$registration->_remove_relation_to($attendee, 'Attendee');
2236 2236
 			}
2237 2237
 
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 			//now delete permanently the checkins related to this registration.
2242 2242
 			$registration->delete_related_permanently('Checkin');
2243 2243
 
2244
-			if ( $registration->ID() === $REG->ID() )
2244
+			if ($registration->ID() === $REG->ID())
2245 2245
 				continue; //we don't want to delete permanently the existing registration just yet.
2246 2246
 
2247 2247
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2278,35 +2278,35 @@  discard block
 block discarded – undo
2278 2278
 	 * @return void
2279 2279
 	 */
2280 2280
 	public function new_registration() {
2281
-		if ( ! $this->_set_reg_event() ) {
2282
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2281
+		if ( ! $this->_set_reg_event()) {
2282
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2283 2283
 		}
2284
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2284
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2285 2285
 		// gotta start with a clean slate if we're not coming here via ajax
2286 2286
 		if (
2287
-			! defined('DOING_AJAX' )
2288
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2287
+			! defined('DOING_AJAX')
2288
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2289 2289
 		) {
2290
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2290
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2291 2291
 		}
2292 2292
 
2293
-		$this->_template_args['event_name'] = '' ;
2293
+		$this->_template_args['event_name'] = '';
2294 2294
 		// event name
2295
-		if ( $this->_reg_event ) {
2295
+		if ($this->_reg_event) {
2296 2296
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2297
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2298
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2299
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2297
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2298
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2299
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2300 2300
 		}
2301 2301
 
2302 2302
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2303 2303
 
2304
-		if ( defined('DOING_AJAX' ) ) {
2304
+		if (defined('DOING_AJAX')) {
2305 2305
 			$this->_return_json();
2306 2306
 		}
2307 2307
 		// grab header
2308
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2309
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2308
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2309
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2310 2310
 
2311 2311
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2312 2312
 		// the details template wrapper
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
 	 * @return string html
2324 2324
 	 */
2325 2325
 	protected function _get_registration_step_content() {
2326
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2326
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2327 2327
 			$warning_msg = sprintf(
2328 2328
 				__(
2329 2329
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
 				'</b>'
2340 2340
 			);
2341 2341
 			return '
2342
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2342
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2343 2343
 	<script >
2344 2344
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2345 2345
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2374,16 +2374,16 @@  discard block
 block discarded – undo
2374 2374
 		$cart = EE_Registry::instance()->SSN->cart();
2375 2375
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2376 2376
 
2377
-		switch ( $step ) {
2377
+		switch ($step) {
2378 2378
 			case 'ticket' :
2379 2379
 				$hidden_fields['processing_registration']['value'] = 1;
2380 2380
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2381
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2381
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2382 2382
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2383 2383
 				$template_args['show_notification_toggle'] = FALSE;
2384 2384
 				break;
2385 2385
 			case 'questions' :
2386
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2386
+				$hidden_fields['processing_registration']['value'] = 2;
2387 2387
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2388 2388
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2389 2389
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2392,10 +2392,10 @@  discard block
 block discarded – undo
2392 2392
 				break;
2393 2393
 		}
2394 2394
 
2395
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2395
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2396 2396
 
2397 2397
 		return EEH_Template::display_template(
2398
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2398
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2399 2399
 		);
2400 2400
 	}
2401 2401
 
@@ -2410,11 +2410,11 @@  discard block
 block discarded – undo
2410 2410
 	*		@return boolean
2411 2411
 	*/
2412 2412
 	private function _set_reg_event() {
2413
-		if ( is_object( $this->_reg_event )) {
2413
+		if (is_object($this->_reg_event)) {
2414 2414
 			return TRUE;
2415 2415
 		}
2416
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2417
-		if ( ! $EVT_ID ) {
2416
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2417
+		if ( ! $EVT_ID) {
2418 2418
 			return FALSE;
2419 2419
 		}
2420 2420
 
@@ -2435,80 +2435,80 @@  discard block
 block discarded – undo
2435 2435
 	public function process_reg_step() {
2436 2436
 		EE_System::do_not_cache();
2437 2437
 		$this->_set_reg_event();
2438
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2438
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2439 2439
 
2440 2440
 		//what step are we on?
2441 2441
 		$cart = EE_Registry::instance()->SSN->cart();
2442 2442
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2443 2443
 
2444 2444
 		//if doing ajax then we need to verify the nonce
2445
-		if ( defined( 'DOING_AJAX' ) ) {
2446
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2447
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2445
+		if (defined('DOING_AJAX')) {
2446
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2447
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2448 2448
 		}
2449 2449
 
2450
-		switch ( $step ) {
2450
+		switch ($step) {
2451 2451
 
2452 2452
 			case 'ticket' :
2453 2453
 				//process ticket selection
2454 2454
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2455
-				if ( $success ) {
2456
-					EE_Error::add_success( esc_html__( 'Tickets Selected. Now complete the registration.', 'event_espresso' ) );
2455
+				if ($success) {
2456
+					EE_Error::add_success(esc_html__('Tickets Selected. Now complete the registration.', 'event_espresso'));
2457 2457
 				} else {
2458 2458
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2459 2459
 				}
2460
-				if ( defined('DOING_AJAX') ) {
2460
+				if (defined('DOING_AJAX')) {
2461 2461
 					$this->new_registration(); //display next step
2462 2462
 				} else {
2463 2463
 					$query_args['action'] = 'new_registration';
2464 2464
 					$query_args['processing_registration'] = 1;
2465 2465
 					$query_args['event_id'] = $this->_reg_event->ID();
2466
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2466
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2467 2467
 				}
2468 2468
 				break;
2469 2469
 
2470 2470
 			case 'questions' :
2471
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2472
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2471
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2472
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2473 2473
 				}
2474 2474
 				//process registration
2475 2475
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2476
-				if ( $cart instanceof EE_Cart ) {
2476
+				if ($cart instanceof EE_Cart) {
2477 2477
 					$grand_total = $cart->get_cart_grand_total();
2478
-					if ( $grand_total instanceof EE_Line_Item ) {
2478
+					if ($grand_total instanceof EE_Line_Item) {
2479 2479
 						$grand_total->save_this_and_descendants_to_txn();
2480 2480
 					}
2481 2481
 				}
2482
-				if ( ! $transaction instanceof EE_Transaction ) {
2482
+				if ( ! $transaction instanceof EE_Transaction) {
2483 2483
 					$query_args = array(
2484 2484
 						'action' => 'new_registration',
2485 2485
 						'processing_registration' => 2,
2486 2486
 						'event_id' => $this->_reg_event->ID()
2487 2487
 					);
2488 2488
 
2489
-					if ( defined('DOING_AJAX' )) {
2489
+					if (defined('DOING_AJAX')) {
2490 2490
 						//display registration form again because there are errors (maybe validation?)
2491 2491
 						$this->new_registration();
2492 2492
 						return;
2493 2493
 					} else {
2494
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2494
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2495 2495
 						return;
2496 2496
 					}
2497 2497
 				}
2498 2498
 				// maybe update status, and make sure to save transaction if not done already
2499
-				if ( ! $transaction->update_status_based_on_total_paid() ) {
2499
+				if ( ! $transaction->update_status_based_on_total_paid()) {
2500 2500
 					$transaction->save();
2501 2501
 				}
2502
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2502
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2503 2503
 				$this->_req_data = array();
2504 2504
 				$query_args = array(
2505 2505
 					'action'        => 'redirect_to_txn',
2506 2506
 					'TXN_ID'        => $transaction->ID(),
2507 2507
 					'EVT_ID'        => $this->_reg_event->ID(),
2508
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2508
+					'event_name'    => urlencode($this->_reg_event->name()),
2509 2509
 					'redirect_from' => 'new_registration'
2510 2510
 				);
2511
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2511
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2512 2512
 				break;
2513 2513
 		}
2514 2514
 
@@ -2525,21 +2525,21 @@  discard block
 block discarded – undo
2525 2525
 	 */
2526 2526
 	public function redirect_to_txn() {
2527 2527
 		EE_System::do_not_cache();
2528
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2528
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2529 2529
 		$query_args = array(
2530 2530
 			'action' => 'view_transaction',
2531
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2531
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2532 2532
 			'page'   => 'espresso_transactions'
2533 2533
 		);
2534
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2535
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2536
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2537
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2534
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2535
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2536
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2537
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2538 2538
 		}
2539 2539
 		EE_Error::add_success(
2540
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2540
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2541 2541
 		);
2542
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2542
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2543 2543
 	}
2544 2544
 
2545 2545
 
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 	*		@return void
2551 2551
 	*/
2552 2552
 	protected function _attendee_contact_list_table() {
2553
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2553
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2554 2554
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2555 2555
 		$this->display_admin_list_table_page_with_no_sidebar();
2556 2556
 	}
@@ -2565,10 +2565,10 @@  discard block
 block discarded – undo
2565 2565
 	*		@access public
2566 2566
 	*		@return array
2567 2567
 	*/
2568
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2568
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2569 2569
 
2570
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2571
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2570
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2571
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2572 2572
 		$ATT_MDL = EEM_Attendee::instance();
2573 2573
 
2574 2574
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2596,47 +2596,47 @@  discard block
 block discarded – undo
2596 2596
 				$orderby = 'ATT_lname';
2597 2597
 		}
2598 2598
 
2599
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2599
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2600 2600
 
2601
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2602
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2603
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2601
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2602
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2603
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2604 2604
 
2605 2605
 		$_where = array();
2606 2606
 
2607
-		if ( ! empty( $this->_req_data['s'] ) ) {
2608
-			$sstr = '%' . $this->_req_data['s'] . '%';
2607
+		if ( ! empty($this->_req_data['s'])) {
2608
+			$sstr = '%'.$this->_req_data['s'].'%';
2609 2609
 			$_where['OR'] = array(
2610
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2611
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2612
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2613
-				'ATT_fname' => array( 'LIKE', $sstr ),
2614
-				'ATT_lname' => array( 'LIKE', $sstr ),
2615
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2616
-				'ATT_email' => array('LIKE', $sstr ),
2617
-				'ATT_address' => array( 'LIKE', $sstr ),
2618
-				'ATT_address2' => array( 'LIKE', $sstr ),
2619
-				'ATT_city' => array( 'LIKE', $sstr ),
2620
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2621
-				'State.STA_name' => array('LIKE', $sstr ),
2622
-				'ATT_phone' => array( 'LIKE', $sstr ),
2623
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2624
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2625
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2626
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2610
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2611
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2612
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2613
+				'ATT_fname' => array('LIKE', $sstr),
2614
+				'ATT_lname' => array('LIKE', $sstr),
2615
+				'ATT_short_bio' => array('LIKE', $sstr),
2616
+				'ATT_email' => array('LIKE', $sstr),
2617
+				'ATT_address' => array('LIKE', $sstr),
2618
+				'ATT_address2' => array('LIKE', $sstr),
2619
+				'ATT_city' => array('LIKE', $sstr),
2620
+				'Country.CNT_name' => array('LIKE', $sstr),
2621
+				'State.STA_name' => array('LIKE', $sstr),
2622
+				'ATT_phone' => array('LIKE', $sstr),
2623
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2624
+				'Registration.REG_code' => array('LIKE', $sstr),
2625
+				'Registration.REG_count' => array('LIKE', $sstr),
2626
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2627 2627
 				);
2628 2628
 		}
2629 2629
 
2630 2630
 
2631
-		$offset = ($current_page-1)*$per_page;
2632
-		$limit = $count ? NULL : array( $offset, $per_page );
2631
+		$offset = ($current_page - 1) * $per_page;
2632
+		$limit = $count ? NULL : array($offset, $per_page);
2633 2633
 
2634
-		if ( $trash ) {
2635
-			$_where['status'] = array( '!=', 'publish' );
2636
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2634
+		if ($trash) {
2635
+			$_where['status'] = array('!=', 'publish');
2636
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2637 2637
 		} else {
2638
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2639
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2638
+			$_where['status'] = array('IN', array('publish'));
2639
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2640 2640
 		}
2641 2641
 
2642 2642
 		return $all_attendees;
@@ -2653,10 +2653,10 @@  discard block
 block discarded – undo
2653 2653
 	 */
2654 2654
 	protected function _resend_registration() {
2655 2655
 		$this->_process_resend_registration();
2656
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2656
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2657 2657
 			'action' => 'default'
2658 2658
 		);
2659
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2659
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2660 2660
 	}
2661 2661
 
2662 2662
 
@@ -2664,26 +2664,26 @@  discard block
 block discarded – undo
2664 2664
 
2665 2665
 
2666 2666
 
2667
-	public function _registrations_report(){
2668
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2669
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2667
+	public function _registrations_report() {
2668
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2669
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2670 2670
 				array(
2671 2671
 					'page' => 'espresso_batch',
2672 2672
 					'batch' => 'file',
2673
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2674
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2675
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2676
-				)) );
2673
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2674
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2675
+					'return_url' => urlencode($this->_req_data['return_url']),
2676
+				)));
2677 2677
 		} else {
2678 2678
 			$new_request_args = array(
2679 2679
 				'export' => 'report',
2680 2680
 				'action' => 'registrations_report_for_event',
2681
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2681
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2682 2682
 			);
2683 2683
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2684 2684
 
2685
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2686
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2685
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2686
+				require_once(EE_CLASSES.'EE_Export.class.php');
2687 2687
 				$EE_Export = EE_Export::instance($this->_req_data);
2688 2688
 				$EE_Export->export();
2689 2689
 			}
@@ -2692,26 +2692,26 @@  discard block
 block discarded – undo
2692 2692
 
2693 2693
 
2694 2694
 
2695
-	public function _contact_list_export(){
2696
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2697
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2695
+	public function _contact_list_export() {
2696
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2697
+			require_once(EE_CLASSES.'EE_Export.class.php');
2698 2698
 			$EE_Export = EE_Export::instance($this->_req_data);
2699 2699
 			$EE_Export->export_attendees();
2700 2700
 		}
2701 2701
 	}
2702 2702
 
2703
-	public function _contact_list_report(){
2704
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2705
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2703
+	public function _contact_list_report() {
2704
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2705
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2706 2706
 				array(
2707 2707
 					'page' => 'espresso_batch',
2708 2708
 					'batch' => 'file',
2709
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2710
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2711
-				)) );
2709
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2710
+					'return_url' => urlencode($this->_req_data['return_url']),
2711
+				)));
2712 2712
 		} else {
2713
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2714
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2713
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2714
+				require_once(EE_CLASSES.'EE_Export.class.php');
2715 2715
 				$EE_Export = EE_Export::instance($this->_req_data);
2716 2716
 				$EE_Export->report_attendees();
2717 2717
 			}
@@ -2730,73 +2730,73 @@  discard block
 block discarded – undo
2730 2730
 	 * @return void
2731 2731
 	 */
2732 2732
 	protected function _duplicate_attendee() {
2733
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2733
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2734 2734
 		//verify we have necessary info
2735
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2736
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2737
-			$query_args = array( 'action' => $action );
2735
+		if (empty($this->_req_data['_REG_ID'])) {
2736
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2737
+			$query_args = array('action' => $action);
2738 2738
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2739 2739
 		}
2740 2740
 
2741 2741
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2742
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2742
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2743 2743
 		$attendee = $registration->attendee();
2744 2744
 
2745 2745
 		//remove relation of existing attendee on registration
2746
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2746
+		$registration->_remove_relation_to($attendee, 'Attendee');
2747 2747
 		//new attendee
2748 2748
 		$new_attendee = clone $attendee;
2749
-		$new_attendee->set( 'ATT_ID', 0 );
2749
+		$new_attendee->set('ATT_ID', 0);
2750 2750
 		$new_attendee->save();
2751 2751
 
2752 2752
 		//add new attendee to reg
2753
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2753
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2754 2754
 
2755
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2755
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2756 2756
 
2757 2757
 		//redirect to edit page for attendee
2758
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2758
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2759 2759
 
2760
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2760
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2761 2761
 	}
2762 2762
 
2763 2763
 
2764 2764
 	//related to cpt routes
2765 2765
 	protected function _insert_update_cpt_item($post_id, $post) {
2766 2766
 		$success = true;
2767
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2767
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2768 2768
 		//for attendee updates
2769
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2769
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2770 2770
 			//note we should only be UPDATING attendees at this point.
2771 2771
 			$updated_fields = array(
2772 2772
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2773 2773
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2774
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2774
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2775 2775
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2776 2776
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2777
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2778
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2779
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2780
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2781
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2782
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2777
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2778
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2779
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2780
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2781
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2782
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2783 2783
 				);
2784
-			foreach ( $updated_fields as $field => $value ) {
2784
+			foreach ($updated_fields as $field => $value) {
2785 2785
 				$attendee->set($field, $value);
2786 2786
 			}
2787 2787
 
2788 2788
 			$success = $attendee->save();
2789 2789
 
2790
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2791
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2792
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2793
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2790
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2791
+			foreach ($attendee_update_callbacks as $a_callback) {
2792
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2793
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2794 2794
 				}
2795 2795
 			}
2796 2796
 		}
2797 2797
 
2798
-		if ( $success === FALSE )
2799
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2798
+		if ($success === FALSE)
2799
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2800 2800
 
2801 2801
 	}
2802 2802
 
@@ -2816,17 +2816,17 @@  discard block
 block discarded – undo
2816 2816
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2817 2817
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2818 2818
 
2819
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2820
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2819
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2820
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2821 2821
 		}
2822 2822
 
2823
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2823
+		if (post_type_supports('espresso_attendees', 'comments')) {
2824 2824
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2825 2825
 		}
2826 2826
 
2827
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2828
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2829
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2827
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2828
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2829
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2830 2830
 	}
2831 2831
 
2832 2832
 
@@ -2835,10 +2835,10 @@  discard block
 block discarded – undo
2835 2835
 	 * @param  WP_Post $post wp post object
2836 2836
 	 * @return string        attendee contact info ( and form )
2837 2837
 	 */
2838
-	public function attendee_contact_info( $post ) {
2838
+	public function attendee_contact_info($post) {
2839 2839
 		//get attendee object ( should already have it )
2840 2840
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2841
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2841
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2842 2842
 		EEH_Template::display_template($template, $this->_template_args);
2843 2843
 	}
2844 2844
 
@@ -2854,12 +2854,12 @@  discard block
 block discarded – undo
2854 2854
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2855 2855
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2856 2856
 				new EE_Question_Form_Input(
2857
-				EE_Question::new_instance( array(
2857
+				EE_Question::new_instance(array(
2858 2858
 					'QST_ID' => 0,
2859 2859
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2860 2860
 					'QST_system' => 'admin-state'
2861 2861
 					)),
2862
-				EE_Answer::new_instance( array(
2862
+				EE_Answer::new_instance(array(
2863 2863
 					'ANS_ID' => 0,
2864 2864
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2865 2865
 					)),
@@ -2872,12 +2872,12 @@  discard block
 block discarded – undo
2872 2872
 			));
2873 2873
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2874 2874
 				new EE_Question_Form_Input(
2875
-				EE_Question::new_instance( array(
2875
+				EE_Question::new_instance(array(
2876 2876
 					'QST_ID' => 0,
2877 2877
 					'QST_display_text' => __('Country', 'event_espresso'),
2878 2878
 					'QST_system' => 'admin-country'
2879 2879
 					)),
2880
-				EE_Answer::new_instance( array(
2880
+				EE_Answer::new_instance(array(
2881 2881
 					'ANS_ID' => 0,
2882 2882
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2883 2883
 					)),
@@ -2888,8 +2888,8 @@  discard block
 block discarded – undo
2888 2888
 					'append_qstn_id' => FALSE
2889 2889
 					)
2890 2890
 				));
2891
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2892
-		EEH_Template::display_template($template, $this->_template_args );
2891
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2892
+		EEH_Template::display_template($template, $this->_template_args);
2893 2893
 
2894 2894
 	}
2895 2895
 
@@ -2899,11 +2899,11 @@  discard block
 block discarded – undo
2899 2899
 	*		@access protected
2900 2900
 	*		@return void
2901 2901
 	*/
2902
-	public function attendee_registrations_meta_box( $post ) {
2902
+	public function attendee_registrations_meta_box($post) {
2903 2903
 
2904 2904
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2905 2905
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2906
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2906
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2907 2907
 		EEH_Template::display_template($template, $this->_template_args);
2908 2908
 
2909 2909
 	}
@@ -2917,8 +2917,8 @@  discard block
 block discarded – undo
2917 2917
 	 * @return string        html for new form.
2918 2918
 	 */
2919 2919
 	public function after_title_form_fields($post) {
2920
-		if ( $post->post_type == 'espresso_attendees' ) {
2921
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2920
+		if ($post->post_type == 'espresso_attendees') {
2921
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2922 2922
 			$template_args['attendee'] = $this->_cpt_model_obj;
2923 2923
 			EEH_Template::display_template($template, $template_args);
2924 2924
 		}
@@ -2935,21 +2935,21 @@  discard block
 block discarded – undo
2935 2935
 	*		@access protected
2936 2936
 	*		@return void
2937 2937
 	*/
2938
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2938
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2939 2939
 
2940
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2940
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2941 2941
 
2942 2942
 		$ATT_MDL = EEM_Attendee::instance();
2943 2943
 
2944 2944
 		$success = 1;
2945 2945
 		//Checkboxes
2946
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2946
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2947 2947
 			// if array has more than one element than success message should be plural
2948
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2948
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2949 2949
 			// cycle thru checkboxes
2950
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2951
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2952
-				if ( !$updated ) {
2950
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2951
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2952
+				if ( ! $updated) {
2953 2953
 					$success = 0;
2954 2954
 				}
2955 2955
 			}
@@ -2958,18 +2958,18 @@  discard block
 block discarded – undo
2958 2958
 			// grab single id and delete
2959 2959
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2960 2960
 			//get attendee
2961
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2961
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2962 2962
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2963 2963
 			$updated = $att->save();
2964
-			if ( ! $updated ) {
2964
+			if ( ! $updated) {
2965 2965
 				$success = 0;
2966 2966
 			}
2967 2967
 
2968 2968
 		}
2969 2969
 
2970
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2971
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2972
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2970
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2971
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2972
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2973 2973
 
2974 2974
 	}
2975 2975
 
Please login to merge, or discard this patch.