Completed
Branch BUG-8698-ticket-sellouts+8511 (c10b31)
by
unknown
72:28 queued 55:48
created
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71 71
 					'extra_request' => 
72 72
 						array( 
73 73
 							'EVT_ID'=> $evt_id, 
74
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
74
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
75 75
 				)
76 76
 			);
77 77
 		}
78 78
 
79 79
 		$this->_sortable_columns = array(
80 80
 			 //true means its already sorted
81
-			'ATT_name' => array( 'ATT_name' => TRUE ),
82
-			'Event' => array( 'Event.EVT.Name' => FALSE )
81
+			'ATT_name' => array('ATT_name' => TRUE),
82
+			'Event' => array('Event.EVT.Name' => FALSE)
83 83
 		);
84 84
 
85 85
 		$this->_hidden_columns = array();
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
 
93 93
 
94
-	protected function _get_row_class( $item ) {
95
-		$class = parent::_get_row_class( $item );
94
+	protected function _get_row_class($item) {
95
+		$class = parent::_get_row_class($item);
96 96
 		//add status class
97
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
98
-		if ( $this->_has_checkbox_column ) {
97
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
98
+		if ($this->_has_checkbox_column) {
99 99
 			$class .= ' has-checkbox-column';
100 100
 		}
101 101
 		return $class;
@@ -107,42 +107,42 @@  discard block
 block discarded – undo
107 107
 		$filters = $where = array();
108 108
 
109 109
 
110
-		if ( empty( $this->_dtts_for_event ) ) {
110
+		if (empty($this->_dtts_for_event)) {
111 111
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
112 112
 			//note possible capability restrictions
113
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
114
-				$where['status**'] =  array( '!=', 'private' );
113
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
114
+				$where['status**'] = array('!=', 'private');
115 115
 			}
116 116
 
117
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
118
-				$where['EVT_wp_user'] =  get_current_user_id();
117
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
118
+				$where['EVT_wp_user'] = get_current_user_id();
119 119
 			}
120 120
 
121
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
122
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
123
-			foreach ( $events as $evt ) {
121
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
122
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
123
+			foreach ($events as $evt) {
124 124
 				//any registrations for this event?
125
-				if ( ! $evt->get_count_of_all_registrations() )
125
+				if ( ! $evt->get_count_of_all_registrations())
126 126
 					continue;
127 127
 				$evts[] = array(
128 128
 					'id' => $evt->ID(),
129
-					'text' => $evt->get( 'EVT_name' ),
129
+					'text' => $evt->get('EVT_name'),
130 130
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
131 131
 				);
132 132
 			}
133 133
 			$event_filter = '<div class="ee-event-filter">';
134
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
135
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
134
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
135
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
136 136
 			$event_filter .= '</div>';
137 137
 			$filters[] = $event_filter;
138 138
 
139 139
 		} else {
140 140
 			//DTT datetimes filter
141
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
141
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
142 142
 			$dtts = array();
143
-			foreach ( $this->_dtts_for_event as $dtt ) {
144
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
145
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
143
+			foreach ($this->_dtts_for_event as $dtt) {
144
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
145
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
146 146
 			}
147 147
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
148 148
 		}
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
 
164 164
 
165 165
 	protected function _get_total_event_attendees() {
166
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
167
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
166
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
167
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
168 168
 		$query_params = array();
169
-		if ($EVT_ID){
170
-			$query_params[0]['EVT_ID']=$EVT_ID;
169
+		if ($EVT_ID) {
170
+			$query_params[0]['EVT_ID'] = $EVT_ID;
171 171
 		}
172 172
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
173
-		if ( $DTT_ID ) {
173
+		if ($DTT_ID) {
174 174
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
175 175
 		}
176
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
176
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
177 177
 
178
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
178
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
179 179
 
180 180
 		return EEM_Registration::instance()->count($query_params);
181 181
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 
187 187
 
188 188
 
189
-	function column__Reg_Status( EE_Registration $item ) {
190
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
189
+	function column__Reg_Status(EE_Registration $item) {
190
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
191 191
 	}
192 192
 
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	function column_cb($item) {
198
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
198
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
199 199
 	}
200 200
 
201 201
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	/**
209 209
 	 * 		column_REG_att_checked_in
210 210
 	*/
211
-	function column__REG_att_checked_in(EE_Registration $item){
211
+	function column__REG_att_checked_in(EE_Registration $item) {
212 212
 		$attendee = $item->attendee();
213 213
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
214
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
214
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
215 215
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
216 216
 		$nonce = wp_create_nonce('checkin_nonce');
217
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
218
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
217
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
218
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
219 219
 
220
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
220
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
221 221
 
222
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
222
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
223 223
 	}
224 224
 
225 225
 
@@ -228,45 +228,45 @@  discard block
 block discarded – undo
228 228
 
229 229
 	function column_ATT_name(EE_Registration $item) {
230 230
 		$attendee = $item->attendee();
231
-		if ( ! $attendee instanceof EE_Attendee ) {
231
+		if ( ! $attendee instanceof EE_Attendee) {
232 232
 			return __('No contact record for this registration.', 'event_espresso');
233 233
 		}
234 234
 
235 235
 		// edit attendee link
236
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
237
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
236
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
237
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
238 238
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
239 239
 
240 240
 		//add group details
241
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
241
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
242 242
 
243 243
 		//add regcode
244
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
244
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
245 245
 		$name_link .= '<br>';
246
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
247
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
246
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
247
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
248 248
 			: $item->reg_code();
249 249
 
250 250
 		//status
251
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
251
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
252 252
 
253 253
 		$actions = array();
254
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
255
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
254
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
255
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
256 256
 
257
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
258
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
257
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
258
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
260 260
 		}
261 261
 
262 262
 
263 263
 
264
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
264
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
265 265
 	}
266 266
 
267 267
 
268 268
 
269
-	function column_ATT_email( EE_Registration $item ) {
269
+	function column_ATT_email(EE_Registration $item) {
270 270
 		$attendee = $item->attendee();
271 271
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
272 272
 		return $item->get_first_related('Attendee')->email();
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 	function column_Event(EE_Registration $item) {
280 280
 		try {
281 281
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
282
-			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
283
-			$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
284
-		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
285
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
282
+			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
283
+			$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
284
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
285
+			$event_label = esc_html__('Unknown', 'event_espresso');
286 286
 		}
287 287
 
288 288
 		return $event_label;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 
294 294
 
295
-	function column_PRC_name(EE_Registration $item){
295
+	function column_PRC_name(EE_Registration $item) {
296 296
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
297 297
 	}
298 298
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * 		column_REG_final_price
306 306
 	*/
307
-	function column__REG_final_price(EE_Registration $item){
308
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
307
+	function column__REG_final_price(EE_Registration $item) {
308
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
309 309
 	}
310 310
 
311 311
 
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * 		column_TXN_paid
317 317
 	*/
318
-	function column_TXN_paid(EE_Registration $item){
318
+	function column_TXN_paid(EE_Registration $item) {
319 319
 
320
-		if ( $item->count() == 1 ) {
320
+		if ($item->count() == 1) {
321 321
 
322
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
322
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
323 323
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
324 324
 			} else {
325
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
326
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
325
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
326
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
327 327
 				<span class="reg-pad-rght">
328
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
329
-						' . $item->transaction()->pretty_paid(). '
328
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
329
+						' . $item->transaction()->pretty_paid().'
330 330
 					</a>
331
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
331
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
332 332
 			}
333 333
 		} else {
334 334
 			return '<span class="reg-pad-rght"></span>';
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 	/**
343 343
 	 * 		column_TXN_total
344 344
 	*/
345
-	function column_TXN_total(EE_Registration $item){
345
+	function column_TXN_total(EE_Registration $item) {
346 346
 		$txn = $item->transaction();
347
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
348
-		if ( $item->get('REG_count') == 1 ) {
347
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
348
+		if ($item->get('REG_count') == 1) {
349 349
 			$line_total_obj = $txn->total_line_item();
350 350
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
351
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
351
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
352 352
 		} else {
353 353
 			return '<span class="reg-pad-rght"></span>';
354 354
 		}
Please login to merge, or discard this patch.
core/libraries/rest_api/Model_Version_Info.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     /**
93 93
      * Model_Version_Info constructor.
94 94
      *
95
-     * @param array $requested_version
95
+     * @param string $requested_version
96 96
      */
97 97
     public function __construct( $requested_version ) {
98 98
 		$this->_requested_version = $requested_version;
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
 
92
-    /**
93
-     * Model_Version_Info constructor.
94
-     *
95
-     * @param array $requested_version
96
-     */
97
-    public function __construct( $requested_version ) {
92
+	/**
93
+	 * Model_Version_Info constructor.
94
+	 *
95
+	 * @param array $requested_version
96
+	 */
97
+	public function __construct( $requested_version ) {
98 98
 		$this->_requested_version = $requested_version;
99 99
 		$this->_model_changes = array(
100 100
 			'4.8.29' => array(
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 				}
210 210
 			}
211 211
 			$this->_cached_models_for_requested_version = apply_filters(
212
-			    'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',
213
-                $all_models_in_current_version,
214
-                $this
215
-            );
212
+				'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',
213
+				$all_models_in_current_version,
214
+				$this
215
+			);
216 216
 		}
217 217
 		return $this->_cached_models_for_requested_version;
218 218
 	}
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @param array $requested_version
96 96
      */
97
-    public function __construct( $requested_version ) {
97
+    public function __construct($requested_version) {
98 98
 		$this->_requested_version = $requested_version;
99 99
 		$this->_model_changes = array(
100 100
 			'4.8.29' => array(
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 			'table_column' => 'N/A',
117 117
 			'always_available' => true,
118 118
 		);
119
-		foreach( $this->_resource_changes as $version => $model_classnames ) {
120
-			foreach( $model_classnames as $model_classname => $extra_fields ) {
121
-				foreach( $extra_fields as $fieldname => $field_data ) {
122
-					$this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname;
123
-					foreach( $defaults as $attribute => $default_value ) {
124
-						if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) {
125
-							$this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value;
119
+		foreach ($this->_resource_changes as $version => $model_classnames) {
120
+			foreach ($model_classnames as $model_classname => $extra_fields) {
121
+				foreach ($extra_fields as $fieldname => $field_data) {
122
+					$this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname;
123
+					foreach ($defaults as $attribute => $default_value) {
124
+						if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) {
125
+							$this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value;
126 126
 						}
127 127
 					}
128 128
 				}
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	 * @return array
139 139
 	 */
140 140
 	public function model_changes_between_requested_version_and_current() {
141
-		if( $this->_cached_model_changes_between_requested_version_and_current === null ) {
141
+		if ($this->_cached_model_changes_between_requested_version_and_current === null) {
142 142
 			$model_changes = array();
143
-			foreach( $this->model_changes() as $version => $models_changed_in_version ) {
144
-				if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) {
145
-					$model_changes[ $version ] = $models_changed_in_version;
143
+			foreach ($this->model_changes() as $version => $models_changed_in_version) {
144
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
145
+					$model_changes[$version] = $models_changed_in_version;
146 146
 				}
147 147
 			}
148 148
 			$this->_cached_model_changes_between_requested_version_and_current = $model_changes;
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 * @return array
159 159
 	 */
160 160
 	public function resource_changes_between_requested_version_and_current() {
161
-		if( $this->_cached_resource_changes_between_requested_version_and_current === null ) {
161
+		if ($this->_cached_resource_changes_between_requested_version_and_current === null) {
162 162
 			$resource_changes = array();
163
-			foreach( $this->resource_changes() as $version => $model_classnames ) {
164
-				if( $version <= \EED_Core_Rest_Api::core_version()  && $version > $this->requested_version()  ) {
165
-					$resource_changes[ $version ] = $model_classnames;
163
+			foreach ($this->resource_changes() as $version => $model_classnames) {
164
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
165
+					$resource_changes[$version] = $model_classnames;
166 166
 				}
167 167
 			}
168 168
 			$this->_cached_resource_changes_between_requested_version_and_current = $resource_changes;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7'
175 175
 	 * @return string like '4.6'
176 176
 	 */
177
-	public function requested_version(){
177
+	public function requested_version() {
178 178
 		return $this->_requested_version;
179 179
 	}
180 180
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * If a version is missing then we don't know anything about what changes it introduced from the previous version
189 189
 	 * @return array
190 190
 	 */
191
-	public function model_changes(){
191
+	public function model_changes() {
192 192
 		return $this->_model_changes;
193 193
 	}
194 194
 
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 	 * @return array keys are model names, values are their classname
200 200
 	 */
201 201
 	public function models_for_requested_version() {
202
-		if( $this->_cached_models_for_requested_version === null ) {
202
+		if ($this->_cached_models_for_requested_version === null) {
203 203
 			$all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models;
204
-			foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) {
205
-				foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) {
206
-					if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) {
207
-						unset( $all_models_in_current_version[ $model_name ] );
204
+			foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) {
205
+				foreach ($models_changed as $model_name => $new_indicator_or_fields_added) {
206
+					if ($new_indicator_or_fields_added === Model_Version_Info::model_added) {
207
+						unset($all_models_in_current_version[$model_name]);
208 208
 					}
209 209
 				}
210 210
 			}
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	 * @param string $model_name eg 'Event'
228 228
 	 * @return boolean
229 229
 	 */
230
-	public function is_model_name_in_this_version( $model_name ) {
230
+	public function is_model_name_in_this_version($model_name) {
231 231
 		$model_names = $this->models_for_requested_version();
232
-		if( isset( $model_names[ $model_name ] ) ) {
232
+		if (isset($model_names[$model_name])) {
233 233
 			return true;
234
-		}else{
234
+		} else {
235 235
 			return false;
236 236
 		}
237 237
 	}
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	 * @return \EEM_Base
247 247
 	 * @throws \EE_Error
248 248
 	 */
249
-	public function load_model( $model_name ) {
250
-		if( $this->is_model_name_in_this_version( $model_name ) ) {
251
-			return \EE_Registry::instance()->load_model( $model_name );
252
-		}else{
249
+	public function load_model($model_name) {
250
+		if ($this->is_model_name_in_this_version($model_name)) {
251
+			return \EE_Registry::instance()->load_model($model_name);
252
+		} else {
253 253
 			throw new \EE_Error(
254 254
 				sprintf(
255 255
 					__(
@@ -271,21 +271,21 @@  discard block
 block discarded – undo
271 271
 	 * @param \EEM_Base $model
272 272
 	 * @return array|\EE_Model_Field_Base[]
273 273
 	 */
274
-	public function fields_on_model_in_this_version( $model ) {
275
-		if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) {
274
+	public function fields_on_model_in_this_version($model) {
275
+		if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) {
276 276
 			//get all model changes between the requested version and current core version
277 277
 			$changes = $this->model_changes_between_requested_version_and_current();
278 278
 			//fetch all fields currently on this model
279 279
 			$current_fields = $model->field_settings();
280 280
 			//remove all fields that have been added since
281
-			foreach( $changes as $version => $changes_in_version ) {
282
-				if(
283
-					isset( $changes_in_version[ $model->get_this_model_name() ] )
284
-					&& $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added
281
+			foreach ($changes as $version => $changes_in_version) {
282
+				if (
283
+					isset($changes_in_version[$model->get_this_model_name()])
284
+					&& $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added
285 285
 				) {
286 286
 					$current_fields = array_diff_key(
287 287
 						$current_fields,
288
-						array_flip( $changes_in_version[ $model->get_this_model_name() ] )
288
+						array_flip($changes_in_version[$model->get_this_model_name()])
289 289
 					);
290 290
 				}
291 291
 			}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 * @param array $classnames
304 304
 	 * @return boolean
305 305
 	 */
306
-	public function is_subclass_of_one( $object, $classnames ) {
307
-		foreach( $classnames as $classname ) {
308
-			if( is_a( $object, $classname ) ) {
306
+	public function is_subclass_of_one($object, $classnames) {
307
+		foreach ($classnames as $classname) {
308
+			if (is_a($object, $classname)) {
309 309
 				return true;
310 310
 			}
311 311
 		}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 	 * Returns the list of model field classes that that the API basically ignores
317 317
 	 * @return array
318 318
 	 */
319
-	public function fields_ignored(){
319
+	public function fields_ignored() {
320 320
 		return apply_filters(
321 321
 			'FHEE__Controller_Model_Read_fields_ignored',
322
-			array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' )
322
+			array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field')
323 323
 		);
324 324
 	}
325 325
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param EE_Model_Field_Base
329 329
 	 * @return boolean
330 330
 	 */
331
-	public function field_is_ignored( $field_obj ){
332
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() );
331
+	public function field_is_ignored($field_obj) {
332
+		 return $this->is_subclass_of_one($field_obj, $this->fields_ignored());
333 333
 	}
334 334
 
335 335
 	/**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function fields_that_have_rendered_format() {
341 341
 		return apply_filters(
342 342
 			'FHEE__Controller_Model_Read__fields_raw',
343
-			array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' )
343
+			array('EE_Post_Content_Field', 'EE_Full_HTML_Field')
344 344
 		);
345 345
 	}
346 346
 
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 	 * @param EE_Model_Field_Base
350 350
 	 * @return boolean
351 351
 	 */
352
-	public function field_has_rendered_format( $field_obj ){
353
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() );
352
+	public function field_has_rendered_format($field_obj) {
353
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format());
354 354
 	}
355 355
 
356 356
 	/**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	public function fields_that_have_pretty_format() {
363 363
 		return apply_filters(
364 364
 			'FHEE__Controller_Model_Read__fields_pretty',
365
-			array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' )
365
+			array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field')
366 366
 		);
367 367
 	}
368 368
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param EE_Model_Field_Base
372 372
 	 * @return boolean
373 373
 	 */
374
-	public function field_has_pretty_format( $field_obj ){
375
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() );
374
+	public function field_has_pretty_format($field_obj) {
375
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format());
376 376
 	}
377 377
 
378 378
 	/**
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @param \EEM_Base $model
390 390
 	 * @return array
391 391
 	 */
392
-	public function extra_resource_properties_for_model( $model ) {
392
+	public function extra_resource_properties_for_model($model) {
393 393
 		$extra_properties = array();
394
-		foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) {
395
-			foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) {
396
-				if( is_subclass_of( $model, $model_classname ) ) {
397
-					$extra_properties = array_merge( $extra_properties, $properties_added_in_this_version );
394
+		foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) {
395
+			foreach ($model_classnames as $model_classname => $properties_added_in_this_version) {
396
+				if (is_subclass_of($model, $model_classname)) {
397
+					$extra_properties = array_merge($extra_properties, $properties_added_in_this_version);
398 398
 				}
399 399
 			}
400 400
 		}
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	 * @param \EEM_Base $model
408 408
 	 * @return \EE_Model_Relation_Base[]
409 409
 	 */
410
-	public function relation_settings( \EEM_Base $model ) {
410
+	public function relation_settings(\EEM_Base $model) {
411 411
 		$relations = array();
412
-		foreach( $model->relation_settings() as $relation_name => $relation_obj ) {
413
-			if( $this->is_model_name_in_this_version(  $relation_name ) ) {
414
-				$relations[ $relation_name ] = $relation_obj;
412
+		foreach ($model->relation_settings() as $relation_name => $relation_obj) {
413
+			if ($this->is_model_name_in_this_version($relation_name)) {
414
+				$relations[$relation_name] = $relation_obj;
415 415
 			}
416 416
 		}
417 417
 		//filter the results, but use the old filter name
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  */
33 33
 
34 34
 if ( ! class_exists( 'WP_List_Table' )) {
35
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
35
+	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
36 36
 }
37 37
 
38 38
 abstract class EE_Admin_List_Table extends WP_List_Table {
@@ -771,19 +771,19 @@  discard block
 block discarded – undo
771 771
 		$action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';
772 772
 		$action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';
773 773
 		$content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';
774
-        try {
775
-            $content .= apply_filters(
776
-                'FHEE__EE_Admin_List_Table___action_string__action_items',
777
-                $action_items,
778
-                $item,
779
-                $this
780
-            );
781
-        } catch (\Exception $e) {
782
-            if (WP_DEBUG) {
783
-                \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
784
-            }
785
-            $content .= $action_items;
786
-        }
774
+		try {
775
+			$content .= apply_filters(
776
+				'FHEE__EE_Admin_List_Table___action_string__action_items',
777
+				$action_items,
778
+				$item,
779
+				$this
780
+			);
781
+		} catch (\Exception $e) {
782
+			if (WP_DEBUG) {
783
+				\EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
784
+			}
785
+			$content .= $action_items;
786
+		}
787 787
 		$content .= ! empty( $action_container ) ? '</' . $action_container . '>' : '';
788 788
 		return $content;
789 789
 	}
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
  * ------------------------------------------------------------------------
32 32
  */
33 33
 
34
-if ( ! class_exists( 'WP_List_Table' )) {
35
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
34
+if ( ! class_exists('WP_List_Table')) {
35
+    require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');
36 36
 }
37 37
 
38 38
 abstract class EE_Admin_List_Table extends WP_List_Table {
@@ -244,16 +244,16 @@  discard block
 block discarded – undo
244 244
 	 * constructor
245 245
 	 * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table.
246 246
 	 */
247
-	public function __construct( EE_Admin_Page $admin_page ) {
247
+	public function __construct(EE_Admin_Page $admin_page) {
248 248
 		$this->_admin_page = $admin_page;
249 249
 		$this->_req_data = $this->_admin_page->get_request_data();
250 250
 		$this->_view = $this->_admin_page->get_view();
251
-		$this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
251
+		$this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
252 252
 		$this->_current_page = $this->get_pagenum();
253
-		$this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
254
-		$this->_yes_no = array(  __('No', 'event_espresso'), __('Yes', 'event_espresso'));
253
+		$this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();
254
+		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
255 255
 
256
-		$this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 );
256
+		$this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10);
257 257
 
258 258
 		$this->_setup_data();
259 259
 		$this->_add_view_counts();
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		$this->_set_properties();
264 264
 
265 265
 		//set primary column
266
-		add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) );
266
+		add_filter('list_table_primary_column', array($this, 'set_primary_column'));
267 267
 
268 268
 		//set parent defaults
269 269
 		parent::__construct($this->_wp_list_args);
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
 	 * @return string
340 340
 	 */
341 341
 	protected function _get_hidden_fields() {
342
-		$action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : '';
343
-		$action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action;
342
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
343
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
344 344
 		//if action is STILL empty, then we set it to default
345
-		$action = empty( $action ) ? 'default' : $action;
346
-		$field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
347
-		$field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/
348
-		$field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
345
+		$action = empty($action) ? 'default' : $action;
346
+		$field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";
347
+		$field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/
348
+		$field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";
349 349
 
350 350
 		$bulk_actions = $this->_get_bulk_actions();
351
-		foreach ( $bulk_actions as $bulk_action => $label ) {
352
-			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce  ( $bulk_action . '_nonce' ) . '" />' . "\n";
351
+		foreach ($bulk_actions as $bulk_action => $label) {
352
+			$field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";
353 353
 		}
354 354
 
355 355
 		return $field;
@@ -379,15 +379,15 @@  discard block
 block discarded – undo
379 379
 		 *
380 380
 		 * @var array
381 381
 		 */
382
-		$_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen );
382
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
383 383
 
384 384
 		$sortable = array();
385
-		foreach ( $_sortable as $id => $data ) {
386
-			if ( empty( $data ) )
385
+		foreach ($_sortable as $id => $data) {
386
+			if (empty($data))
387 387
 				continue;
388 388
 
389 389
 			//fix for offset errors with WP_List_Table default get_columninfo()
390
-			if ( is_array($data) ) {
390
+			if (is_array($data)) {
391 391
 				$_data[0] = key($data);
392 392
 				$_data[1] = isset($data[1]) ? $data[1] : false;
393 393
 			} else {
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
 
397 397
 			$data = (array) $data;
398 398
 
399
-			if ( !isset( $data[1] ) )
399
+			if ( ! isset($data[1]))
400 400
 				$_data[1] = false;
401 401
 
402 402
 
403 403
 			$sortable[$id] = $_data;
404 404
 		}
405 405
 		$primary = $this->get_primary_column_name();
406
-		$this->_column_headers = array( $columns, $hidden, $sortable, $primary );
406
+		$this->_column_headers = array($columns, $hidden, $sortable, $primary);
407 407
 	}
408 408
 
409 409
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 	 * @return string
413 413
 	 */
414 414
 	protected function get_primary_column_name() {
415
-		foreach( class_parents( $this ) as $parent ) {
416
-			if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) {
415
+		foreach (class_parents($this) as $parent) {
416
+			if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') {
417 417
 				return parent::get_primary_column_name();
418 418
 			}
419 419
 		}
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
 	 * @param string $primary
431 431
 	 * @return string
432 432
 	 */
433
-	protected function handle_row_actions( $item, $column_name, $primary ) {
434
-		foreach( class_parents( $this ) as $parent ) {
435
-			if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) {
436
-				return parent::handle_row_actions( $item, $column_name, $primary );
433
+	protected function handle_row_actions($item, $column_name, $primary) {
434
+		foreach (class_parents($this) as $parent) {
435
+			if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') {
436
+				return parent::handle_row_actions($item, $column_name, $primary);
437 437
 			}
438 438
 		}
439 439
 		return '';
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	protected function _get_bulk_actions() {
452 452
 		$actions = array();
453 453
 		//the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table();
454
-		foreach ( $this->_views as $view => $args) {
455
-			if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view )
454
+		foreach ($this->_views as $view => $args) {
455
+			if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view)
456 456
 				//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
457
-				foreach ( $args['bulk_action'] as $route =>$label ) {
458
-					if ( $this->_admin_page->check_user_access( $route, true ) ) {
457
+				foreach ($args['bulk_action'] as $route =>$label) {
458
+					if ($this->_admin_page->check_user_access($route, true)) {
459 459
 						$actions[$route] = $label;
460 460
 					}
461 461
 				}
@@ -473,18 +473,18 @@  discard block
 block discarded – undo
473 473
 	 */
474 474
 	private function _filters() {
475 475
 		$classname = get_class($this);
476
-		$filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen );
476
+		$filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen);
477 477
 
478
-		if ( empty( $filters )) {
478
+		if (empty($filters)) {
479 479
 			return;
480 480
 		}
481
-		foreach ( $filters as $filter ) {
481
+		foreach ($filters as $filter) {
482 482
 			echo $filter;
483 483
 		}
484 484
 		//add filter button at end
485
-		echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />';
485
+		echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />';
486 486
 		//add reset filters button at end
487
-		echo '<a class="button button-secondary"  href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>';
487
+		echo '<a class="button button-secondary"  href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>';
488 488
 	}
489 489
 
490 490
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 * @param string $column_name
499 499
 	 * @return string
500 500
 	 */
501
-	public function set_primary_column( $column_name ) {
502
-		return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name;
501
+	public function set_primary_column($column_name) {
502
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
503 503
 	}
504 504
 
505 505
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			array(
519 519
 				'total_items' => $total_items,
520 520
 				'per_page' => $this->_per_page,
521
-				'total_pages' => ceil($total_items / $this->_per_page )
521
+				'total_pages' => ceil($total_items / $this->_per_page)
522 522
 			)
523 523
 		);
524 524
 	}
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 *
535 535
 	 * @return string html content for the column
536 536
 	 */
537
-	public function column_default( $item, $column_name ) {
537
+	public function column_default($item, $column_name) {
538 538
 		/**
539 539
 		 * Dynamic hook allowing for adding additional column content in this list table.
540 540
 		 * Note that $this->screen->id is in the format
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		 * hook prefix ("event-espresso") will be different.
545 545
 		 *
546 546
 		 */
547
-		do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen );
547
+		do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen);
548 548
 	}
549 549
 
550 550
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		 *
561 561
 		 * @var array
562 562
 		 */
563
-		$columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen );
563
+		$columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen);
564 564
 		return $columns;
565 565
 	}
566 566
 
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
 		$views = $this->get_views();
573 573
 		$assembled_views = '';
574 574
 
575
-		if ( empty( $views )) {
575
+		if (empty($views)) {
576 576
 			return;
577 577
 		}
578 578
 		echo "<ul class='subsubsub'>\n";
579
-		foreach ( $views as $view ) {
580
-			$count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] )  : 0;
581
-			if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) {
582
-				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>';
579
+		foreach ($views as $view) {
580
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
581
+			if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) {
582
+				$assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>';
583 583
 			}
584 584
 		}
585 585
 
586
-		echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : '';
586
+		echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : '';
587 587
 		echo "</ul>";
588 588
 	}
589 589
 
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
 	 *
597 597
 	 * @param object $item The current item
598 598
 	 */
599
-	public function single_row( $item ) {
600
-		$row_class = $this->_get_row_class( $item );
601
-		echo '<tr class="' . esc_attr( $row_class ) . '">';
602
-		$this->single_row_columns( $item );
599
+	public function single_row($item) {
600
+		$row_class = $this->_get_row_class($item);
601
+		echo '<tr class="'.esc_attr($row_class).'">';
602
+		$this->single_row_columns($item);
603 603
 		echo '</tr>';
604 604
 	}
605 605
 
@@ -610,13 +610,13 @@  discard block
 block discarded – undo
610 610
 	 * @param  object $item the current item
611 611
 	 * @return string
612 612
 	 */
613
-	protected function _get_row_class( $item ) {
613
+	protected function _get_row_class($item) {
614 614
 		static $row_class = '';
615
-		$row_class = ( $row_class == '' ? 'alternate' : '' );
615
+		$row_class = ($row_class == '' ? 'alternate' : '');
616 616
 
617 617
 		$new_row_class = $row_class;
618 618
 
619
-		if ( !empty($this->_ajax_sorting_callback) ) {
619
+		if ( ! empty($this->_ajax_sorting_callback)) {
620 620
 			$new_row_class .= ' rowsortable';
621 621
 		}
622 622
 
@@ -635,13 +635,13 @@  discard block
 block discarded – undo
635 635
 
636 636
 	public function get_hidden_columns() {
637 637
 		$user_id = get_current_user_id();
638
-		$has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id);
639
-		if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) {
640
-			update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE);
641
-			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE );
638
+		$has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id);
639
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
640
+			update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE);
641
+			update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE);
642 642
 		}
643
-		$ref = 'manage' . $this->screen->id . 'columnshidden';
644
-		$saved_columns = (array) get_user_option( $ref, $user_id );
643
+		$ref = 'manage'.$this->screen->id.'columnshidden';
644
+		$saved_columns = (array) get_user_option($ref, $user_id);
645 645
 		return $saved_columns;
646 646
 	}
647 647
 
@@ -656,47 +656,47 @@  discard block
 block discarded – undo
656 656
 	 *
657 657
 	 * @param object $item The current item
658 658
 	 */
659
-	public function single_row_columns( $item ) {
660
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
659
+	public function single_row_columns($item) {
660
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
661 661
 
662 662
 		global $wp_version;
663
-		$use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' );
663
+		$use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
664 664
 
665
-		foreach ( $columns as $column_name => $column_display_name ) {
665
+		foreach ($columns as $column_name => $column_display_name) {
666 666
 
667 667
 			/**
668 668
 			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are
669 669
 			 * hidden or not instead of using "display:none;".  This bit of code provides backward compat.
670 670
 			 */
671
-			$hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : '';
672
-			$style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : '';
671
+			$hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
672
+			$style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
673 673
 
674
-			$classes = $column_name . ' column-' . $column_name.$hidden_class;
675
-			if ( $primary == $column_name ) {
674
+			$classes = $column_name.' column-'.$column_name.$hidden_class;
675
+			if ($primary == $column_name) {
676 676
 				$classes .= ' has-row-actions column-primary';
677 677
 			}
678 678
 
679
-			$data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
679
+			$data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';
680 680
 
681 681
 			$class = "class='$classes'";
682 682
 
683 683
 			$attributes = "$class$style$data";
684 684
 
685
-			if ( 'cb' === $column_name ) {
685
+			if ('cb' === $column_name) {
686 686
 				echo '<th scope="row" class="check-column">';
687
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
687
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this);
688 688
 				echo '</th>';
689 689
 			}
690
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
690
+			elseif (method_exists($this, 'column_'.$column_name)) {
691 691
 				echo "<td $attributes>";
692
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
693
-				echo $this->handle_row_actions( $item, $column_name, $primary );
692
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this);
693
+				echo $this->handle_row_actions($item, $column_name, $primary);
694 694
 				echo "</td>";
695 695
 			}
696 696
 			else {
697 697
 				echo "<td $attributes>";
698
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
699
-				echo $this->handle_row_actions( $item, $column_name, $primary );
698
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this);
699
+				echo $this->handle_row_actions($item, $column_name, $primary);
700 700
 				echo "</td>";
701 701
 			}
702 702
 		}
@@ -704,19 +704,19 @@  discard block
 block discarded – undo
704 704
 
705 705
 
706 706
 
707
-	public function extra_tablenav( $which ) {
708
-		if ( $which == 'top' ) {
707
+	public function extra_tablenav($which) {
708
+		if ($which == 'top') {
709 709
 			$this->_filters();
710 710
 			echo $this->_get_hidden_fields();
711 711
 			echo '<br class="clear">';
712
-		}else{
712
+		} else {
713 713
 			echo '<div class="list-table-bottom-buttons alignleft actions">';
714
-			foreach($this->_bottom_buttons as $type => $action){
715
-				$route = isset( $action['route'] ) ? $action['route'] : '';
716
-				$extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : '';
714
+			foreach ($this->_bottom_buttons as $type => $action) {
715
+				$route = isset($action['route']) ? $action['route'] : '';
716
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
717 717
 				echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request);
718 718
 			}
719
-			do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen );
719
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
720 720
 			echo '</div>';
721 721
 		}
722 722
 		//echo $this->_entries_per_page_dropdown;
@@ -766,11 +766,11 @@  discard block
 block discarded – undo
766 766
 	 *
767 767
 	 * @return string The assembled action elements container.
768 768
 	 */
769
-	protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) {
769
+	protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') {
770 770
 		$content = '';
771
-		$action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';
772
-		$action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';
773
-		$content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';
771
+		$action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';
772
+		$action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';
773
+		$content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';
774 774
         try {
775 775
             $content .= apply_filters(
776 776
                 'FHEE__EE_Admin_List_Table___action_string__action_items',
@@ -780,11 +780,11 @@  discard block
 block discarded – undo
780 780
             );
781 781
         } catch (\Exception $e) {
782 782
             if (WP_DEBUG) {
783
-                \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
783
+                \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
784 784
             }
785 785
             $content .= $action_items;
786 786
         }
787
-		$content .= ! empty( $action_container ) ? '</' . $action_container . '>' : '';
787
+		$content .= ! empty($action_container) ? '</'.$action_container.'>' : '';
788 788
 		return $content;
789 789
 	}
790 790
 }
Please login to merge, or discard this patch.
core/EE_Capabilities.core.php 2 patches
Indentation   +19 added lines, -20 removed lines patch added patch discarded remove patch
@@ -113,7 +113,6 @@  discard block
 block discarded – undo
113 113
 
114 114
 	/**
115 115
 	 * This sets the meta caps property.
116
-
117 116
 	 * @since 4.5.0
118 117
 	 *
119 118
 	 * @return void
@@ -227,7 +226,7 @@  discard block
 block discarded – undo
227 226
 			 * capability mapping which will be used for accessing payment methods owned by
228 227
 			 * other users.  This is not fully implemented yet in the payment method ui.
229 228
 			 * Currently only the "plural" caps are in active use. (Specific payment method caps are in use as well).
230
-			**/
229
+			 **/
231 230
 				'ee_manage_gateways',
232 231
 				'ee_read_payment_method',
233 232
 				'ee_read_payment_methods',
@@ -739,15 +738,15 @@  discard block
 block discarded – undo
739 738
 				}
740 739
 			}
741 740
 		} else {
742
-            //not a cpt object so handled differently
743
-            $has_cap = false;
744
-            try {
745
-                $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
746
-            } catch (Exception $e) {
747
-                if (WP_DEBUG) {
748
-                    EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
749
-                }
750
-            }
741
+			//not a cpt object so handled differently
742
+			$has_cap = false;
743
+			try {
744
+				$has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
745
+			} catch (Exception $e) {
746
+				if (WP_DEBUG) {
747
+					EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
748
+				}
749
+			}
751 750
 			if ($has_cap) {
752 751
 				$caps[] = $cap;
753 752
 			} else {
@@ -854,15 +853,15 @@  discard block
 block discarded – undo
854 853
 				$caps[] = $cap;
855 854
 			}
856 855
 		} else {
857
-            //not a cpt object so handled differently
858
-            $has_cap = false;
859
-            try {
860
-                $has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
861
-            } catch (Exception $e) {
862
-                if (WP_DEBUG) {
863
-                    EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
864
-                }
865
-            }
856
+			//not a cpt object so handled differently
857
+			$has_cap = false;
858
+			try {
859
+				$has_cap = method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user();
860
+			} catch (Exception $e) {
861
+				if (WP_DEBUG) {
862
+					EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
863
+				}
864
+			}
866 865
 			if ($has_cap) {
867 866
 				$caps[] = $cap;
868 867
 			} elseif ( ! empty( $this->private_cap ) ) {
Please login to merge, or discard this patch.
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * @package Event Espresso
8 8
  * @subpackage core, capabilities
9 9
  */
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'No direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public static function instance() {
73 73
 		//check if instantiated, and if not do so.
74
-		if ( ! self::$_instance instanceof EE_Capabilities ) {
74
+		if ( ! self::$_instance instanceof EE_Capabilities) {
75 75
 			self::$_instance = new self();
76 76
 		}
77 77
 		return self::$_instance;
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 * @since 4.5.0
101 101
 	 * @return void
102 102
 	 */
103
-	public function init_caps( $reset = false ) {
104
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
103
+	public function init_caps($reset = false) {
104
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
105 105
 			$this->_caps_map = $this->_init_caps_map();
106
-			$this->init_role_caps( $reset );
106
+			$this->init_role_caps($reset);
107 107
 			$this->_set_meta_caps();
108 108
 		}
109 109
 	}
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 		//make sure we're only ever initializing the default _meta_caps array once if it's empty.
123 123
 		$this->_meta_caps = $this->_get_default_meta_caps_array();
124 124
 
125
-		$this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps );
125
+		$this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps);
126 126
 
127 127
 		//add filter for map_meta_caps but only if models can query.
128
-		if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) {
129
-			add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 );
128
+		if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) {
129
+			add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4);
130 130
 		}
131 131
 	}
132 132
 
@@ -139,37 +139,37 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	private function _get_default_meta_caps_array() {
141 141
 		static $default_meta_caps = array();
142
-		if ( empty( $default_meta_caps ) ) {
142
+		if (empty($default_meta_caps)) {
143 143
 			$default_meta_caps = array(
144 144
 				//edits
145
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ),
146
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ),
147
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ),
148
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ),
149
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ),
150
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ),
151
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ),
152
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ),
153
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ),
145
+				new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')),
146
+				new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')),
147
+				new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')),
148
+				new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')),
149
+				new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')),
150
+				new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')),
151
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')),
152
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')),
153
+				new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')),
154 154
 				//reads
155
-				new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ),
156
-				new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ),
157
-				new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ),
158
-				new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ),
159
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ),
160
-				new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ),
161
-				new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ),
155
+				new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')),
156
+				new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')),
157
+				new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')),
158
+				new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')),
159
+				new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')),
160
+				new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')),
161
+				new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')),
162 162
 
163 163
 				//deletes
164
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ),
165
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ),
166
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ),
167
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ),
168
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ),
169
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ),
170
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ),
171
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ),
172
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ),
164
+				new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')),
165
+				new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')),
166
+				new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')),
167
+				new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')),
168
+				new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')),
169
+				new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')),
170
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')),
171
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')),
172
+				new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')),
173 173
 			);
174 174
 		}
175 175
 		return $default_meta_caps;
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return array   actual users capabilities
195 195
 	 */
196
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
196
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
197 197
 		//loop through our _meta_caps array
198
-		foreach ( $this->_meta_caps as $meta_map ) {
199
-			if ( ! $meta_map instanceof EE_Meta_Capability_Map ) {
198
+		foreach ($this->_meta_caps as $meta_map) {
199
+			if ( ! $meta_map instanceof EE_Meta_Capability_Map) {
200 200
 				continue;
201 201
 			}
202 202
 			$meta_map->ensure_is_model();
203 203
 
204
-			$caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args );
204
+			$caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args);
205 205
 		}
206 206
 		return $caps;
207 207
 	}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 			)
529 529
 		);
530 530
 
531
-		$caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps );
531
+		$caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps);
532 532
 		return $caps;
533 533
 	}
534 534
 
@@ -545,27 +545,27 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * @return void
547 547
 	 */
548
-	public function init_role_caps( $reset = false, $custom_map = array() ) {
548
+	public function init_role_caps($reset = false, $custom_map = array()) {
549 549
 
550
-		$caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map;
550
+		$caps_map = empty($custom_map) ? $this->_caps_map : $custom_map;
551 551
 
552 552
 		//first let's determine if these caps have already been set.
553
-		$caps_set_before = get_option( self::option_name, array() );
553
+		$caps_set_before = get_option(self::option_name, array());
554 554
 		//if not reset, see what caps are new for each role. if they're new, add them.
555
-		foreach ( $caps_map as $role => $caps_for_role ) {
556
-			foreach ( $caps_for_role as $cap ) {
555
+		foreach ($caps_map as $role => $caps_for_role) {
556
+			foreach ($caps_for_role as $cap) {
557 557
 				//first check we haven't already added this cap before, or it's a reset
558
-				if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) {
559
-					if ( $this->add_cap_to_role( $role, $cap ) ) {
560
-						$caps_set_before[ $role ][] = $cap;
558
+				if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) {
559
+					if ($this->add_cap_to_role($role, $cap)) {
560
+						$caps_set_before[$role][] = $cap;
561 561
 					}
562 562
 				}
563 563
 			}
564 564
 		}
565 565
 
566 566
 		//now let's just save the cap that has been set.
567
-		update_option( self::option_name, $caps_set_before );
568
-		do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before );
567
+		update_option(self::option_name, $caps_set_before);
568
+		do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before);
569 569
 	}
570 570
 
571 571
 
@@ -584,20 +584,20 @@  discard block
 block discarded – undo
584 584
 	 * @param bool $grant  Whether to grant access to this cap on this role.
585 585
 	 * @return bool
586 586
 	 */
587
-	public function add_cap_to_role( $role, $cap, $grant = true ) {
588
-		$role_object = get_role( $role );
587
+	public function add_cap_to_role($role, $cap, $grant = true) {
588
+		$role_object = get_role($role);
589 589
 		//if the role isn't available then we create it.
590
-		if ( ! $role_object instanceof WP_Role ) {
590
+		if ( ! $role_object instanceof WP_Role) {
591 591
 			//if a plugin wants to create a specific role name then they should create the role before
592 592
 			//EE_Capabilities does.  Otherwise this function will create the role name from the slug:
593 593
 			// - removes any `ee_` namespacing from the start of the slug.
594 594
 			// - replaces `_` with ` ` (empty space).
595 595
 			// - sentence case on the resulting string.
596
-			$role_label = ucwords( str_replace( '_', ' ', str_replace( 'ee_', '', $role ) ) );
597
-			$role_object = add_role( $role, $role_label );
596
+			$role_label = ucwords(str_replace('_', ' ', str_replace('ee_', '', $role)));
597
+			$role_object = add_role($role, $role_label);
598 598
 		}
599
-		if ( $role_object instanceof WP_Role ) {
600
-			$role_object->add_cap( $cap, $grant );
599
+		if ($role_object instanceof WP_Role) {
600
+			$role_object->add_cap($cap, $grant);
601 601
 			return true;
602 602
 		}
603 603
 		return false;
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 	 *
620 620
 	 * @return void
621 621
 	 */
622
-	public function remove_cap_from_role( $role, $cap ) {
623
-		$role = get_role( $role );
624
-		if ( $role instanceof WP_Role ) {
625
-			$role->remove_cap( $cap );
622
+	public function remove_cap_from_role($role, $cap) {
623
+		$role = get_role($role);
624
+		if ($role instanceof WP_Role) {
625
+			$role->remove_cap($cap);
626 626
 		}
627 627
 	}
628 628
 
@@ -643,11 +643,11 @@  discard block
 block discarded – undo
643 643
 	 *
644 644
 	 * @return bool  Whether user can or not.
645 645
 	 */
646
-	public function current_user_can( $cap, $context, $id = 0 ) {
646
+	public function current_user_can($cap, $context, $id = 0) {
647 647
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
648
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context,  $cap, $id );
649
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id );
650
-		return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap );
648
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id);
649
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id);
650
+		return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap);
651 651
 	}
652 652
 
653 653
 
@@ -664,11 +664,11 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @return bool Whether user can or not.
666 666
 	 */
667
-	public function user_can( $user, $cap, $context, $id = 0 ) {
667
+	public function user_can($user, $cap, $context, $id = 0) {
668 668
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
669
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id );
670
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user,  $id );
671
-		return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap );
669
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id);
670
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id);
671
+		return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap);
672 672
 	}
673 673
 
674 674
 
@@ -688,12 +688,12 @@  discard block
 block discarded – undo
688 688
 	 *
689 689
 	 * @return bool  Whether user can or not.
690 690
 	 */
691
-	public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) {
692
-		$user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap );
691
+	public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) {
692
+		$user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap);
693 693
 
694 694
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
695
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id );
696
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id );
695
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id);
696
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id);
697 697
 		return $user_can;
698 698
 	}
699 699
 
@@ -709,12 +709,12 @@  discard block
 block discarded – undo
709 709
 	 *
710 710
 	 * @return array
711 711
 	 */
712
-	public function get_ee_capabilities( $role = 'administrator' ) {
712
+	public function get_ee_capabilities($role = 'administrator') {
713 713
 		$capabilities = $this->_init_caps_map();
714
-		if ( empty( $role ) ) {
714
+		if (empty($role)) {
715 715
 			return $capabilities;
716 716
 		}
717
-		return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array();
717
+		return isset($capabilities[$role]) ? $capabilities[$role] : array();
718 718
 	}
719 719
 }
720 720
 
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
 	 * 	}
763 763
 	 * @throws EE_Error
764 764
 	 */
765
-	public function __construct( $meta_cap, $map_values ) {
765
+	public function __construct($meta_cap, $map_values) {
766 766
 		$this->meta_cap = $meta_cap;
767 767
 		//verify there are four args in the $map_values array;
768
-		if ( count( $map_values ) !== 4 ) {
769
-			throw new EE_Error( sprintf( __( 'Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso' ), '<br>' . print_r( $map_values, true ) ) );
768
+		if (count($map_values) !== 4) {
769
+			throw new EE_Error(sprintf(__('Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso'), '<br>'.print_r($map_values, true)));
770 770
 		}
771 771
 
772 772
 		//set properties
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	/**
781 781
 	 * Makes it so this object stops filtering caps
782 782
 	 */
783
-	public function remove_filters(){
784
-		remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 );
783
+	public function remove_filters() {
784
+		remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10);
785 785
 	}
786 786
 
787 787
 
@@ -796,19 +796,19 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function ensure_is_model() {
798 798
 		//is it already instantiated?
799
-		if ( $this->_model instanceof EEM_Base ) {
799
+		if ($this->_model instanceof EEM_Base) {
800 800
 			return;
801 801
 		}
802 802
 
803 803
 		//ensure model name is string
804 804
 		$this->_model_name = (string) $this->_model_name;
805 805
 		//error proof if the name has EEM in it
806
-		$this->_model_name = str_replace( 'EEM', '', $this->_model_name );
806
+		$this->_model_name = str_replace('EEM', '', $this->_model_name);
807 807
 
808
-		$this->_model = EE_Registry::instance()->load_model( $this->_model_name );
808
+		$this->_model = EE_Registry::instance()->load_model($this->_model_name);
809 809
 
810
-		if ( ! $this->_model instanceof EEM_Base ) {
811
-			throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) );
810
+		if ( ! $this->_model instanceof EEM_Base) {
811
+			throw new EE_Error(sprintf(__('This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso'), get_class($this), $this->_model));
812 812
 		}
813 813
 	}
814 814
 
@@ -824,8 +824,8 @@  discard block
 block discarded – undo
824 824
 	 *
825 825
 	 * @return array
826 826
 	 */
827
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
828
-		return $this->_map_meta_caps( $caps, $cap, $user_id, $args );
827
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
828
+		return $this->_map_meta_caps($caps, $cap, $user_id, $args);
829 829
 	}
830 830
 
831 831
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 *
844 844
 	 * @return array   actual users capabilities
845 845
 	 */
846
-	abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args );
846
+	abstract protected function _map_meta_caps($caps, $cap, $user_id, $args);
847 847
 }
848 848
 
849 849
 
@@ -875,28 +875,28 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @return array   actual users capabilities
877 877
 	 */
878
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
878
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
879 879
 		//only process if we're checking our mapped_cap
880
-		if ( $cap !== $this->meta_cap ) {
880
+		if ($cap !== $this->meta_cap) {
881 881
 			return $caps;
882 882
 		}
883 883
 
884
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
884
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
885 885
 
886 886
 		//if no obj then let's just do cap
887
-		if ( ! $obj instanceof EE_Base_Class ) {
887
+		if ( ! $obj instanceof EE_Base_Class) {
888 888
 			$caps[] = $cap;
889 889
 			return $caps;
890 890
 		}
891 891
 
892
-		if ( $obj instanceof EE_CPT_Base ) {
892
+		if ($obj instanceof EE_CPT_Base) {
893 893
 			//if the item author is set and the user is the author...
894
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
895
-				if ( empty( $this->published_cap ) ) {
894
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
895
+				if (empty($this->published_cap)) {
896 896
 					$caps[] = $cap;
897 897
 				} else {
898 898
 					//if obj is published...
899
-					if ( $obj->status() == 'publish' ) {
899
+					if ($obj->status() == 'publish') {
900 900
 						$caps[] = $this->published_cap;
901 901
 					} else {
902 902
 						$caps[] = $cap;
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
 				}
905 905
 			} else {
906 906
 				//the user is trying to edit someone else's obj
907
-				if ( ! empty( $this->others_cap ) ) {
907
+				if ( ! empty($this->others_cap)) {
908 908
 					$caps[] = $this->others_cap;
909 909
 				}
910
-				if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) {
910
+				if ( ! empty($this->published_cap) && $obj->status() == 'publish') {
911 911
 					$caps[] = $this->published_cap;
912
-				} elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) {
912
+				} elseif ( ! empty($this->private_cap) && $obj->status() == 'private') {
913 913
 					$caps[] = $this->private_cap;
914 914
 				}
915 915
 			}
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			if ($has_cap) {
927 927
 				$caps[] = $cap;
928 928
 			} else {
929
-				if ( ! empty( $this->others_cap ) ) {
929
+				if ( ! empty($this->others_cap)) {
930 930
 					$caps[] = $this->others_cap;
931 931
 				}
932 932
 			}
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
 	 *
964 964
 	 * @return array   actual users capabilities
965 965
 	 */
966
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
967
-		return parent::_map_meta_caps( $caps, $cap, $user_id, $args );
966
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
967
+		return parent::_map_meta_caps($caps, $cap, $user_id, $args);
968 968
 	}
969 969
 }
970 970
 
@@ -996,34 +996,34 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @return array   actual users capabilities
998 998
 	 */
999
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
999
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
1000 1000
 		//only process if we're checking our mapped cap;
1001
-		if ( $cap !== $this->meta_cap ) {
1001
+		if ($cap !== $this->meta_cap) {
1002 1002
 			return $caps;
1003 1003
 		}
1004 1004
 
1005
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
1005
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
1006 1006
 
1007 1007
 		//if no obj then let's just do cap
1008
-		if ( ! $obj instanceof EE_Base_Class ) {
1008
+		if ( ! $obj instanceof EE_Base_Class) {
1009 1009
 			$caps[] = $cap;
1010 1010
 			return $caps;
1011 1011
 		}
1012 1012
 
1013
-		if ( $obj instanceof EE_CPT_Base ) {
1014
-			$status_obj = get_post_status_object( $obj->status() );
1015
-			if ( $status_obj->public ) {
1013
+		if ($obj instanceof EE_CPT_Base) {
1014
+			$status_obj = get_post_status_object($obj->status());
1015
+			if ($status_obj->public) {
1016 1016
 				$caps[] = $cap;
1017 1017
 				return $caps;
1018 1018
 			}
1019 1019
 
1020 1020
 			//if the item author is set and the user is the author...
1021
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
1021
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
1022 1022
 				$caps[] = $cap;
1023
-			} elseif ( $status_obj->private && ! empty( $this->private_cap ) ) {
1023
+			} elseif ($status_obj->private && ! empty($this->private_cap)) {
1024 1024
 				//the user is trying to view someone else's obj
1025 1025
 				$caps[] = $this->private_cap;
1026
-			} elseif ( ! empty( $this->others_cap ) ) {
1026
+			} elseif ( ! empty($this->others_cap)) {
1027 1027
 				$caps[] = $this->others_cap;
1028 1028
 			} else {
1029 1029
 				$caps[] = $cap;
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
             }
1041 1041
 			if ($has_cap) {
1042 1042
 				$caps[] = $cap;
1043
-			} elseif ( ! empty( $this->private_cap ) ) {
1043
+			} elseif ( ! empty($this->private_cap)) {
1044 1044
 				$caps[] = $this->private_cap;
1045
-			} elseif ( ! empty( $this->others_cap ) ) {
1045
+			} elseif ( ! empty($this->others_cap)) {
1046 1046
 				$caps[] = $this->others_cap;
1047 1047
 			} else {
1048 1048
 				$caps[] = $cap;
@@ -1079,30 +1079,30 @@  discard block
 block discarded – undo
1079 1079
 	 *
1080 1080
 	 * @return array   actual users capabilities
1081 1081
 	 */
1082
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
1082
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
1083 1083
 		//only process if we're checking our mapped_cap
1084
-		if ( $cap !== $this->meta_cap ) {
1084
+		if ($cap !== $this->meta_cap) {
1085 1085
 			return $caps;
1086 1086
 		}
1087 1087
 
1088
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
1088
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
1089 1089
 
1090 1090
 		//if no obj then let's just do cap
1091
-		if ( ! $obj instanceof EE_Message_Template_Group ) {
1091
+		if ( ! $obj instanceof EE_Message_Template_Group) {
1092 1092
 			$caps[] = $cap;
1093 1093
 			return $caps;
1094 1094
 		}
1095 1095
 
1096 1096
 		$is_global = $obj->is_global();
1097 1097
 
1098
-		if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
1099
-			if ( $is_global ) {
1100
-				$caps[]  = $this->private_cap;
1098
+		if ($obj->wp_user() && $user_id == $obj->wp_user()) {
1099
+			if ($is_global) {
1100
+				$caps[] = $this->private_cap;
1101 1101
 			} else {
1102 1102
 				$caps[] = $cap;
1103 1103
 			}
1104 1104
 		} else {
1105
-			if ( $is_global ) {
1105
+			if ($is_global) {
1106 1106
 				$caps[] = $this->private_cap;
1107 1107
 			} else {
1108 1108
 				$caps[] = $this->others_cap;
@@ -1140,16 +1140,16 @@  discard block
 block discarded – undo
1140 1140
 	 *
1141 1141
 	 * @return array   actual users capabilities
1142 1142
 	 */
1143
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
1143
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
1144 1144
 		//only process if we're checking our mapped_cap
1145
-		if ( $cap !== $this->meta_cap ) {
1145
+		if ($cap !== $this->meta_cap) {
1146 1146
 			return $caps;
1147 1147
 		}
1148 1148
 
1149
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
1149
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
1150 1150
 
1151 1151
 		//if no obj then let's just do cap
1152
-		if ( ! $obj instanceof EE_Base_Class ) {
1152
+		if ( ! $obj instanceof EE_Base_Class) {
1153 1153
 			$caps[] = $cap;
1154 1154
 			return $caps;
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		$is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false;
1158 1158
 		$is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system;
1159 1159
 
1160
-		if ( $is_system ) {
1160
+		if ($is_system) {
1161 1161
 			$caps[] = $this->private_cap;
1162 1162
 		} else {
1163 1163
 			$caps[] = $cap;
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -374,18 +374,18 @@  discard block
 block discarded – undo
374 374
 	 * @return string
375 375
 	 * @throws \EE_Error
376 376
 	 */
377
-    public function column_cb($item){
378
-        /** checkbox/lock **/
379
-        $transaction = $item->get_first_related( 'Transaction' );
380
-        $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
381
-	    return $payment_count > 0
382
-		    ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )
383
-		      . '<span class="ee-lock-icon"></span>'
384
-		    : sprintf(
385
-			    '<input type="checkbox" name="_REG_ID[]" value="%1$s" />',
386
-			    $item->ID()
387
-		    );
388
-    }
377
+	public function column_cb($item){
378
+		/** checkbox/lock **/
379
+		$transaction = $item->get_first_related( 'Transaction' );
380
+		$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
381
+		return $payment_count > 0
382
+			? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )
383
+			  . '<span class="ee-lock-icon"></span>'
384
+			: sprintf(
385
+				'<input type="checkbox" name="_REG_ID[]" value="%1$s" />',
386
+				$item->ID()
387
+			);
388
+	}
389 389
 
390 390
 
391 391
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 * @throws \EE_Error
399 399
 	 */
400 400
 	public function column__REG_ID(EE_Registration $item){
401
-        $attendee = $item->attendee();
401
+		$attendee = $item->attendee();
402 402
 		$content = $item->ID();
403 403
 		$content .= '<div class="show-on-mobile-view-only">';
404 404
 		$content .= '<br>';
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function column__REG_date(EE_Registration $item){
423 423
 		$this->_set_related_details($item);
424
-       		 //Build row actions
424
+	   		 //Build row actions
425 425
 		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
426 426
 		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
427 427
 		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
@@ -441,27 +441,27 @@  discard block
 block discarded – undo
441 441
 	public function column_event_name(EE_Registration $item){
442 442
 		$this->_set_related_details( $item );
443 443
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
444
-        $EVT_ID = $item->event_ID();
445
-        $event_name = $item->event_name();
446
-        $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
447
-        $event_name = wp_trim_words($event_name, 30, '...');
448
-        if ($EVT_ID) {
449
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
450
-                EVENTS_ADMIN_URL);
451
-            $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
452
-                ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>'
453
-                : $event_name;
454
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
455
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
456
-            $actions['event_filter'] .= sprintf(
457
-                esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
458
-                $event_name
459
-            );
460
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
461
-        } else {
462
-            $edit_event = $event_name;
463
-            $actions['event_filter'] = '';
464
-        }
444
+		$EVT_ID = $item->event_ID();
445
+		$event_name = $item->event_name();
446
+		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
447
+		$event_name = wp_trim_words($event_name, 30, '...');
448
+		if ($EVT_ID) {
449
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
450
+				EVENTS_ADMIN_URL);
451
+			$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
452
+				? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>'
453
+				: $event_name;
454
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
455
+			$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
456
+			$actions['event_filter'] .= sprintf(
457
+				esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
458
+				$event_name
459
+			);
460
+			$actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
461
+		} else {
462
+			$edit_event = $event_name;
463
+			$actions['event_filter'] = '';
464
+		}
465 465
 
466 466
 		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
467 467
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 		} else {
490 490
 			return __( 'There is no ticket on this registration', 'event_espresso' );
491 491
 		}
492
-    }
492
+	}
493 493
 
494 494
 
495 495
 
@@ -502,32 +502,32 @@  discard block
 block discarded – undo
502 502
 	 * @throws \EE_Error
503 503
 	 */
504 504
    	public function column_ATT_fname(EE_Registration $item){
505
-        $attendee = $item->attendee();
505
+		$attendee = $item->attendee();
506 506
 
507 507
 		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
508 508
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
509 509
 		$link = EE_Registry::instance()->CAP->current_user_can(
510
-		    'ee_read_registration',
511
-            'espresso_registrations_view_registration',
512
-            $item->ID()
513
-        )
514
-            ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>'
515
-            : $attendee_name;
510
+			'ee_read_registration',
511
+			'espresso_registrations_view_registration',
512
+			$item->ID()
513
+		)
514
+			? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>'
515
+			: $attendee_name;
516 516
 		$link .= $item->count() === 1
517
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>'
518
-            : '';
517
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>'
518
+			: '';
519 519
 
520 520
 		$t = $item->get_first_related('Transaction');
521 521
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
522 522
 
523
-	    //append group count to name
524
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
523
+		//append group count to name
524
+		$link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
525 525
 
526
-	    //append reg_code
527
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
526
+		//append reg_code
527
+		$link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
528 528
 
529
-	    //reg status text for accessibility
530
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
529
+		//reg status text for accessibility
530
+		$link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
531 531
 
532 532
 		//trash/restore/delete actions
533 533
 		$actions = array();
@@ -755,14 +755,14 @@  discard block
 block discarded – undo
755 755
 		//message list table link (filtered by REG_ID
756 756
 		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
757 757
 			$actions['filtered_messages_link'] = '<li>'
758
-			                          . EEH_MSG_Template::get_message_action_link(
758
+									  . EEH_MSG_Template::get_message_action_link(
759 759
 											'see_notifications_for',
760 760
 											null,
761 761
 											array(
762 762
 												'_REG_ID' => $item->ID()
763 763
 												)
764 764
 											)
765
-			                          . '</li>';
765
+									  . '</li>';
766 766
 		}
767 767
 		$actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this );
768 768
 		return $this->_action_string(
Please login to merge, or discard this patch.
Spacing   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @param \Registrations_Admin_Page $admin_page
56 56
 	 */
57
-	public function __construct( Registrations_Admin_Page $admin_page ){
58
-		if ( ! empty( $_GET['event_id'] ) ) {
57
+	public function __construct(Registrations_Admin_Page $admin_page) {
58
+		if ( ! empty($_GET['event_id'])) {
59 59
 			$extra_query_args = array();
60
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
61
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
60
+			foreach ($admin_page->get_views() as $key => $view_details) {
61
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
62 62
 			}
63
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
63
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
64 64
 		}
65 65
 		parent::__construct($admin_page);
66 66
 		$this->_status = $this->_admin_page->get_registration_status_array();
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @return void
76 76
 	 */
77 77
 	protected function _setup_data() {
78
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
79
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
78
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
79
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
80 80
 	}
81 81
 
82 82
 
@@ -93,30 +93,30 @@  discard block
 block discarded – undo
93 93
 			'ajax' => TRUE,
94 94
 			'screen' => $this->_admin_page->get_current_screen()->id
95 95
 			);
96
-		$ID_column_name = __( 'ID', 'event_espresso' );
96
+		$ID_column_name = __('ID', 'event_espresso');
97 97
 		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
98
-		$ID_column_name .= __( 'Registrant Name', 'event_espresso' );
98
+		$ID_column_name .= __('Registrant Name', 'event_espresso');
99 99
 		$ID_column_name .= '</span> ';
100
-		if ( isset( $_GET['event_id'] )) {
100
+		if (isset($_GET['event_id'])) {
101 101
 			$this->_columns = array(
102 102
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
103 103
 				'_REG_ID' => $ID_column_name,
104
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
104
+				'ATT_fname' => __('Name', 'event_espresso'),
105 105
 				'ATT_email' =>  __('Email', 'event_espresso'),
106
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
107
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
108
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
109
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
106
+				'_REG_date' => __('Reg Date', 'event_espresso'),
107
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
108
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
109
+				'TXN_total' => __('Total Txn', 'event_espresso'),
110 110
 				'TXN_paid' => __('Paid', 'event_espresso'),
111
-				'actions' => __( 'Actions', 'event_espresso' )
111
+				'actions' => __('Actions', 'event_espresso')
112 112
 				);
113 113
 			$this->_bottom_buttons = array(
114 114
 					'report'=> array(
115 115
 					'route' => 'registrations_report',
116 116
 					'extra_request' =>
117 117
 						array(
118
-							'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null,
119
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" )
118
+							'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
119
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}")
120 120
 						)
121 121
 				),
122 122
 			);
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 			$this->_columns = array(
125 125
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
126 126
 				'_REG_ID' => $ID_column_name,
127
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
128
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
129
-				'event_name' => __( 'Event', 'event_espresso' ),
130
-				'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
131
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
132
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
133
-				'actions' => __( 'Actions', 'event_espresso' )
127
+				'ATT_fname' => __('Name', 'event_espresso'),
128
+				'_REG_date' => __('TXN Date', 'event_espresso'),
129
+				'event_name' => __('Event', 'event_espresso'),
130
+				'DTT_EVT_start' => __('Event Date', 'event_espresso'),
131
+				'_REG_final_price' => __('Price', 'event_espresso'),
132
+				'_REG_paid' => __('Paid', 'event_espresso'),
133
+				'actions' => __('Actions', 'event_espresso')
134 134
 			);
135 135
 			$this->_bottom_buttons = array(
136 136
 				'report_all'=> array(
137 137
 				'route' => 'registrations_report',
138 138
 				'extra_request' => array(
139
-					'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) )
139
+					'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
140 140
 				),
141 141
 			);
142 142
 		}
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 		$this->_primary_column = '_REG_ID';
145 145
 
146 146
 		$this->_sortable_columns = array(
147
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
148
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
149
-			'event_name' => array( 'event_name' => FALSE ),
150
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
151
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
147
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
148
+			'ATT_fname' => array('ATT_fname' => FALSE),
149
+			'event_name' => array('event_name' => FALSE),
150
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
151
+			'_REG_ID' => array('_REG_ID' => FALSE),
152 152
 		);
153 153
 
154 154
 		$this->_hidden_columns = array();
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 	 * @param  EE_Registration $item the current item
163 163
 	 * @return string
164 164
 	 */
165
-	protected function _get_row_class( $item ) {
166
-		$class = parent::_get_row_class( $item );
165
+	protected function _get_row_class($item) {
166
+		$class = parent::_get_row_class($item);
167 167
 		//add status class
168
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
169
-		if ( $this->_has_checkbox_column ) {
168
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
169
+		if ($this->_has_checkbox_column) {
170 170
 			$class .= ' has-checkbox-column';
171 171
 		}
172 172
 		return $class;
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
 	 * @param EE_Registration $registration
181 181
 	 * @throws \EE_Error
182 182
 	 */
183
-	protected function _set_related_details( EE_Registration $registration ) {
183
+	protected function _set_related_details(EE_Registration $registration) {
184 184
 
185
-		$transaction = $registration->get_first_related( 'Transaction' );
185
+		$transaction = $registration->get_first_related('Transaction');
186 186
 		$status = $transaction instanceof EE_Transaction
187 187
 			? $transaction->status_ID()
188 188
 			: EEM_Transaction::failed_status_code;
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 			'status' => $status,
192 192
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
193 193
 			'title_attr' => sprintf(
194
-				__( 'View Transaction Details (%s)', 'event_espresso' ),
195
-				EEH_Template::pretty_status( $status, false, 'sentence' )
194
+				__('View Transaction Details (%s)', 'event_espresso'),
195
+				EEH_Template::pretty_status($status, false, 'sentence')
196 196
 			)
197 197
 		);
198 198
 
199 199
 		try {
200 200
 			$event = $registration->event();
201
-		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
201
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
202 202
 			$event = null;
203 203
 		}
204 204
 		$status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 			'status' => $status,
208 208
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
209 209
 			'title_attr' => sprintf(
210
-				__( 'Edit Event (%s)', 'event_espresso' ),
211
-				EEH_Template::pretty_status( $status, false, 'sentence' )
210
+				__('Edit Event (%s)', 'event_espresso'),
211
+				EEH_Template::pretty_status($status, false, 'sentence')
212 212
 			)
213 213
 		);
214 214
 	}
@@ -225,30 +225,30 @@  discard block
 block discarded – undo
225 225
 
226 226
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
227 227
 
228
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
229
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
230
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
228
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
229
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
230
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
231 231
 
232
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
233
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
232
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
233
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
234 234
 
235 235
 		$status = array();
236
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
237
-		foreach ( $this->_status as $key => $value ) {
238
-			$status[] = array( 'id' => $key, 'text' => $value );
236
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
237
+		foreach ($this->_status as $key => $value) {
238
+			$status[] = array('id' => $key, 'text' => $value);
239 239
 		}
240
-		if ( $this->_view !== 'incomplete' ) {
240
+		if ($this->_view !== 'incomplete') {
241 241
 			$filters[] = EEH_Form_Fields::select_input(
242 242
 				'_reg_status',
243 243
 				$status,
244
-				isset( $this->_req_data['_reg_status'] )
245
-					? strtoupper( sanitize_key( $this->_req_data['_reg_status'] ))
244
+				isset($this->_req_data['_reg_status'])
245
+					? strtoupper(sanitize_key($this->_req_data['_reg_status']))
246 246
 					: ''
247 247
 			);
248 248
 		}
249 249
 
250
-		if ( isset( $this->_req_data['event_id'] ) ) {
251
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
250
+		if (isset($this->_req_data['event_id'])) {
251
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
252 252
 		}
253 253
 
254 254
 		return $filters;
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 		$this->_views['all']['count'] = $this->_total_registrations();
268 268
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
269 269
 		$this->_views['today']['count'] = $this->_total_registrations_today();
270
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
271
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
272
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
270
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
271
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
272
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
273 273
 		}
274 274
 	}
275 275
 
@@ -283,23 +283,23 @@  discard block
 block discarded – undo
283 283
 	 * @return int
284 284
 	 * @throws \EE_Error
285 285
 	 */
286
-	protected function _total_registrations( $view = '' ){
286
+	protected function _total_registrations($view = '') {
287 287
 		$_where = array();
288
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
289
-		if( $EVT_ID ) {
288
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
289
+		if ($EVT_ID) {
290 290
 			$_where['EVT_ID'] = $EVT_ID;
291 291
 		}
292
-		switch ( $view ) {
292
+		switch ($view) {
293 293
 			case 'trash' :
294
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
294
+				return EEM_Registration::instance()->count_deleted(array($_where));
295 295
 				break;
296 296
 			case 'incomplete' :
297 297
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
298 298
 				break;
299 299
 			default :
300
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
300
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
301 301
 		}
302
-		return EEM_Registration::instance()->count( array( $_where ));
302
+		return EEM_Registration::instance()->count(array($_where));
303 303
 	}
304 304
 
305 305
 
@@ -311,32 +311,32 @@  discard block
 block discarded – undo
311 311
 	 * @return int
312 312
 	 * @throws \EE_Error
313 313
 	 */
314
-	protected function _total_registrations_this_month(){
315
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
316
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
314
+	protected function _total_registrations_this_month() {
315
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
316
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
317 317
 		$this_year_r = date('Y', current_time('timestamp'));
318 318
 		$time_start = ' 00:00:00';
319 319
 		$time_end = ' 23:59:59';
320 320
 		$this_month_r = date('m', current_time('timestamp'));
321
-		$days_this_month = date( 't', current_time('timestamp') );
321
+		$days_this_month = date('t', current_time('timestamp'));
322 322
 		//setup date query.
323 323
 		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query(
324 324
 			'REG_date',
325
-			$this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
325
+			$this_year_r.'-'.$this_month_r.'-01'.' '.$time_start,
326 326
 			'Y-m-d H:i:s'
327 327
 		);
328 328
 		$end_string = EEM_Registration::instance()->convert_datetime_for_query(
329 329
 			'REG_date',
330
-			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
330
+			$this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end,
331 331
 			'Y-m-d H:i:s'
332 332
 		);
333
-		$_where['REG_date']= array('BETWEEN',
333
+		$_where['REG_date'] = array('BETWEEN',
334 334
 			array(
335 335
 				$beginning_string,
336 336
 				$end_string
337 337
 		));
338
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
339
-		return EEM_Registration::instance()->count(array( $_where ) );
338
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
339
+		return EEM_Registration::instance()->count(array($_where));
340 340
 	}
341 341
 
342 342
 
@@ -348,20 +348,20 @@  discard block
 block discarded – undo
348 348
 	 * @return int
349 349
 	 * @throws \EE_Error
350 350
 	 */
351
-	protected function _total_registrations_today(){
351
+	protected function _total_registrations_today() {
352 352
 
353
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
354
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
353
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
354
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
355 355
 		$current_date = date('Y-m-d', current_time('timestamp'));
356 356
 		$time_start = ' 00:00:00';
357 357
 		$time_end = ' 23:59:59';
358
-		$_where['REG_date']= array('BETWEEN',
358
+		$_where['REG_date'] = array('BETWEEN',
359 359
 			array(
360
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
361
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
360
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
361
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
362 362
 		));
363
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
364
-		return EEM_Registration::instance()->count(array( $_where ) );
363
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
364
+		return EEM_Registration::instance()->count(array($_where));
365 365
 	}
366 366
 
367 367
 
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
 	 * @return string
375 375
 	 * @throws \EE_Error
376 376
 	 */
377
-    public function column_cb($item){
377
+    public function column_cb($item) {
378 378
         /** checkbox/lock **/
379
-        $transaction = $item->get_first_related( 'Transaction' );
380
-        $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
379
+        $transaction = $item->get_first_related('Transaction');
380
+        $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
381 381
 	    return $payment_count > 0
382
-		    ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() )
382
+		    ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID())
383 383
 		      . '<span class="ee-lock-icon"></span>'
384 384
 		    : sprintf(
385 385
 			    '<input type="checkbox" name="_REG_ID[]" value="%1$s" />',
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
 	 * @return string
398 398
 	 * @throws \EE_Error
399 399
 	 */
400
-	public function column__REG_ID(EE_Registration $item){
400
+	public function column__REG_ID(EE_Registration $item) {
401 401
         $attendee = $item->attendee();
402 402
 		$content = $item->ID();
403 403
 		$content .= '<div class="show-on-mobile-view-only">';
404 404
 		$content .= '<br>';
405 405
 		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
406
-		$content .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
407
-		$content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
406
+		$content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
407
+		$content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
408 408
 		$content .= '</div>';
409 409
 		return $content;
410 410
 	}
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
 	 * @return string
420 420
 	 * @throws \EE_Error
421 421
 	 */
422
-	public function column__REG_date(EE_Registration $item){
422
+	public function column__REG_date(EE_Registration $item) {
423 423
 		$this->_set_related_details($item);
424 424
        		 //Build row actions
425
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
426
-		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
427
-		$view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>';
425
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
426
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
427
+		$view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>';
428 428
 		return $view_link;
429 429
 	}
430 430
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @return string
439 439
 	 * @throws \EE_Error
440 440
 	 */
441
-	public function column_event_name(EE_Registration $item){
442
-		$this->_set_related_details( $item );
441
+	public function column_event_name(EE_Registration $item) {
442
+		$this->_set_related_details($item);
443 443
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
444 444
         $EVT_ID = $item->event_ID();
445 445
         $event_name = $item->event_name();
@@ -449,21 +449,21 @@  discard block
 block discarded – undo
449 449
             $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
450 450
                 EVENTS_ADMIN_URL);
451 451
             $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
452
-                ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr($this->_event_details['title_attr']) . '">' . $event_name . '</a>'
452
+                ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.$event_name.'</a>'
453 453
                 : $event_name;
454 454
             $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
455
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
455
+            $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="';
456 456
             $actions['event_filter'] .= sprintf(
457 457
                 esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'),
458 458
                 $event_name
459 459
             );
460
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
460
+            $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>';
461 461
         } else {
462 462
             $edit_event = $event_name;
463 463
             $actions['event_filter'] = '';
464 464
         }
465 465
 
466
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
466
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
467 467
 	}
468 468
 
469 469
 
@@ -476,18 +476,18 @@  discard block
 block discarded – undo
476 476
 	 * @return string
477 477
 	 * @throws \EE_Error
478 478
 	 */
479
-   	public function column_DTT_EVT_start(EE_Registration $item){
479
+   	public function column_DTT_EVT_start(EE_Registration $item) {
480 480
 		$datetime_strings = array();
481
-		$ticket = $item->ticket( TRUE );
482
-		if ( $ticket instanceof EE_Ticket ) {
481
+		$ticket = $item->ticket(TRUE);
482
+		if ($ticket instanceof EE_Ticket) {
483 483
 			$remove_defaults = array('default_where_conditions' => 'none');
484 484
 			$datetimes = $ticket->datetimes($remove_defaults);
485
-			foreach($datetimes as $datetime){
486
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
485
+			foreach ($datetimes as $datetime) {
486
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
487 487
 			}
488
-			return implode("<br />",$datetime_strings);
488
+			return implode("<br />", $datetime_strings);
489 489
 		} else {
490
-			return __( 'There is no ticket on this registration', 'event_espresso' );
490
+			return __('There is no ticket on this registration', 'event_espresso');
491 491
 		}
492 492
     }
493 493
 
@@ -501,17 +501,17 @@  discard block
 block discarded – undo
501 501
 	 * @return string
502 502
 	 * @throws \EE_Error
503 503
 	 */
504
-   	public function column_ATT_fname(EE_Registration $item){
504
+   	public function column_ATT_fname(EE_Registration $item) {
505 505
         $attendee = $item->attendee();
506 506
 
507
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
507
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
508 508
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
509 509
 		$link = EE_Registry::instance()->CAP->current_user_can(
510 510
 		    'ee_read_registration',
511 511
             'espresso_registrations_view_registration',
512 512
             $item->ID()
513 513
         )
514
-            ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>'
514
+            ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>'
515 515
             : $attendee_name;
516 516
 		$link .= $item->count() === 1
517 517
             ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>'
@@ -521,33 +521,33 @@  discard block
 block discarded – undo
521 521
 		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
522 522
 
523 523
 	    //append group count to name
524
-	    $link .= '&nbsp;' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size());
524
+	    $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
525 525
 
526 526
 	    //append reg_code
527
-	    $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') );
527
+	    $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
528 528
 
529 529
 	    //reg status text for accessibility
530
-	    $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
530
+	    $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
531 531
 
532 532
 		//trash/restore/delete actions
533 533
 		$actions = array();
534
-		if ( $this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
535
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
536
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
537
-		} elseif ( $this->_view === 'trash' ) {
534
+		if ($this->_view !== 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
535
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
536
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
537
+		} elseif ($this->_view === 'trash') {
538 538
 			// restore registration link
539
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
540
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
541
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
539
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
540
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
541
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
542 542
 			}
543
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
544
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
543
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
544
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
545 545
 
546
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
546
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
547 547
 			}
548 548
 		}
549 549
 
550
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
550
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
551 551
 	}
552 552
 
553 553
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	 * @return string
561 561
 	 * @throws \EE_Error
562 562
 	 */
563
-	public function column_ATT_email( EE_Registration $item ) {
563
+	public function column_ATT_email(EE_Registration $item) {
564 564
 		$attendee = $item->get_first_related('Attendee');
565 565
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
566 566
 	}
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 	 * @param \EE_Registration $item
575 575
 	 * @return string
576 576
 	 */
577
-	public function column__REG_count(EE_Registration $item){
578
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
577
+	public function column__REG_count(EE_Registration $item) {
578
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
579 579
 	}
580 580
 
581 581
 
@@ -587,16 +587,16 @@  discard block
 block discarded – undo
587 587
 	 * @param \EE_Registration $item
588 588
 	 * @return string
589 589
 	 */
590
-	public function column_PRC_amount(EE_Registration $item){
590
+	public function column_PRC_amount(EE_Registration $item) {
591 591
 		$ticket = $item->ticket();
592 592
 
593
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
593
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
594 594
 
595
-		if ( $item->final_price() > 0 ) {
596
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
595
+		if ($item->final_price() > 0) {
596
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
597 597
 		} else {
598 598
 			// free event
599
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
599
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
600 600
 		}
601 601
 
602 602
 		return $content;
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
 	 * @param \EE_Registration $item
613 613
 	 * @return string
614 614
 	 */
615
-	public function column__REG_final_price(EE_Registration $item){
615
+	public function column__REG_final_price(EE_Registration $item) {
616 616
 		$ticket = $item->ticket();
617
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
617
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
618 618
 
619
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
619
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
620 620
 		return $content;
621 621
 
622 622
 	}
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
 	 * @param \EE_Registration $item
631 631
 	 * @return string
632 632
 	 */
633
-	public function column__REG_paid(EE_Registration $item){
633
+	public function column__REG_paid(EE_Registration $item) {
634 634
 		$payment_method = $item->payment_method();
635
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
635
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
636 636
 
637
-		$content = '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
638
-		if ( $item->paid() > 0 ) {
639
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
637
+		$content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
638
+		if ($item->paid() > 0) {
639
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
640 640
 		}
641 641
 		return $content;
642 642
 	}
@@ -651,11 +651,11 @@  discard block
 block discarded – undo
651 651
 	 * @return string
652 652
 	 * @throws \EE_Error
653 653
 	 */
654
-	public function column_TXN_total(EE_Registration $item){
655
-		if($item->transaction()){
656
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
657
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
658
-		}else{
654
+	public function column_TXN_total(EE_Registration $item) {
655
+		if ($item->transaction()) {
656
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
657
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
658
+		} else {
659 659
 			return __("None", "event_espresso");
660 660
 		}
661 661
 	}
@@ -670,15 +670,15 @@  discard block
 block discarded – undo
670 670
 	 * @return string
671 671
 	 * @throws \EE_Error
672 672
 	 */
673
-	public function column_TXN_paid(EE_Registration $item){
673
+	public function column_TXN_paid(EE_Registration $item) {
674 674
 
675
-		if ( $item->count() === 1 ) {
675
+		if ($item->count() === 1) {
676 676
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
677
-			if ( $transaction->paid() >= $transaction->total() ) {
677
+			if ($transaction->paid() >= $transaction->total()) {
678 678
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
679 679
 			} else {
680
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
681
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
680
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
681
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
682 682
 			}
683 683
 		}
684 684
 
@@ -699,42 +699,42 @@  discard block
 block discarded – undo
699 699
 	public function column_actions(EE_Registration $item) {
700 700
 		$actions = array();
701 701
 		$attendee = $item->attendee();
702
-		$this->_set_related_details( $item );
702
+		$this->_set_related_details($item);
703 703
 
704 704
 		//Build row actions
705
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
706
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
705
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
706
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
707 707
 
708 708
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
709 709
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
710
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
710
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
711 711
 
712 712
 
713 713
 		//Build row actions
714
-		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
714
+		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
715 715
 			<li>
716
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
716
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
717 717
 				<div class="dashicons dashicons-clipboard"></div>
718 718
 			</a>
719 719
 			</li>' : '';
720
-		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
720
+		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
721 721
 			<li>
722
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
722
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
723 723
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
724 724
 			</a>
725 725
 			</li>' : '';
726
-		$actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
726
+		$actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
727 727
 			<li>
728
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
728
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
729 729
 				<div class="dashicons dashicons-email-alt"></div>
730 730
 			</a>
731 731
 			</li>' : '';
732 732
 
733 733
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
734
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
735
-		$actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
734
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
735
+		$actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
736 736
 			<li>
737
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . ' tiny-text" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '">
737
+			<a class="ee-status-color-' . $this->_transaction_details['status'].' tiny-text" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'">
738 738
 				<div class="dashicons dashicons-cart"></div>
739 739
 			</a>
740 740
 			</li>' : '';
@@ -743,17 +743,17 @@  discard block
 block discarded – undo
743 743
 		$actions['dl_invoice_lnk'] = '';
744 744
 		$dl_invoice_lnk_url = $item->invoice_url();
745 745
 		//only show invoice link if message type is active.
746
-		if ( $attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
746
+		if ($attendee instanceof EE_Attendee && $item->is_primary_registrant() && EEH_MSG_Template::is_mt_active('invoice')) {
747 747
 			$actions['dl_invoice_lnk'] = '
748 748
 		<li>
749
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
749
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
750 750
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
751 751
 			</a>
752 752
 		</li>';
753 753
 		}
754 754
 		$actions['filtered_messages_link'] = '';
755 755
 		//message list table link (filtered by REG_ID
756
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
756
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
757 757
 			$actions['filtered_messages_link'] = '<li>'
758 758
 			                          . EEH_MSG_Template::get_message_action_link(
759 759
 											'see_notifications_for',
@@ -764,9 +764,9 @@  discard block
 block discarded – undo
764 764
 											)
765 765
 			                          . '</li>';
766 766
 		}
767
-		$actions = apply_filters( 'FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this );
767
+		$actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
768 768
 		return $this->_action_string(
769
-			implode( '',  $actions ),
769
+			implode('', $actions),
770 770
 			$item,
771 771
 			'ul',
772 772
 			'reg-overview-actions-ul'
Please login to merge, or discard this patch.
strategies/display/EE_Admin_File_Uploader_Display_Strategy.strategy.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since                4.6
9 9
  *
10 10
  */
11
-class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base{
11
+class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base {
12 12
 
13 13
 	/**
14 14
 	 * Its important this media only get enqueued AFTER init, but before the footer... where the
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 	 * this input displayed.
21 21
 	 * @deprecated. enqueue_js should be called automatically now
22 22
 	 */
23
-	static function enqueue_scripts(){
24
-		EE_Error::doing_it_wrong( __FUNCTION__, __( 'EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form'), '4.9.8.rc.015' );
23
+	static function enqueue_scripts() {
24
+		EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form'), '4.9.8.rc.015');
25 25
 		wp_enqueue_media();
26 26
 		wp_enqueue_script('media-upload');
27
-		wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
27
+		wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
28 28
 	}
29 29
 	
30 30
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function enqueue_js() {
34 34
 		wp_enqueue_media();
35 35
 		wp_enqueue_script('media-upload');
36
-		wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
36
+		wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
37 37
 		parent::enqueue_js();
38 38
 	}
39 39
 
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
 	 * @return string of html to display the field
45 45
 	 */
46 46
 
47
-	function display(){
47
+	function display() {
48 48
 		// the actual input
49 49
 		$input = '<input type="text" size="34" ';
50
-		$input .= 'name="' . $this->_input->html_name() . '" ';
51
-		$input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" ';
52
-		$input .= 'value="' . $this->_input->raw_value_in_form() . '" ';
53
-		$input .= $this->_input->other_html_attributes() . '>';
50
+		$input .= 'name="'.$this->_input->html_name().'" ';
51
+		$input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url '.$this->_input->html_class().'" ' : 'class="large-text ee_media_url" ';
52
+		$input .= 'value="'.$this->_input->raw_value_in_form().'" ';
53
+		$input .= $this->_input->other_html_attributes().'>';
54 54
 		// image uploader
55
-		$uploader = EEH_HTML::link( '#', '<img src="' . admin_url( 'images/media-button-image.gif' ) . '" >', __( 'click to add an image', 'event_espresso' ), '', 'ee_media_upload' );
55
+		$uploader = EEH_HTML::link('#', '<img src="'.admin_url('images/media-button-image.gif').'" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload');
56 56
 		//only attempt to show the image if it at least exists
57
-		$image = $this->src_exists( $this->_input->raw_value() ) ? EEH_HTML::br(2) . EEH_HTML::img( $this->_input->raw_value(), __( 'logo', 'event_espresso' ), '', 'ee_media_image' ) : '';
57
+		$image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2).EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : '';
58 58
 		// html string
59
-		return EEH_HTML::div( $input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area' );
59
+		return EEH_HTML::div($input.EEH_HTML::nbsp().$uploader.$image, '', 'ee_media_uploader_area');
60 60
 	}
61 61
 
62 62
 
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	 * @param string $src
68 68
 	 * @return boolean
69 69
 	 */
70
-	protected function src_exists( $src ){
71
-		$results = wp_remote_head( $src );
72
-		if( is_array( $results) && ! $results instanceof WP_Error){
73
-			return strpos($results['headers']['content-type'], "image" ) !== FALSE;
74
-		}else{
70
+	protected function src_exists($src) {
71
+		$results = wp_remote_head($src);
72
+		if (is_array($results) && ! $results instanceof WP_Error) {
73
+			return strpos($results['headers']['content-type'], "image") !== FALSE;
74
+		} else {
75 75
 			return FALSE;
76 76
 		}
77 77
 	}
Please login to merge, or discard this patch.
core/EE_Deprecated.core.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -881,7 +881,7 @@
 block discarded – undo
881 881
 
882 882
 	/**
883 883
 	 * @deprecated 4.9.0
884
-	 * @return array
884
+	 * @return EE_messenger[]
885 885
 	 */
886 886
 	public function get_installed_messengers() {
887 887
 		// EE_messages has been deprecated
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 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
  * ************************************************************************
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @param \EE_Checkout $checkout
32 32
  * @return string
33 33
  */
34
-function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) {
34
+function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) {
35 35
 	// list of old filters
36 36
 	$deprecated_filters = array(
37 37
 		'update_registration_details' => true,
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 		'proceed_to' => true,
42 42
 	);
43 43
 	// loop thru and call doing_it_wrong() or remove any that aren't being used
44
-	foreach ( $deprecated_filters as $deprecated_filter => $on ) {
44
+	foreach ($deprecated_filters as $deprecated_filter => $on) {
45 45
 		// was this filter called ?
46
-		if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) {
46
+		if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) {
47 47
 			// only display doing_it_wrong() notice to Event Admins during non-AJAX requests
48
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) {
48
+			if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) {
49 49
 				EE_Error::doing_it_wrong(
50
-					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
50
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
51 51
 					sprintf(
52
-						__( 'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ),
53
-						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
52
+						__('The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'),
53
+						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
54 54
 						'<br />',
55 55
 						'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
56 56
 						'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
 				);
60 60
 			}
61 61
 		} else {
62
-			unset( $deprecated_filters[ $deprecated_filter ] );
62
+			unset($deprecated_filters[$deprecated_filter]);
63 63
 		}
64 64
 	}
65
-	if ( ! empty( $deprecated_filters )) {
65
+	if ( ! empty($deprecated_filters)) {
66 66
 
67
-		if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) {
68
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text );
69
-		} else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) {
70
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text );
71
-		} else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) {
72
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text );
67
+		if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
68
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text);
69
+		} else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
70
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text);
71
+		} else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
72
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text);
73 73
 		}
74
-		if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
75
-			if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) {
76
-				$submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text );
74
+		if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
75
+			if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
76
+				$submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text);
77 77
 			}
78
-			if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) {
79
-				$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name();
78
+			if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
79
+				$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name();
80 80
 			}
81 81
 		}
82 82
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	return $submit_button_text;
85 85
 
86 86
 }
87
-add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 );
87
+add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2);
88 88
 
89 89
 
90 90
 
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
  * @param \EE_Checkout $checkout
96 96
  * @param boolean $status_updates
97 97
  */
98
-function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) {
98
+function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) {
99 99
 	$action_ref = NULL;
100
-	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
101
-	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
102
-	if ( $action_ref ) {
100
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
101
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
102
+	if ($action_ref) {
103 103
 
104 104
 		EE_Error::doing_it_wrong(
105 105
 			$action_ref,
106 106
 			sprintf(
107
-				__( 'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ),
107
+				__('This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'),
108 108
 				'<br />',
109 109
 				'/core/business/EE_Transaction_Processor.class.php',
110 110
 				'AHEE__EE_Transaction_Processor__finalize',
@@ -114,39 +114,39 @@  discard block
 block discarded – undo
114 114
 			),
115 115
 			'4.6.0'
116 116
 		);
117
-		switch ( $action_ref ) {
117
+		switch ($action_ref) {
118 118
 			case 'AHEE__EE_Transaction__finalize__new_transaction' :
119
-				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request );
119
+				do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request);
120 120
 				break;
121 121
 			case 'AHEE__EE_Transaction__finalize__all_transaction' :
122
-				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request );
122
+				do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request);
123 123
 				break;
124 124
 		}
125 125
 	}
126 126
 }
127
-add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 );
127
+add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2);
128 128
 /**
129 129
  * ee_deprecated_finalize_registration
130 130
  *
131 131
  * @param EE_Registration $registration
132 132
  */
133
-function ee_deprecated_finalize_registration( EE_Registration $registration ) {
134
-	$action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
135
-	if ( $action_ref ) {
133
+function ee_deprecated_finalize_registration(EE_Registration $registration) {
134
+	$action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
135
+	if ($action_ref) {
136 136
 		EE_Error::doing_it_wrong(
137 137
 			$action_ref,
138 138
 			sprintf(
139
-				__( 'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ),
139
+				__('This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'),
140 140
 				'<br />',
141 141
 				'/core/business/EE_Registration_Processor.class.php',
142 142
 				'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook'
143 143
 			),
144 144
 			'4.6.0'
145 145
 		);
146
-		do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )));
146
+		do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)));
147 147
 	}
148 148
 }
149
-add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 );
149
+add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1);
150 150
 
151 151
 
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
  * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called.
155 155
  * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately.
156 156
  */
157
-function ee_deprecated_hooks(){
157
+function ee_deprecated_hooks() {
158 158
 	/**
159 159
 	 * @var $hooks array where keys are hook names, and their values are array{
160 160
 	 *			@type string $version  when deprecated
@@ -165,25 +165,25 @@  discard block
 block discarded – undo
165 165
 	$hooks = array(
166 166
 		'AHEE__EE_System___do_setup_validations' => array(
167 167
 			'version' => '4.6.0',
168
-			'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ),
168
+			'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'),
169 169
 			'still_works' => FALSE
170 170
 		)
171 171
 	);
172
-	foreach( $hooks as $name => $deprecation_info ){
173
-		if( has_action( $name ) ){
172
+	foreach ($hooks as $name => $deprecation_info) {
173
+		if (has_action($name)) {
174 174
 			EE_Error::doing_it_wrong(
175 175
 				$name,
176 176
 				sprintf(
177
-					__('This filter is deprecated. %1$s%2$s','event_espresso'),
178
-					$deprecation_info[ 'still_works' ] ?  __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ),
179
-					isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' )
177
+					__('This filter is deprecated. %1$s%2$s', 'event_espresso'),
178
+					$deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'),
179
+					isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso')
180 180
 				),
181
-				isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' )
181
+				isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso')
182 182
 			);
183 183
 		}
184 184
 	}
185 185
 }
186
-add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' );
186
+add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks');
187 187
 
188 188
 
189 189
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
  * @return boolean
195 195
  */
196 196
 function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() {
197
-	$in_use =  has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' )
198
-			|| has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' );
199
-	if( $in_use ) {
197
+	$in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns')
198
+			|| has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save');
199
+	if ($in_use) {
200 200
 		$msg = __(
201 201
 			'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.'
202 202
 			. 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,'
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
 			'event_espresso' )
206 206
 		;
207 207
 		EE_Error::doing_it_wrong(
208
-			__CLASS__ . '::' . __FUNCTION__,
208
+			__CLASS__.'::'.__FUNCTION__,
209 209
 			$msg,
210 210
 			'4.8.32.rc.000'
211 211
 		);
212 212
 		//it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
213
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
214
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
213
+		if (is_admin() && ! defined('DOING_AJAX')) {
214
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
215 215
 		}
216 216
 	}
217 217
 	return $in_use;
218 218
 }
219
-add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' );
219
+add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks');
220 220
 
221 221
 /**
222 222
  * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165
@@ -225,34 +225,34 @@  discard block
 block discarded – undo
225 225
  * @param EE_Admin_Page $admin_page
226 226
  * @return void
227 227
  */
228
-function ee_deprecated_update_attendee_registration_form_old( $admin_page ) {
228
+function ee_deprecated_update_attendee_registration_form_old($admin_page) {
229 229
 	//check if the old hooks are in use. If not, do the default
230
-	if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
231
-		|| ! $admin_page instanceof EE_Admin_Page ) {
230
+	if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
231
+		|| ! $admin_page instanceof EE_Admin_Page) {
232 232
 		return;
233 233
 	}
234 234
 	$req_data = $admin_page->get_request_data();
235
-	$qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE;
236
-	$REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE;
237
-	$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
238
-	if ( ! $REG_ID || ! $qstns ) {
239
-		EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
235
+	$qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE;
236
+	$REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE;
237
+	$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
238
+	if ( ! $REG_ID || ! $qstns) {
239
+		EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
240 240
 	}
241 241
 	$success = TRUE;
242 242
 
243 243
 	// allow others to get in on this awesome fun   :D
244
-	do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
244
+	do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
245 245
 	// loop thru questions... FINALLY!!!
246 246
 
247
-	foreach ( $qstns as $QST_ID => $qstn ) {
247
+	foreach ($qstns as $QST_ID => $qstn) {
248 248
 		//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
249
-		if ( !is_array($qstn) ) {
250
-			$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
249
+		if ( ! is_array($qstn)) {
250
+			$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
251 251
 			continue;
252 252
 		}
253 253
 
254 254
 
255
-		foreach ( $qstn as $ANS_ID => $ANS_value ) {
255
+		foreach ($qstn as $ANS_ID => $ANS_value) {
256 256
 			//get answer
257 257
 			$query_params = array(
258 258
 				0 => array(
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				);
264 264
 			$answer = EEM_Answer::instance()->get_one($query_params);
265 265
 			//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
266
-			if ( ! $answer instanceof EE_Answer ) {
266
+			if ( ! $answer instanceof EE_Answer) {
267 267
 				$set_values = array(
268 268
 					'QST_ID' => $QST_ID,
269 269
 					'REG_ID' => $REG_ID,
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 		}
279 279
 	}
280 280
 	$what = __('Registration Form', 'event_espresso');
281
-	$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
282
-	$admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
281
+	$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
282
+	$admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
283 283
 	exit;
284 284
 }
285
-add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 );
285
+add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1);
286 286
 /**
287 287
  * Render the registration admin page's custom questions area in the old fashion
288 288
  * and firing the old hooks. When this method is removed, we can probably also
@@ -295,31 +295,31 @@  discard block
 block discarded – undo
295 295
  * @return bool
296 296
  * @throws \EE_Error
297 297
  */
298
-function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) {
298
+function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) {
299 299
 	//check if the old hooks are in use. If not, do the default
300
-	if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
301
-		|| ! $admin_page instanceof EE_Admin_Page ) {
300
+	if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
301
+		|| ! $admin_page instanceof EE_Admin_Page) {
302 302
 		return $do_default_action;
303 303
 	}
304
-	add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 );
305
-	add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 );
306
-	add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 );
307
-	add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 );
304
+	add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1);
305
+	add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1);
306
+	add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1);
307
+	add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1);
308 308
 
309
-	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') );
309
+	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID'));
310 310
 
311
-	EE_Registry::instance()->load_helper( 'Form_Fields' );
311
+	EE_Registry::instance()->load_helper('Form_Fields');
312 312
 	$template_args = array(
313
-		'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ),
313
+		'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups),
314 314
 		'reg_questions_form_action' => 'edit_registration',
315 315
 		'REG_ID' => $registration->ID()
316 316
 	);
317
-	$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
318
-	echo EEH_Template::display_template( $template_path, $template_args, TRUE );
317
+	$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
318
+	echo EEH_Template::display_template($template_path, $template_args, TRUE);
319 319
 	//indicate that we should not do the default admin page code
320 320
 	return false;
321 321
 }
322
-add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 );
322
+add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3);
323 323
 
324 324
 
325 325
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 			'4.9.0'
361 361
 		);
362 362
 		/** @var EE_Message_Resource_Manager $message_resource_manager */
363
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
364
-		$messenger = $message_resource_manager->get_messenger( $messenger_name );
365
-		$message_type = $message_resource_manager->get_message_type( $message_type_name );
363
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
364
+		$messenger = $message_resource_manager->get_messenger($messenger_name);
365
+		$message_type = $message_resource_manager->get_message_type($message_type_name);
366 366
 		return EE_Registry::instance()->load_lib(
367 367
 			'Messages_Template_Defaults',
368 368
 			array(
@@ -427,15 +427,15 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param string $method
429 429
 	 */
430
-	public function _class_is_deprecated( $method ) {
430
+	public function _class_is_deprecated($method) {
431 431
 		EE_Error::doing_it_wrong(
432
-			'EE_messages::' . $method,
433
-			__( 'EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.' ),
432
+			'EE_messages::'.$method,
433
+			__('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
434 434
 			'4.9.0',
435 435
 			'4.10.0.p'
436 436
 		);
437 437
 		// Please use EE_Message_Resource_Manager instead
438
-		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
438
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
439 439
 	}
440 440
 
441 441
 
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
 	 * @param string $messenger_name
446 446
 	 * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
447 447
 	 */
448
-	public function ensure_messenger_is_active( $messenger_name ) {
448
+	public function ensure_messenger_is_active($messenger_name) {
449 449
 		// EE_messages has been deprecated
450
-		$this->_class_is_deprecated( __FUNCTION__ );
451
-		return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name );
450
+		$this->_class_is_deprecated(__FUNCTION__);
451
+		return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name);
452 452
 	}
453 453
 
454 454
 
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
 	 * @return bool true if it got activated (or was active) and false if not.
461 461
 	 * @throws \EE_Error
462 462
 	 */
463
-	public function ensure_message_type_is_active( $message_type, $messenger ) {
463
+	public function ensure_message_type_is_active($message_type, $messenger) {
464 464
 		// EE_messages has been deprecated
465
-		$this->_class_is_deprecated( __FUNCTION__ );
466
-		return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger );
465
+		$this->_class_is_deprecated(__FUNCTION__);
466
+		return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger);
467 467
 	}
468 468
 
469 469
 
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
 	 *                                            they are already setup.)
477 477
 	 * @return boolean an array of generated templates or false if nothing generated/activated.
478 478
 	 */
479
-	public function activate_messenger( $messenger_name, $mts_to_activate = array() ) {
479
+	public function activate_messenger($messenger_name, $mts_to_activate = array()) {
480 480
 		// EE_messages has been deprecated
481
-		$this->_class_is_deprecated( __FUNCTION__ );
482
-		return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate );
481
+		$this->_class_is_deprecated(__FUNCTION__);
482
+		return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate);
483 483
 	}
484 484
 
485 485
 
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	 *
492 492
 	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
493 493
 	 */
494
-	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
494
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) {
495 495
 		// EE_messages has been deprecated
496
-		$this->_class_is_deprecated( __FUNCTION__ );
497
-		return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type );
496
+		$this->_class_is_deprecated(__FUNCTION__);
497
+		return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type);
498 498
 	}
499 499
 
500 500
 
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 	 * @param string $messenger
505 505
 	 * @return EE_messenger | null
506 506
 	 */
507
-	public function get_messenger_if_active( $messenger ) {
507
+	public function get_messenger_if_active($messenger) {
508 508
 		// EE_messages has been deprecated
509
-		$this->_class_is_deprecated( __FUNCTION__ );
510
-		return $this->_message_resource_manager->get_active_messenger( $messenger );
509
+		$this->_class_is_deprecated(__FUNCTION__);
510
+		return $this->_message_resource_manager->get_active_messenger($messenger);
511 511
 	}
512 512
 
513 513
 
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 	 *                  'message_type' => null
529 529
 	 *                  )
530 530
 	 */
531
-	public function validate_for_use( EE_Message $message ) {
531
+	public function validate_for_use(EE_Message $message) {
532 532
 		// EE_messages has been deprecated
533
-		$this->_class_is_deprecated( __FUNCTION__ );
533
+		$this->_class_is_deprecated(__FUNCTION__);
534 534
 		return array(
535 535
 			'messenger'    => $message->messenger_object(),
536 536
 			'message_type' => $message->message_type_object(),
@@ -558,41 +558,41 @@  discard block
 block discarded – undo
558 558
 		$send = true
559 559
 	) {
560 560
 		// EE_messages has been deprecated
561
-		$this->_class_is_deprecated( __FUNCTION__ );
561
+		$this->_class_is_deprecated(__FUNCTION__);
562 562
 		/** @type EE_Messages_Processor $processor */
563
-		$processor = EE_Registry::instance()->load_lib( 'Messages_Processor' );
563
+		$processor = EE_Registry::instance()->load_lib('Messages_Processor');
564 564
 		$error = false;
565 565
 		//try to intelligently determine what method we'll call based on the incoming data.
566 566
 		//if generating and sending are different then generate and send immediately.
567
-		if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) {
567
+		if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
568 568
 			//in the legacy system, when generating and sending were different, that means all the
569 569
 			//vars are already in the request object.  So let's just use that.
570 570
 			try {
571 571
 				/** @type EE_Message_To_Generate_From_Request $mtg */
572
-				$mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
573
-				$processor->generate_and_send_now( $mtg );
574
-			} catch ( EE_Error $e ) {
572
+				$mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
573
+				$processor->generate_and_send_now($mtg);
574
+			} catch (EE_Error $e) {
575 575
 				$error_msg = __(
576 576
 					'Please note that a system message failed to send due to a technical issue.',
577 577
 					'event_espresso'
578 578
 				);
579 579
 				// add specific message for developers if WP_DEBUG in on
580
-				$error_msg .= '||' . $e->getMessage();
581
-				EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
580
+				$error_msg .= '||'.$e->getMessage();
581
+				EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
582 582
 				$error = true;
583 583
 			}
584 584
 		} else {
585
-			$processor->generate_for_all_active_messengers( $type, $vars, $send );
585
+			$processor->generate_for_all_active_messengers($type, $vars, $send);
586 586
 			//let's find out if there were any errors and how many successfully were queued.
587 587
 			$count_errors = $processor->get_queue()->count_STS_in_queue(
588
-				array( EEM_Message::status_failed, EEM_Message::status_debug_only )
588
+				array(EEM_Message::status_failed, EEM_Message::status_debug_only)
589 589
 			);
590
-			$count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete );
591
-			$count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry );
590
+			$count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
591
+			$count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry);
592 592
 			$count_errors = $count_errors + $count_retry;
593
-			if ( $count_errors > 0 ) {
593
+			if ($count_errors > 0) {
594 594
 				$error = true;
595
-				if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) {
595
+				if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) {
596 596
 					$message = sprintf(
597 597
 						__(
598 598
 							'There were %d errors and %d messages successfully queued for generation and sending',
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 						$count_errors,
602 602
 						$count_queued
603 603
 					);
604
-				} elseif ( $count_errors > 1 && $count_queued === 1 ) {
604
+				} elseif ($count_errors > 1 && $count_queued === 1) {
605 605
 					$message = sprintf(
606 606
 						__(
607 607
 							'There were %d errors and %d message successfully queued for generation.',
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 						$count_errors,
611 611
 						$count_queued
612 612
 					);
613
-				} elseif ( $count_errors === 1 && $count_queued > 1 ) {
613
+				} elseif ($count_errors === 1 && $count_queued > 1) {
614 614
 					$message = sprintf(
615 615
 						__(
616 616
 							'There was %d error and %d messages successfully queued for generation.',
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 						$count_errors
629 629
 					);
630 630
 				}
631
-				EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ );
631
+				EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__);
632 632
 			} else {
633
-				if ( $count_queued === 1 ) {
633
+				if ($count_queued === 1) {
634 634
 					$message = sprintf(
635 635
 						__(
636 636
 							'%d message successfully queued for generation.',
@@ -647,18 +647,18 @@  discard block
 block discarded – undo
647 647
 						$count_queued
648 648
 					);
649 649
 				}
650
-				EE_Error::add_success( $message );
650
+				EE_Error::add_success($message);
651 651
 			}
652 652
 		}
653 653
 		//if no error then return the generated message(s).
654
-		if ( ! $error && ! $send ) {
655
-			$generated_queue = $processor->generate_queue( false );
654
+		if ( ! $error && ! $send) {
655
+			$generated_queue = $processor->generate_queue(false);
656 656
 			//get message and return.
657 657
 			$generated_queue->get_message_repository()->rewind();
658 658
 			$messages = array();
659
-			while ( $generated_queue->get_message_repository()->valid() ) {
659
+			while ($generated_queue->get_message_repository()->valid()) {
660 660
 				$message = $generated_queue->get_message_repository()->current();
661
-				if ( $message instanceof EE_Message ) {
661
+				if ($message instanceof EE_Message) {
662 662
 					//set properties that might be expected by add-ons (backward compat)
663 663
 					$message->content = $message->content();
664 664
 					$message->template_pack = $message->get_template_pack();
@@ -683,10 +683,10 @@  discard block
 block discarded – undo
683 683
 	 * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular preview
684 684
 	 * @return string          The body of the message.
685 685
 	 */
686
-	public function preview_message( $type, $context, $messenger, $send = false ) {
686
+	public function preview_message($type, $context, $messenger, $send = false) {
687 687
 		// EE_messages has been deprecated
688
-		$this->_class_is_deprecated( __FUNCTION__ );
689
-		return EED_Messages::preview_message( $type, $context, $messenger, $send );
688
+		$this->_class_is_deprecated(__FUNCTION__);
689
+		return EED_Messages::preview_message($type, $context, $messenger, $send);
690 690
 	}
691 691
 
692 692
 
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @return bool          success or fail.
702 702
 	 */
703
-	public function send_message_with_messenger_only( $messenger, $message_type, $message ) {
703
+	public function send_message_with_messenger_only($messenger, $message_type, $message) {
704 704
 		// EE_messages has been deprecated
705
-		$this->_class_is_deprecated( __FUNCTION__ );
705
+		$this->_class_is_deprecated(__FUNCTION__);
706 706
 		//setup for sending to new method.
707 707
 		/** @type EE_Messages_Queue $queue */
708
-		$queue = EE_Registry::instance()->load_lib( 'Messages_Queue' );
708
+		$queue = EE_Registry::instance()->load_lib('Messages_Queue');
709 709
 		//make sure we have a proper message object
710
-		if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) {
710
+		if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
711 711
 			$msg = EE_Message_Factory::create(
712 712
 				array(
713 713
 					'MSG_messenger'    => $messenger,
@@ -719,15 +719,15 @@  discard block
 block discarded – undo
719 719
 		} else {
720 720
 			$msg = $message;
721 721
 		}
722
-		if ( ! $msg instanceof EE_Message ) {
722
+		if ( ! $msg instanceof EE_Message) {
723 723
 			return false;
724 724
 		}
725 725
 		//make sure any content in a content property (if not empty) is set on the MSG_content.
726
-		if ( ! empty( $msg->content ) ) {
727
-			$msg->set( 'MSG_content', $msg->content );
726
+		if ( ! empty($msg->content)) {
727
+			$msg->set('MSG_content', $msg->content);
728 728
 		}
729
-		$queue->add( $msg );
730
-		return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue );
729
+		$queue->add($msg);
730
+		return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue);
731 731
 	}
732 732
 
733 733
 
@@ -741,11 +741,11 @@  discard block
 block discarded – undo
741 741
 	 * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned.
742 742
 	 * @throws \EE_Error
743 743
 	 */
744
-	public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) {
744
+	public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) {
745 745
 		// EE_messages has been deprecated
746
-		$this->_class_is_deprecated( __FUNCTION__ );
747
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
748
-		return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global );
746
+		$this->_class_is_deprecated(__FUNCTION__);
747
+		EE_Registry::instance()->load_helper('MSG_Template');
748
+		return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global);
749 749
 	}
750 750
 
751 751
 
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
 	 * @param  string $message_type_name name of EE_message_type
757 757
 	 * @return array
758 758
 	 */
759
-	public function get_fields( $messenger_name, $message_type_name ) {
759
+	public function get_fields($messenger_name, $message_type_name) {
760 760
 		// EE_messages has been deprecated
761
-		$this->_class_is_deprecated( __FUNCTION__ );
762
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
763
-		return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name );
761
+		$this->_class_is_deprecated(__FUNCTION__);
762
+		EE_Registry::instance()->load_helper('MSG_Template');
763
+		return EEH_MSG_Template::get_fields($messenger_name, $message_type_name);
764 764
 	}
765 765
 
766 766
 
@@ -774,13 +774,13 @@  discard block
 block discarded – undo
774 774
 	 * @return array                    multidimensional array of messenger and message_type objects
775 775
 	 *                                    (messengers index, and message_type index);
776 776
 	 */
777
-	public function get_installed( $type = 'all', $skip_cache = false ) {
777
+	public function get_installed($type = 'all', $skip_cache = false) {
778 778
 		// EE_messages has been deprecated
779
-		$this->_class_is_deprecated( __FUNCTION__ );
780
-		if ( $skip_cache ) {
779
+		$this->_class_is_deprecated(__FUNCTION__);
780
+		if ($skip_cache) {
781 781
 			$this->_message_resource_manager->reset_active_messengers_and_message_types();
782 782
 		}
783
-		switch ( $type ) {
783
+		switch ($type) {
784 784
 			case 'messengers' :
785 785
 				return array(
786 786
 					'messenger' => $this->_message_resource_manager->installed_messengers(),
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 */
810 810
 	public function get_active_messengers() {
811 811
 		// EE_messages has been deprecated
812
-		$this->_class_is_deprecated( __FUNCTION__ );
812
+		$this->_class_is_deprecated(__FUNCTION__);
813 813
 		return $this->_message_resource_manager->active_messengers();
814 814
 	}
815 815
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	 */
822 822
 	public function get_active_message_types() {
823 823
 		// EE_messages has been deprecated
824
-		$this->_class_is_deprecated( __FUNCTION__ );
824
+		$this->_class_is_deprecated(__FUNCTION__);
825 825
 		return $this->_message_resource_manager->list_of_active_message_types();
826 826
 	}
827 827
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 */
834 834
 	public function get_active_message_type_objects() {
835 835
 		// EE_messages has been deprecated
836
-		$this->_class_is_deprecated( __FUNCTION__ );
836
+		$this->_class_is_deprecated(__FUNCTION__);
837 837
 		return $this->_message_resource_manager->get_active_message_type_objects();
838 838
 	}
839 839
 
@@ -845,10 +845,10 @@  discard block
 block discarded – undo
845 845
 	 * @param string $messenger The messenger being checked
846 846
 	 * @return EE_message_type[]    (or empty array if none present)
847 847
 	 */
848
-	public function get_active_message_types_per_messenger( $messenger ) {
848
+	public function get_active_message_types_per_messenger($messenger) {
849 849
 		// EE_messages has been deprecated
850
-		$this->_class_is_deprecated( __FUNCTION__ );
851
-		return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger );
850
+		$this->_class_is_deprecated(__FUNCTION__);
851
+		return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger);
852 852
 	}
853 853
 
854 854
 
@@ -859,10 +859,10 @@  discard block
 block discarded – undo
859 859
 	 * @param string $message_type The string should correspond to a message type.
860 860
 	 * @return EE_message_type|null
861 861
 	 */
862
-	public function get_active_message_type( $messenger, $message_type ) {
862
+	public function get_active_message_type($messenger, $message_type) {
863 863
 		// EE_messages has been deprecated
864
-		$this->_class_is_deprecated( __FUNCTION__ );
865
-		return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type );
864
+		$this->_class_is_deprecated(__FUNCTION__);
865
+		return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type);
866 866
 	}
867 867
 
868 868
 
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 	 */
874 874
 	public function get_installed_message_types() {
875 875
 		// EE_messages has been deprecated
876
-		$this->_class_is_deprecated( __FUNCTION__ );
876
+		$this->_class_is_deprecated(__FUNCTION__);
877 877
 		return $this->_message_resource_manager->installed_message_types();
878 878
 	}
879 879
 
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 	 */
886 886
 	public function get_installed_messengers() {
887 887
 		// EE_messages has been deprecated
888
-		$this->_class_is_deprecated( __FUNCTION__ );
888
+		$this->_class_is_deprecated(__FUNCTION__);
889 889
 		return $this->_message_resource_manager->installed_messengers();
890 890
 	}
891 891
 
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
 	 * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type.
897 897
 	 * @return array
898 898
 	 */
899
-	public function get_all_contexts( $slugs_only = true ) {
899
+	public function get_all_contexts($slugs_only = true) {
900 900
 		// EE_messages has been deprecated
901
-		$this->_class_is_deprecated( __FUNCTION__ );
902
-		return $this->_message_resource_manager->get_all_contexts( $slugs_only );
901
+		$this->_class_is_deprecated(__FUNCTION__);
902
+		return $this->_message_resource_manager->get_all_contexts($slugs_only);
903 903
 	}
904 904
 
905 905
 
Please login to merge, or discard this patch.
core/CPTs/CptQueryModifier.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\CPTs;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		\WP_Query $WP_Query,
81 81
 		\EE_Request_Handler $request
82 82
 	) {
83
-		$this->setRequest( $request );
84
-		$this->setWpQuery( $WP_Query );
85
-		$this->setPostType( $post_type );
86
-		$this->setCptDetails( $cpt_details );
83
+		$this->setRequest($request);
84
+		$this->setWpQuery($WP_Query);
85
+		$this->setPostType($post_type);
86
+		$this->setCptDetails($cpt_details);
87 87
 		$this->init();
88 88
 	}
89 89
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	/**
102 102
 	 * @param string $post_type
103 103
 	 */
104
-	protected function setPostType( $post_type ) {
104
+	protected function setPostType($post_type) {
105 105
 		$this->post_type = $post_type;
106 106
 	}
107 107
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * @param array $cpt_details
121 121
 	 */
122
-	protected function setCptDetails( $cpt_details ) {
122
+	protected function setCptDetails($cpt_details) {
123 123
 		$this->cpt_details = $cpt_details;
124 124
 	}
125 125
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * @param \EE_Table_Base[] $model_tables
139 139
 	 */
140
-	protected function setModelTables( $model_tables ) {
140
+	protected function setModelTables($model_tables) {
141 141
 		$this->model_tables = $model_tables;
142 142
 	}
143 143
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return array
148 148
 	 */
149 149
 	public function taxonomies() {
150
-		if ( empty( $this->taxonomies ) ) {
150
+		if (empty($this->taxonomies)) {
151 151
 			$this->initializeTaxonomies();
152 152
 		}
153 153
 		return $this->taxonomies;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	/**
159 159
 	 * @param array $taxonomies
160 160
 	 */
161
-	protected function setTaxonomies( array $taxonomies ) {
161
+	protected function setTaxonomies(array $taxonomies) {
162 162
 		$this->taxonomies = $taxonomies;
163 163
 	}
164 164
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	/**
177 177
 	 * @param \EE_Secondary_Table $meta_table
178 178
 	 */
179
-	public function setMetaTable( \EE_Secondary_Table $meta_table ) {
179
+	public function setMetaTable(\EE_Secondary_Table $meta_table) {
180 180
 		$this->meta_table = $meta_table;
181 181
 	}
182 182
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	/**
195 195
 	 * @param \EEM_Base $CPT_model
196 196
 	 */
197
-	protected function setModel( \EEM_Base $CPT_model ) {
197
+	protected function setModel(\EEM_Base $CPT_model) {
198 198
 		$this->model = $CPT_model;
199 199
 	}
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	/**
213 213
 	 * @param \EE_Request_Handler $request
214 214
 	 */
215
-	protected function setRequest( \EE_Request_Handler $request ) {
215
+	protected function setRequest(\EE_Request_Handler $request) {
216 216
 		$this->request = $request;
217 217
 	}
218 218
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	/**
231 231
 	 * @param \WP_Query $wp_query
232 232
 	 */
233
-	public function setWpQuery( \WP_Query $wp_query ) {
233
+	public function setWpQuery(\WP_Query $wp_query) {
234 234
 		$this->wp_query = $wp_query;
235 235
 	}
236 236
 
@@ -245,22 +245,22 @@  discard block
 block discarded – undo
245 245
 	protected function initializeTaxonomies() {
246 246
 		// check if taxonomies have already been set and that this CPT has taxonomies registered for it
247 247
 		if (
248
-			empty( $this->taxonomies )
249
-			&& isset( $this->cpt_details['args'], $this->cpt_details['args']['taxonomies'] )
248
+			empty($this->taxonomies)
249
+			&& isset($this->cpt_details['args'], $this->cpt_details['args']['taxonomies'])
250 250
 		) {
251 251
 			// if so then grab them, but we want the taxonomy name as the key
252
-			$taxonomies = array_flip( $this->cpt_details['args']['taxonomies'] );
252
+			$taxonomies = array_flip($this->cpt_details['args']['taxonomies']);
253 253
 			// then grab the list of ALL taxonomies
254 254
 			$all_taxonomies = \EE_Register_CPTs::get_taxonomies();
255
-			foreach ( $taxonomies as $taxonomy => &$details ) {
255
+			foreach ($taxonomies as $taxonomy => &$details) {
256 256
 				// add details to our taxonomies if they exist
257
-				$details = isset( $all_taxonomies[ $taxonomy ] )
258
-					? $all_taxonomies[ $taxonomy ]
257
+				$details = isset($all_taxonomies[$taxonomy])
258
+					? $all_taxonomies[$taxonomy]
259 259
 					: array();
260 260
 			}
261 261
 			// ALWAYS unset() variables that were passed by reference
262
-			unset( $details );
263
-			$this->setTaxonomies( $taxonomies );
262
+			unset($details);
263
+			$this->setTaxonomies($taxonomies);
264 264
 		}
265 265
 	}
266 266
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 		$this->setAdditionalCptDetails();
271 271
 		$this->setRequestVarsIfCpt();
272 272
 		// convert post_type to model name
273
-		$model_name = str_replace( 'EE_', '', $this->cpt_details['class_name'] );
273
+		$model_name = str_replace('EE_', '', $this->cpt_details['class_name']);
274 274
 		// load all tables related to CPT
275
-		$this->setupModelsAndTables( $model_name );
275
+		$this->setupModelsAndTables($model_name);
276 276
 		// load and instantiate CPT_*_Strategy
277
-		$CPT_Strategy = $this->cptStrategyClass( $model_name );
277
+		$CPT_Strategy = $this->cptStrategyClass($model_name);
278 278
 		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
279 279
 		// here's the list of available filters in the WP_Query object
280 280
 		// 'posts_where_paged'
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
 		// 'post_limits'
286 286
 		// 'posts_fields'
287 287
 		// 'posts_join'
288
-		add_filter( 'posts_fields', array( $this, 'postsFields' ) );
289
-		add_filter( 'posts_join', array( $this, 'postsJoin' ) );
288
+		add_filter('posts_fields', array($this, 'postsFields'));
289
+		add_filter('posts_join', array($this, 'postsJoin'));
290 290
 		add_filter(
291
-			'get_' . $this->post_type . '_metadata',
292
-			array( $CPT_Strategy, 'get_EE_post_type_metadata' ),
291
+			'get_'.$this->post_type.'_metadata',
292
+			array($CPT_Strategy, 'get_EE_post_type_metadata'),
293 293
 			1,
294 294
 			4
295 295
 		);
296
-		add_filter( 'the_posts', array( $this, 'thePosts' ), 1, 1 );
297
-		if ( $this->wp_query->is_main_query() ) {
298
-			add_filter( 'get_edit_post_link', array( $this, 'getEditPostLink' ), 10, 2 );
296
+		add_filter('the_posts', array($this, 'thePosts'), 1, 1);
297
+		if ($this->wp_query->is_main_query()) {
298
+			add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2);
299 299
 			$this->addTemplateFilters();
300 300
 		}
301 301
 	}
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 		// the post or category or term that is triggering EE
313 313
 		$this->cpt_details['espresso_page'] = $this->request->is_espresso_page();
314 314
 		// requested post name
315
-		$this->cpt_details['post_name'] = $this->request->get( 'post_name' );
315
+		$this->cpt_details['post_name'] = $this->request->get('post_name');
316 316
 		// add support for viewing 'private', 'draft', or 'pending' posts
317 317
 		if (
318
-			isset( $this->wp_query->query_vars['p'] )
318
+			isset($this->wp_query->query_vars['p'])
319 319
 			&& $this->wp_query->query_vars['p'] !== 0
320 320
 			&& is_user_logged_in()
321
-			&& current_user_can( 'edit_post', $this->wp_query->query_vars['p'] )
321
+			&& current_user_can('edit_post', $this->wp_query->query_vars['p'])
322 322
 		) {
323 323
 			// we can just inject directly into the WP_Query object
324
-			$this->wp_query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' );
324
+			$this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
325 325
 			// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
326
-			$this->request->set( 'ee', $this->cpt_details['singular_slug'] );
326
+			$this->request->set('ee', $this->cpt_details['singular_slug']);
327 327
 		}
328 328
 	}
329 329
 
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function setRequestVarsIfCpt() {
342 342
 		// check if ee action var has been set
343
-		if ( ! $this->request->is_set( 'ee' ) ) {
343
+		if ( ! $this->request->is_set('ee')) {
344 344
 			// check that route exists for CPT archive slug
345
-			if ( is_archive() && \EE_Config::get_route( $this->cpt_details['plural_slug'] ) ) {
345
+			if (is_archive() && \EE_Config::get_route($this->cpt_details['plural_slug'])) {
346 346
 				// ie: set "ee" to "events"
347
-				$this->request->set( 'ee', $this->cpt_details['plural_slug'] );
347
+				$this->request->set('ee', $this->cpt_details['plural_slug']);
348 348
 				// or does it match a single page CPT like /event/
349
-			} else if ( is_single() && \EE_Config::get_route( $this->cpt_details['singular_slug'] ) ) {
349
+			} else if (is_single() && \EE_Config::get_route($this->cpt_details['singular_slug'])) {
350 350
 				// ie: set "ee" to "event"
351
-				$this->request->set( 'ee', $this->cpt_details['singular_slug'] );
351
+				$this->request->set('ee', $this->cpt_details['singular_slug']);
352 352
 			}
353 353
 		}
354 354
 	}
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 	 * @param string $model_name
363 363
 	 * @throws \EE_Error
364 364
 	 */
365
-	protected function setupModelsAndTables( $model_name ) {
365
+	protected function setupModelsAndTables($model_name) {
366 366
 		// get CPT table data via CPT Model
367
-		$model = \EE_Registry::instance()->load_model( $model_name );
368
-		if ( ! $model instanceof \EEM_Base ) {
369
-			throw new \EE_Error (
367
+		$model = \EE_Registry::instance()->load_model($model_name);
368
+		if ( ! $model instanceof \EEM_Base) {
369
+			throw new \EE_Error(
370 370
 				sprintf(
371 371
 					__(
372 372
 						'The "%1$s" model could not be loaded.',
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 				)
377 377
 			);
378 378
 		}
379
-		$this->setModel( $model );
380
-		$this->setModelTables( $this->model->get_tables() );
379
+		$this->setModel($model);
380
+		$this->setModelTables($this->model->get_tables());
381 381
 		// is there a Meta Table for this CPT?
382 382
 		if (
383
-			isset( $this->cpt_details['tables'][ $model_name . '_Meta' ] )
384
-			&& $this->cpt_details['tables'][ $model_name . '_Meta' ] instanceof \EE_Secondary_Table
383
+			isset($this->cpt_details['tables'][$model_name.'_Meta'])
384
+			&& $this->cpt_details['tables'][$model_name.'_Meta'] instanceof \EE_Secondary_Table
385 385
 		) {
386
-			$this->setMetaTable( $this->cpt_details['tables'][ $model_name . '_Meta' ] );
386
+			$this->setMetaTable($this->cpt_details['tables'][$model_name.'_Meta']);
387 387
 		}
388 388
 	}
389 389
 
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
 	 * @param  string $model_name
397 397
 	 * @return string
398 398
 	 */
399
-	protected function cptStrategyClass( $model_name ) {
399
+	protected function cptStrategyClass($model_name) {
400 400
 		// creates classname like:  CPT_Event_Strategy
401
-		$CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy';
401
+		$CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy';
402 402
 		// load and instantiate
403 403
 		$CPT_Strategy = \EE_Registry::instance()->load_core(
404 404
 			$CPT_Strategy_class_name,
405
-			array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details )
405
+			array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
406 406
 		);
407
-		if ( $CPT_Strategy === null ) {
407
+		if ($CPT_Strategy === null) {
408 408
 			$CPT_Strategy = \EE_Registry::instance()->load_core(
409 409
 				'CPT_Default_Strategy',
410
-				array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details )
410
+				array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
411 411
 			);
412 412
 		}
413 413
 		return $CPT_Strategy;
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 	 * @param  $SQL
423 423
 	 * @return string
424 424
 	 */
425
-	public function postsFields( $SQL ) {
425
+	public function postsFields($SQL) {
426 426
 		// does this CPT have a meta table ?
427
-		if ( $this->meta_table instanceof \EE_Secondary_Table ) {
427
+		if ($this->meta_table instanceof \EE_Secondary_Table) {
428 428
 			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
429
-			$SQL .= ', ' . $this->meta_table->get_table_name() . '.* ';
429
+			$SQL .= ', '.$this->meta_table->get_table_name().'.* ';
430 430
 		}
431
-		remove_filter( 'posts_fields', array( $this, 'postsFields' ) );
431
+		remove_filter('posts_fields', array($this, 'postsFields'));
432 432
 		return $SQL;
433 433
 	}
434 434
 
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 	 * @param  $SQL
442 442
 	 * @return string
443 443
 	 */
444
-	public function postsJoin( $SQL ) {
444
+	public function postsJoin($SQL) {
445 445
 		// does this CPT have a meta table ?
446
-		if ( $this->meta_table instanceof \EE_Secondary_Table ) {
446
+		if ($this->meta_table instanceof \EE_Secondary_Table) {
447 447
 			global $wpdb;
448 448
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
449 449
 			$SQL .= ' LEFT JOIN '
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			        . $wpdb->posts
457 457
 			        . '.ID ) ';
458 458
 		}
459
-		remove_filter( 'posts_join', array( $this, 'postsJoin' ) );
459
+		remove_filter('posts_join', array($this, 'postsJoin'));
460 460
 		return $SQL;
461 461
 	}
462 462
 
@@ -469,17 +469,17 @@  discard block
 block discarded – undo
469 469
 	 * @param  \WP_Post[] $posts
470 470
 	 * @return \WP_Post[]
471 471
 	 */
472
-	public function thePosts( $posts ) {
472
+	public function thePosts($posts) {
473 473
 		$CPT_class = $this->cpt_details['class_name'];
474 474
 		// loop thru posts
475
-		if ( is_array( $posts ) && $this->model instanceof \EEM_CPT_Base ) {
476
-			foreach ( $posts as $key => $post ) {
477
-				if ( $post->post_type === $this->post_type ) {
478
-					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object( $post );
475
+		if (is_array($posts) && $this->model instanceof \EEM_CPT_Base) {
476
+			foreach ($posts as $key => $post) {
477
+				if ($post->post_type === $this->post_type) {
478
+					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post);
479 479
 				}
480 480
 			}
481 481
 		}
482
-		remove_filter( 'the_posts', array( $this, 'thePosts' ), 1 );
482
+		remove_filter('the_posts', array($this, 'thePosts'), 1);
483 483
 		return $posts;
484 484
 	}
485 485
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 * @param $ID
491 491
 	 * @return string
492 492
 	 */
493
-	public function getEditPostLink( $url, $ID ) {
493
+	public function getEditPostLink($url, $ID) {
494 494
 		// need to make sure we only edit links if our cpt
495 495
 		global $post;
496 496
 		//notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 			! $post instanceof \WP_Post
500 500
 			|| $post->post_type !== $this->post_type
501 501
 			|| (
502
-				isset( $this->cpt_details['args']['show_ee_ui'] )
502
+				isset($this->cpt_details['args']['show_ee_ui'])
503 503
 				&& ! $this->cpt_details['args']['show_ee_ui']
504 504
 			)
505 505
 		) {
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 		//k made it here so all is good.
509 509
 		return wp_nonce_url(
510 510
 			add_query_arg(
511
-				array( 'page' => $this->post_type, 'post' => $ID, 'action' => 'edit' ),
512
-				admin_url( 'admin.php' )
511
+				array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'),
512
+				admin_url('admin.php')
513 513
 			),
514 514
 			'edit',
515 515
 			'edit_nonce'
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	public function addTemplateFilters() {
528 528
 		// if requested cpt supports page_templates and it's the main query
529
-		if ( ! empty( $this->cpt_details['args']['page_templates'] ) && $this->wp_query->is_main_query() ) {
529
+		if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
530 530
 			// then let's hook into the appropriate query_template hook
531
-			add_filter( 'single_template', array( $this, 'singleCptTemplate' ) );
531
+			add_filter('single_template', array($this, 'singleCptTemplate'));
532 532
 		}
533 533
 	}
534 534
 
@@ -542,20 +542,20 @@  discard block
 block discarded – undo
542 542
 	 * @param string $current_template Existing default template path derived for this page call.
543 543
 	 * @return string the path to the full template file.
544 544
 	 */
545
-	public function singleCptTemplate( $current_template ) {
545
+	public function singleCptTemplate($current_template) {
546 546
 		$object = get_queried_object();
547 547
 		//does this called object HAVE a page template set that is something other than the default.
548
-		$template = get_post_meta( $object->ID, '_wp_page_template', true );
548
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
549 549
 		//exit early if default or not set or invalid path (accounts for theme changes)
550 550
 		if (
551 551
 			$template === 'default'
552
-			|| empty( $template )
553
-			|| ! is_readable( get_stylesheet_directory() . '/' . $template )
552
+			|| empty($template)
553
+			|| ! is_readable(get_stylesheet_directory().'/'.$template)
554 554
 		) {
555 555
 			return $current_template;
556 556
 		}
557 557
 		//made it here so we SHOULD be able to just locate the template and then return it.
558
-		return locate_template( array( $template ) );
558
+		return locate_template(array($template));
559 559
 	}
560 560
 
561 561
 
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		self::$_field_calculator = new Calculated_Model_Fields();
38
-		return parent::get_instance( __CLASS__ );
38
+		return parent::get_instance(__CLASS__);
39 39
 	}
40 40
 
41 41
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
 	public static function set_hooks_both() {
68
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 );
69
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 );
70
-		add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 );
71
-		add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) );
68
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
69
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
70
+		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
71
+		add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
72 72
 		EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
73 73
 	}
74 74
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Loads all the hooks which make requests to old versions of the API
88 88
 	 * appear the same as they always did
89 89
 	 */
90
-	public static function set_hooks_for_changes(){
90
+	public static function set_hooks_for_changes() {
91 91
 		self::_set_hooks_for_changes();
92 92
 	}
93 93
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	 * replace it with application passwords.
98 98
 	 */
99 99
 	public static function maybe_notify_of_basic_auth_removal() {
100
-		if( 
100
+		if ( 
101 101
 			apply_filters( 
102 102
 				'FHEE__EED_Core_Rest_Api__maybe_notify_of_basic_auth_removal__override',
103
-				! isset( $_SERVER['PHP_AUTH_USER'] )
104
-			&& ! isset( $_SERVER['HTTP_AUTHORIZATION'] ) 
103
+				! isset($_SERVER['PHP_AUTH_USER'])
104
+			&& ! isset($_SERVER['HTTP_AUTHORIZATION']) 
105 105
 			) 
106 106
 		) {
107 107
 			//sure it's a WP API request, but they aren't using basic auth, so don't bother them
@@ -109,20 +109,20 @@  discard block
 block discarded – undo
109 109
 		}
110 110
 		//ok they're using the WP API with Basic Auth
111 111
 		$message = sprintf(
112
-			__( 'We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso' ),
112
+			__('We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso'),
113 113
 			'<a href="https://wordpress.org/plugins/application-passwords/">',
114 114
 			'</a>',
115 115
 			'<a href="https://eventespresso.com/wiki/ee4-event-apps/#authentication">',
116 116
 			'<br/>'
117 117
 		);
118
-		EE_Error::add_persistent_admin_notice( 'using_basic_auth', $message );
119
-		if( ! get_option( 'ee_notified_admin_on_basic_auth_removal', false ) ) {
120
-			add_option( 'ee_notified_admin_on_basic_auth_removal', true );
118
+		EE_Error::add_persistent_admin_notice('using_basic_auth', $message);
119
+		if ( ! get_option('ee_notified_admin_on_basic_auth_removal', false)) {
120
+			add_option('ee_notified_admin_on_basic_auth_removal', true);
121 121
 			//piggy back off EE_Error::set_content_type, which sets the content type to HTML
122
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
122
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
123 123
 			//and send the message to the site admin too
124
-			wp_mail( get_option( 'admin_email' ), __( 'Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso' ), $message );
125
-			remove_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
124
+			wp_mail(get_option('admin_email'), __('Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso'), $message);
125
+			remove_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
126 126
 		}
127 127
 	}
128 128
 	/**
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 	 * appear the same as they always did
131 131
 	 */
132 132
 	protected static function _set_hooks_for_changes() {
133
-		$folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false );
134
-		foreach( $folder_contents as $classname_in_namespace => $filepath ) {
133
+		$folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);
134
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
135 135
 			//ignore the base parent class
136
-			if( $classname_in_namespace === 'Changes_In_Base' ) {
136
+			if ($classname_in_namespace === 'Changes_In_Base') {
137 137
 				continue;
138 138
 			}
139
-			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
140
-			if ( class_exists( $full_classname )) {
139
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;
140
+			if (class_exists($full_classname)) {
141 141
 				$instance_of_class = new $full_classname;
142
-				if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) {
142
+				if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) {
143 143
 					$instance_of_class->set_hooks();
144 144
 				}
145 145
 			}
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
 	 * so we actually prefer to only do it when an EE plugin is activated or upgraded
153 153
 	 */
154 154
 	public static function register_routes() {
155
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
156
-			foreach( $relative_urls as $endpoint => $routes ) {
157
-				foreach( $routes as $route ) {
155
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
156
+			foreach ($relative_urls as $endpoint => $routes) {
157
+				foreach ($routes as $route) {
158 158
 					register_rest_route(
159 159
 						$namespace,
160 160
 						$endpoint,
161 161
 						array(
162
-							'callback' => $route[ 'callback' ],
163
-							'methods' => $route[ 'methods' ],
164
-							'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(),
162
+							'callback' => $route['callback'],
163
+							'methods' => $route['methods'],
164
+							'args' => isset($route['args']) ? $route['args'] : array(),
165 165
 						)
166 166
 					);
167 167
 				}
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 * next time the WP API is used
176 176
 	 */
177 177
 	public static function invalidate_cached_route_data_on_version_change() {
178
-		if( EE_System::instance()->detect_req_type() != EE_System::req_type_normal ) {
178
+		if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) {
179 179
 			EED_Core_Rest_Api::invalidate_cached_route_data();
180 180
 		}
181
-		foreach( EE_Registry::instance()->addons as $addon ){
182
-			if( $addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal ) {
181
+		foreach (EE_Registry::instance()->addons as $addon) {
182
+			if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) {
183 183
 				EED_Core_Rest_Api::invalidate_cached_route_data();
184 184
 			}
185 185
 		}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function invalidate_cached_route_data() {
192 192
 		//delete the saved EE REST API routes
193
-		delete_option( EED_Core_Rest_Api::saved_routes_option_names );
193
+		delete_option(EED_Core_Rest_Api::saved_routes_option_names);
194 194
 	}
195 195
 
196 196
 	/**
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 	 */
204 204
 	public static function get_ee_route_data() {
205 205
 		$ee_routes = array();
206
-		foreach( self::versions_served() as $version => $hidden_endpoints ) {
207
-			$ee_routes[  self::ee_api_namespace . $version ] = self::_get_ee_route_data_for_version( $version, $hidden_endpoints );
206
+		foreach (self::versions_served() as $version => $hidden_endpoints) {
207
+			$ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version, $hidden_endpoints);
208 208
 		}
209 209
 		return $ee_routes;
210 210
 	}
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	 * @param boolean $hidden_endpoints
217 217
 	 * @return array
218 218
 	 */
219
-	protected static function _get_ee_route_data_for_version( $version, $hidden_endpoints = false ) {
220
-		$ee_routes = get_option( self::saved_routes_option_names . $version , null );
221
-		if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){
222
-			$ee_routes = self::_save_ee_route_data_for_version( $version, $hidden_endpoints );
219
+	protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) {
220
+		$ee_routes = get_option(self::saved_routes_option_names.$version, null);
221
+		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
222
+			$ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);
223 223
 		}
224 224
 		return $ee_routes;
225 225
 	}
@@ -233,18 +233,18 @@  discard block
 block discarded – undo
233 233
 	 * @param boolean $hidden_endpoints
234 234
 	 * @return mixed|null|void
235 235
 	 */
236
-	protected static function _save_ee_route_data_for_version( $version, $hidden_endpoints = false ) {
236
+	protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) {
237 237
 		$instance = self::instance();
238 238
 		$routes = apply_filters(
239 239
 			'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
240 240
 			array_replace_recursive(
241
-				$instance->_get_config_route_data_for_version( $version, $hidden_endpoints ),
242
-				$instance->_get_meta_route_data_for_version( $version, $hidden_endpoints ),
243
-				$instance->_get_model_route_data_for_version( $version, $hidden_endpoints ),
244
-				$instance->_get_rpc_route_data_for_version( $version, $hidden_endpoints )
241
+				$instance->_get_config_route_data_for_version($version, $hidden_endpoints),
242
+				$instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
243
+				$instance->_get_model_route_data_for_version($version, $hidden_endpoints),
244
+				$instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
245 245
 			)
246 246
 		);
247
-		update_option( self::saved_routes_option_names . $version, $routes, true );
247
+		update_option(self::saved_routes_option_names.$version, $routes, true);
248 248
 		return $routes;
249 249
 	}
250 250
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return void
256 256
 	 */
257 257
 	public static function save_ee_routes() {
258
-		if( EE_Maintenance_Mode::instance()->models_can_query() ){
258
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
259 259
 			$instance = self::instance();
260 260
 			$routes = apply_filters(
261 261
 				'EED_Core_Rest_Api__save_ee_routes__routes',
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 					$instance->_register_rpc_routes()
267 267
 				)
268 268
 			);
269
-			update_option( self::saved_routes_option_names, $routes, true );
269
+			update_option(self::saved_routes_option_names, $routes, true);
270 270
 		}
271 271
 	}
272 272
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	protected function _register_model_routes() {
279 279
 		$model_routes = array( );
280
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
281
-			$model_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint );
280
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
281
+			$model_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
282 282
 		}
283 283
 		return $model_routes;
284 284
 	}
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 * @param boolean $hidden_endpoint
290 290
 	 * @return array
291 291
 	 */
292
-	protected function _get_model_route_data_for_version( $version, $hidden_endpoint = false ) {
293
-		$model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info( $version );
292
+	protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) {
293
+		$model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info($version);
294 294
 		$models_to_register = apply_filters(
295 295
 			'FHEE__EED_Core_REST_API___register_model_routes',
296 296
 			$model_version_info->models_for_requested_version()
@@ -299,21 +299,21 @@  discard block
 block discarded – undo
299 299
 		unset($models_to_register['Extra_Meta']);
300 300
 		unset($models_to_register['Extra_Join']);
301 301
 		$model_routes = array();
302
-		foreach ( $models_to_register as $model_name => $model_classname ) {
303
-			$model = \EE_Registry::instance()->load_model( $model_name );
302
+		foreach ($models_to_register as $model_name => $model_classname) {
303
+			$model = \EE_Registry::instance()->load_model($model_name);
304 304
 			//yes we could just register one route for ALL models, but then they wouldn't show up in the index
305
-			$plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name );
306
-			$singular_model_route = $plural_model_route . '/(?P<id>\d+)' ;
307
-			$model_routes[ $plural_model_route ] = array(
305
+			$plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
306
+			$singular_model_route = $plural_model_route.'/(?P<id>\d+)';
307
+			$model_routes[$plural_model_route] = array(
308 308
 					array(
309 309
 						'callback' => array(
310 310
 							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
311 311
 							'handle_request_get_all' ),
312 312
 						'methods' => WP_REST_Server::READABLE,
313 313
 						'hidden_endpoint' => $hidden_endpoint,
314
-						'args' => $this->_get_read_query_params( $model, $version ),
314
+						'args' => $this->_get_read_query_params($model, $version),
315 315
 						'_links' => array(
316
-							'self' => rest_url( EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route ),
316
+							'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route),
317 317
 						)
318 318
 					),
319 319
 //						array(
@@ -324,14 +324,14 @@  discard block
 block discarded – undo
324 324
 //							'hidden_endpoint' => $hidden_endpoint
325 325
 //						)
326 326
 				);
327
-			$model_routes[ $singular_model_route ] = array(
327
+			$model_routes[$singular_model_route] = array(
328 328
 					array(
329 329
 						'callback' => array(
330 330
 							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
331 331
 							'handle_request_get_one' ),
332 332
 						'methods' => WP_REST_Server::READABLE,
333 333
 						'hidden_endpoint' => $hidden_endpoint,
334
-						'args' => $this->_get_response_selection_query_params( $model, $version)
334
+						'args' => $this->_get_response_selection_query_params($model, $version)
335 335
 					),
336 336
 //						array(
337 337
 //							'callback' => array(
@@ -342,19 +342,19 @@  discard block
 block discarded – undo
342 342
 //							),
343 343
 			);
344 344
 			//@todo: also handle  DELETE for a single item
345
-			foreach ( $model_version_info->relation_settings( $model ) as $relation_name => $relation_obj ) {
345
+			foreach ($model_version_info->relation_settings($model) as $relation_name => $relation_obj) {
346 346
 				$related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name(
347 347
 					$relation_name,
348 348
 					$relation_obj
349 349
 				);
350
-				$model_routes[ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array(
350
+				$model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array(
351 351
 						array(
352 352
 							'callback' => array(
353 353
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
354 354
 								'handle_request_get_related' ),
355 355
 							'methods' => WP_REST_Server::READABLE,
356 356
 							'hidden_endpoint' => $hidden_endpoint,
357
-							'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ),
357
+							'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
358 358
 						),
359 359
 //							array(
360 360
 //								'callback' => array(
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	protected function _register_rpc_routes() {
379 379
 		$routes = array();
380
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
381
-			$routes[ self::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( $version, $hidden_endpoint );
380
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
381
+			$routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version, $hidden_endpoint);
382 382
 		}
383 383
 		return $routes;
384 384
 	}
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 	 * @param boolean $hidden_endpoint
390 390
 	 * @return array
391 391
 	 */
392
-	protected function _get_rpc_route_data_for_version( $version, $hidden_endpoint = false ) {
392
+	protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) {
393 393
 		$this_versions_routes = array();
394 394
 			//checkin endpoint
395
-			$this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array(
395
+			$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
396 396
 				array(
397 397
 					'callback' => array(
398 398
 						'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 						'force' => array(
404 404
 							'required' => false,
405 405
 							'default' => false,
406
-							'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' )
406
+							'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso')
407 407
 						)
408 408
 					)
409 409
 				)
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @param string $version
423 423
 	 * @return array
424 424
 	 */
425
-	protected function _get_response_selection_query_params( \EEM_Base $model, $version ) {
425
+	protected function _get_response_selection_query_params(\EEM_Base $model, $version) {
426 426
 		return apply_filters(
427 427
 			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
428 428
 			array(
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 				'calculate' => array(
434 434
 					'required' => false,
435 435
 					'default' => '',
436
-					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model )
436
+					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model)
437 437
 				)
438 438
 			),
439 439
 			$model,
@@ -451,13 +451,13 @@  discard block
 block discarded – undo
451 451
 	 * @return array    describing the args acceptable when querying this model
452 452
 	 * @throws \EE_Error
453 453
 	 */
454
-	protected function _get_read_query_params( \EEM_Base $model, $version ) {
454
+	protected function _get_read_query_params(\EEM_Base $model, $version) {
455 455
 		$default_orderby = array();
456
-		foreach( $model->get_combined_primary_key_fields() as $key_field ) {
457
-			$default_orderby[ $key_field->get_name() ] = 'ASC';
456
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
457
+			$default_orderby[$key_field->get_name()] = 'ASC';
458 458
 		}
459 459
 		return array_merge(
460
-			$this->_get_response_selection_query_params( $model, $version ),
460
+			$this->_get_response_selection_query_params($model, $version),
461 461
 			array(
462 462
 				'where' => array(
463 463
 					'required' => false,
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	 */
495 495
 	protected function _register_config_routes() {
496 496
 		$config_routes = array();
497
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
498
-			$config_routes[ self::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version,	$hidden_endpoint );
497
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
498
+			$config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
499 499
 		}
500 500
 		return $config_routes;
501 501
 	}
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @param boolean $hidden_endpoint
507 507
 	 * @return array
508 508
 	 */
509
-	protected function _get_config_route_data_for_version( $version, $hidden_endpoint ) {
509
+	protected function _get_config_route_data_for_version($version, $hidden_endpoint) {
510 510
 		return array(
511 511
 			'config' => array(
512 512
 				array(
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	protected function _register_meta_routes() {
529 529
 		$meta_routes = array();
530
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
531
-			$meta_routes[ self::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( $version, $hidden_endpoint );
530
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
531
+			$meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version, $hidden_endpoint);
532 532
 		}
533 533
 		return $meta_routes;
534 534
 	}
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @param boolean $hidden_endpoint
540 540
 	 * @return array
541 541
 	 */
542
-	protected function _get_meta_route_data_for_version( $version, $hidden_endpoint = false ) {
542
+	protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) {
543 543
 		return array(
544 544
 			'resources'  => array(
545 545
 				array(
@@ -561,13 +561,13 @@  discard block
 block discarded – undo
561 561
 	 * @param array $route_data
562 562
 	 * @return array
563 563
 	 */
564
-	public static function hide_old_endpoints( $route_data ) {
565
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
566
-			foreach( $relative_urls as $endpoint => $routes ) {
567
-				foreach( $routes as $route ) {
568
-					if( $route[ 'hidden_endpoint' ] ) {
569
-						$full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' );
570
-						unset( $route_data[ $full_route ] );
564
+	public static function hide_old_endpoints($route_data) {
565
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
566
+			foreach ($relative_urls as $endpoint => $routes) {
567
+				foreach ($routes as $route) {
568
+					if ($route['hidden_endpoint']) {
569
+						$full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');
570
+						unset($route_data[$full_route]);
571 571
 					}
572 572
 				}
573 573
 			}
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	public static function latest_rest_api_version() {
608 608
 		$versions_served = \EED_Core_Rest_Api::versions_served();
609
-		$versions_served_keys = array_keys( $versions_served );
610
-		return end( $versions_served_keys );
609
+		$versions_served_keys = array_keys($versions_served);
610
+		return end($versions_served_keys);
611 611
 	}
612 612
 
613 613
 	/**
@@ -621,32 +621,32 @@  discard block
 block discarded – undo
621 621
 	public static function versions_served() {
622 622
 		$versions_served = array();
623 623
 		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
624
-		$lowest_compatible_version = end( $possibly_served_versions);
625
-		reset( $possibly_served_versions );
626
-		$versions_served_historically = array_keys( $possibly_served_versions );
627
-		$latest_version = end( $versions_served_historically );
628
-		reset( $versions_served_historically );
624
+		$lowest_compatible_version = end($possibly_served_versions);
625
+		reset($possibly_served_versions);
626
+		$versions_served_historically = array_keys($possibly_served_versions);
627
+		$latest_version = end($versions_served_historically);
628
+		reset($versions_served_historically);
629 629
 		//for each version of core we have ever served:
630
-		foreach ( $versions_served_historically as $key_versioned_endpoint ) {
630
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
631 631
 			//if it's not above the current core version, and it's compatible with the current version of core
632
-			if( $key_versioned_endpoint == $latest_version ) {
632
+			if ($key_versioned_endpoint == $latest_version) {
633 633
 				//don't hide the latest version in the index
634
-				$versions_served[ $key_versioned_endpoint ] = false;
635
-			} else if(
634
+				$versions_served[$key_versioned_endpoint] = false;
635
+			} else if (
636 636
 				$key_versioned_endpoint < EED_Core_Rest_Api::core_version()
637 637
 				&& $key_versioned_endpoint >= $lowest_compatible_version
638 638
 			) {
639 639
 				//include, but hide, previous versions which are still supported
640
-				$versions_served[ $key_versioned_endpoint ] = true;
641
-			} elseif(
640
+				$versions_served[$key_versioned_endpoint] = true;
641
+			} elseif (
642 642
 				apply_filters(
643 643
 					'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
644 644
 					false,
645 645
 					$possibly_served_versions
646 646
 				)
647
-			){
647
+			) {
648 648
 				//if a version is no longer supported, don't include it in index or list of versions served
649
-				$versions_served[ $key_versioned_endpoint ] = true;
649
+				$versions_served[$key_versioned_endpoint] = true;
650 650
 			}
651 651
 		}
652 652
 		return $versions_served;
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @return string
660 660
 	 */
661 661
 	public static function core_version() {
662
-		return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) );
662
+		return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
663 663
 	}
664 664
 
665 665
 	/**
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @param  WP $WP
685 685
 	 * @return    void
686 686
 	 */
687
-	public function run( $WP ) {
687
+	public function run($WP) {
688 688
 
689 689
 	}
690 690
 
Please login to merge, or discard this patch.