Completed
Branch FET-10416-autoload-b4-bootstra... (0e880d)
by
unknown
104:12 queued 92:13
created
core/EE_Encryption.core.php 1 patch
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php use EventEspresso\core\interfaces\InterminableInterface;
1
+<?php 
2 2
 
3 3
 defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
4 4
 
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -42,51 +42,51 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param \Registrations_Admin_Page $admin_page
44 44
 	 */
45
-	public function __construct( $admin_page ) {
46
-		parent::__construct( $admin_page );
45
+	public function __construct($admin_page) {
46
+		parent::__construct($admin_page);
47 47
 		$this->_status = $this->_admin_page->get_registration_status_array();
48 48
 	}
49 49
 
50 50
 
51 51
 
52 52
 	protected function _setup_data() {
53
-		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page )
54
-			: $this->_admin_page->get_event_attendees( $this->_per_page, false, true );
53
+		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55 55
 		$this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56 56
 			$this->_per_page,
57 57
 			true
58
-		) : $this->_admin_page->get_event_attendees( $this->_per_page, true, true );
58
+		) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59 59
 	}
60 60
 
61 61
 
62 62
 
63 63
 	protected function _set_properties() {
64
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
64
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65 65
 		$this->_wp_list_args = array(
66
-			'singular' => __( 'registrant', 'event_espresso' ),
67
-			'plural'   => __( 'registrants', 'event_espresso' ),
66
+			'singular' => __('registrant', 'event_espresso'),
67
+			'plural'   => __('registrants', 'event_espresso'),
68 68
 			'ajax'     => true,
69 69
 			'screen'   => $this->_admin_page->get_current_screen()->id,
70 70
 		);
71 71
 		$columns = array();
72 72
 		//$columns['_Reg_Status'] = '';
73
-		if ( ! empty( $evt_id ) ) {
73
+		if ( ! empty($evt_id)) {
74 74
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
75 75
 			$this->_has_checkbox_column = true;
76 76
 		}
77 77
 		$this->_columns = array(
78 78
 			'_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
79
-			'ATT_name'            => __( 'Registrant', 'event_espresso' ),
80
-			'ATT_email'           => __( 'Email Address', 'event_espresso' ),
81
-			'Event'               => __( 'Event', 'event_espresso' ),
82
-			'PRC_name'            => __( 'TKT Option', 'event_espresso' ),
83
-			'_REG_final_price'    => __( 'Price', 'event_espresso' ),
84
-			'TXN_paid'            => __( 'Paid', 'event_espresso' ),
85
-			'TXN_total'           => __( 'Total', 'event_espresso' ),
79
+			'ATT_name'            => __('Registrant', 'event_espresso'),
80
+			'ATT_email'           => __('Email Address', 'event_espresso'),
81
+			'Event'               => __('Event', 'event_espresso'),
82
+			'PRC_name'            => __('TKT Option', 'event_espresso'),
83
+			'_REG_final_price'    => __('Price', 'event_espresso'),
84
+			'TXN_paid'            => __('Paid', 'event_espresso'),
85
+			'TXN_total'           => __('Total', 'event_espresso'),
86 86
 		);
87
-		$this->_columns = array_merge( $columns, $this->_columns );
87
+		$this->_columns = array_merge($columns, $this->_columns);
88 88
 		$this->_primary_column = '_REG_att_checked_in';
89
-		if ( ! empty( $evt_id )
89
+		if ( ! empty($evt_id)
90 90
 		     && EE_Registry::instance()->CAP->current_user_can(
91 91
 				'ee_read_registrations',
92 92
 				'espresso_registrations_registrations_reports',
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 					'extra_request' =>
100 100
 						array(
101 101
 							'EVT_ID'     => $evt_id,
102
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ),
102
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
103 103
 						),
104 104
 				),
105 105
 			);
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
                     true,
141 141
                     $this
142 142
                 )
143
-                ? array( 'ATT_lname' => true )
144
-                : array( 'ATT_fname' => true ),
145
-			'Event'    => array( 'Event.EVT.Name' => false ),
143
+                ? array('ATT_lname' => true)
144
+                : array('ATT_fname' => true),
145
+			'Event'    => array('Event.EVT.Name' => false),
146 146
 		);
147 147
 		$this->_hidden_columns = array();
148
-		$this->_evt = EEM_Event::instance()->get_one_by_ID( $evt_id );
148
+		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
149 149
 		$this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
150 150
 	}
151 151
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * @param \EE_Registration $item
156 156
 	 * @return string
157 157
 	 */
158
-	protected function _get_row_class( $item ) {
159
-		$class = parent::_get_row_class( $item );
158
+	protected function _get_row_class($item) {
159
+		$class = parent::_get_row_class($item);
160 160
 		//add status class
161
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
162
-		if ( $this->_has_checkbox_column ) {
161
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
162
+		if ($this->_has_checkbox_column) {
163 163
 			$class .= ' has-checkbox-column';
164 164
 		}
165 165
 		return $class;
@@ -173,61 +173,61 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	protected function _get_table_filters() {
175 175
 		$filters = $where = array();
176
-		$current_EVT_ID = isset( $this->_req_data['event_id'] ) ? (int) $this->_req_data['event_id'] : 0;
177
-		if ( empty( $this->_dtts_for_event ) || count( $this->_dtts_for_event ) === 1 ) {
176
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
177
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
178 178
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
179 179
 			//note possible capability restrictions
180
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
181
-				$where['status**'] = array( '!=', 'private' );
180
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
181
+				$where['status**'] = array('!=', 'private');
182 182
 			}
183
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
183
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
184 184
 				$where['EVT_wp_user'] = get_current_user_id();
185 185
 			}
186 186
 			$events = EEM_Event::instance()->get_all(
187 187
 				array(
188 188
 					$where,
189
-					'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ),
189
+					'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
190 190
 				)
191 191
 			);
192 192
 			$evts[] = array(
193 193
 				'id'   => 0,
194
-				'text' => __( 'To toggle Check-in status, select an event', 'event_espresso' ),
194
+				'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
195 195
 			);
196 196
 			$checked = 'checked';
197 197
 			/** @var EE_Event $evt */
198
-			foreach ( $events as $evt ) {
198
+			foreach ($events as $evt) {
199 199
 				//any registrations for this event?
200
-				if ( ! $evt->get_count_of_all_registrations() ) {
200
+				if ( ! $evt->get_count_of_all_registrations()) {
201 201
 					continue;
202 202
 				}
203 203
                                 $evts[] = array(
204 204
 					'id'    => $evt->ID(),
205
-					'text'  => apply_filters('FHEE__EE_Event_Registrations___get_table_filters__event_name', $evt->get( 'EVT_name' ), $evt),
205
+					'text'  => apply_filters('FHEE__EE_Event_Registrations___get_table_filters__event_name', $evt->get('EVT_name'), $evt),
206 206
 					'class' => $evt->is_expired() ? 'ee-expired-event' : '',
207 207
 				);
208
-				if ( $evt->ID() === $current_EVT_ID && $evt->is_expired() ) {
208
+				if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
209 209
 					$checked = '';
210 210
 				}
211 211
 			}
212 212
 			$event_filter = '<div class="ee-event-filter">';
213
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts, $current_EVT_ID );
213
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
214 214
 			$event_filter .= '<span class="ee-event-filter-toggle">';
215
-			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
216
-			$event_filter .= __( 'Hide Expired Events', 'event_espresso' );
215
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> ';
216
+			$event_filter .= __('Hide Expired Events', 'event_espresso');
217 217
 			$event_filter .= '</span>';
218 218
 			$event_filter .= '</div>';
219 219
 			$filters[] = $event_filter;
220 220
 		}
221
-		if ( ! empty( $this->_dtts_for_event ) ) {
221
+		if ( ! empty($this->_dtts_for_event)) {
222 222
 			//DTT datetimes filter
223
-			$this->_cur_dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
224
-			if ( count( $this->_dtts_for_event ) > 1 ) {
225
-				$dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' );
226
-				foreach ( $this->_dtts_for_event as $dtt ) {
223
+			$this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
224
+			if (count($this->_dtts_for_event) > 1) {
225
+				$dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
226
+				foreach ($this->_dtts_for_event as $dtt) {
227 227
                     $datetime_string = $dtt->name();
228
-                    $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
229
-					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
230
-					$dtts[ $dtt->ID() ] = $datetime_string;
228
+                    $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
229
+					$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string;
230
+					$dtts[$dtt->ID()] = $datetime_string;
231 231
 				}
232 232
 				$input = new EE_Select_Input(
233 233
 					$dtts,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					)
239 239
 				);
240 240
 				$filters[] = $input->get_html_for_input();
241
-				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
241
+				$filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
242 242
 			}
243 243
 		}
244 244
 		return $filters;
@@ -257,22 +257,22 @@  discard block
 block discarded – undo
257 257
 	 * @throws \EE_Error
258 258
 	 */
259 259
 	protected function _get_total_event_attendees() {
260
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false;
260
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
261 261
 		$DTT_ID = $this->_cur_dtt_id;
262 262
 		$query_params = array();
263
-		if ( $EVT_ID ) {
263
+		if ($EVT_ID) {
264 264
 			$query_params[0]['EVT_ID'] = $EVT_ID;
265 265
 		}
266 266
 		//if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
267
-		if ( $DTT_ID ) {
267
+		if ($DTT_ID) {
268 268
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
269 269
 		}
270 270
 		$status_ids_array = apply_filters(
271 271
 			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
272
-			array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved )
272
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
273 273
 		);
274
-		$query_params[0]['STS_ID'] = array( 'IN', $status_ids_array );
275
-		return EEM_Registration::instance()->count( $query_params );
274
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
275
+		return EEM_Registration::instance()->count($query_params);
276 276
 	}
277 277
 
278 278
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @param \EE_Registration $item
282 282
 	 * @return string
283 283
 	 */
284
-	public function column__Reg_Status( EE_Registration $item ) {
285
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
284
+	public function column__Reg_Status(EE_Registration $item) {
285
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
286 286
 	}
287 287
 
288 288
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	 * @return string
293 293
 	 * @throws \EE_Error
294 294
 	 */
295
-	public function column_cb( $item ) {
296
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
295
+	public function column_cb($item) {
296
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
297 297
 	}
298 298
 
299 299
 
@@ -305,20 +305,20 @@  discard block
 block discarded – undo
305 305
 	 * @return string
306 306
 	 * @throws \EE_Error
307 307
 	 */
308
-	public function column__REG_att_checked_in( EE_Registration $item ) {
308
+	public function column__REG_att_checked_in(EE_Registration $item) {
309 309
 		$attendee = $item->attendee();
310 310
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
311 311
 
312
-		if ( $this->_cur_dtt_id === 0 && count( $this->_dtts_for_event ) === 1 ) {
312
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
313 313
 			$latest_related_datetime = $item->get_latest_related_datetime();
314
-			if ( $latest_related_datetime instanceof EE_Datetime ) {
314
+			if ($latest_related_datetime instanceof EE_Datetime) {
315 315
 				$this->_cur_dtt_id = $latest_related_datetime->ID();
316 316
 			}
317 317
 		}
318 318
 
319
-		$checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id );
320
-		$nonce = wp_create_nonce( 'checkin_nonce' );
321
-		$toggle_active = ! empty ( $this->_cur_dtt_id )
319
+		$checkinstatus = $item->check_in_status_for_datetime($this->_cur_dtt_id);
320
+		$nonce = wp_create_nonce('checkin_nonce');
321
+		$toggle_active = ! empty ($this->_cur_dtt_id)
322 322
 		                 && EE_Registry::instance()->CAP->current_user_can(
323 323
 			'ee_edit_checkin',
324 324
 			'espresso_registrations_toggle_checkin_status',
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 		)
327 327
 			? ' clickable trigger-checkin'
328 328
 			: '';
329
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
330
-		return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"'
331
-		       . ' data-_regid="' . $item->ID() . '"'
332
-		       . ' data-dttid="' . $this->_cur_dtt_id . '"'
333
-		       . ' data-nonce="' . $nonce . '">'
329
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
330
+		return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'"'
331
+		       . ' data-_regid="'.$item->ID().'"'
332
+		       . ' data-dttid="'.$this->_cur_dtt_id.'"'
333
+		       . ' data-nonce="'.$nonce.'">'
334 334
 		       . '</span>'
335 335
 		       . $mobile_view_content;
336 336
 	}
@@ -342,21 +342,21 @@  discard block
 block discarded – undo
342 342
 	 * @return mixed|string|void
343 343
 	 * @throws \EE_Error
344 344
 	 */
345
-	public function column_ATT_name( EE_Registration $item ) {
345
+	public function column_ATT_name(EE_Registration $item) {
346 346
 		$attendee = $item->attendee();
347
-		if ( ! $attendee instanceof EE_Attendee ) {
348
-			return __( 'No contact record for this registration.', 'event_espresso' );
347
+		if ( ! $attendee instanceof EE_Attendee) {
348
+			return __('No contact record for this registration.', 'event_espresso');
349 349
 		}
350 350
 		// edit attendee link
351 351
 		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
352
-			array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ),
352
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
353 353
 			REG_ADMIN_URL
354 354
 		);
355 355
 		$name_link = EE_Registry::instance()->CAP->current_user_can(
356 356
 			'ee_edit_contacts',
357 357
 			'espresso_registrations_edit_attendee'
358 358
 		)
359
-			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">'
359
+			? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
360 360
 			    . $item->attendee()->full_name()
361 361
 			    . '</a>'
362 362
 			: $item->attendee()->full_name();
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
365 365
 			: '';
366 366
 		//add group details
367
-		$name_link .= '&nbsp;' . sprintf( __( '(%s of %s)', 'event_espresso' ), $item->count(), $item->group_size() );
367
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
368 368
 		//add regcode
369 369
 		$link = EE_Admin_Page::add_query_args_and_nonce(
370
-			array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ),
370
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
371 371
 			REG_ADMIN_URL
372 372
 		);
373 373
 		$name_link .= '<br>';
@@ -376,50 +376,50 @@  discard block
 block discarded – undo
376 376
 			'view_registration',
377 377
 			$item->ID()
378 378
 		)
379
-			? '<a href="' . $link . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">'
379
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
380 380
 			  . $item->reg_code()
381 381
 			  . '</a>'
382 382
 			: $item->reg_code();
383 383
 		//status
384 384
 		$name_link .= '<br><span class="ee-status-text-small">';
385
-		$name_link .= EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' );
385
+		$name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
386 386
 		$name_link .= '</span>';
387 387
 		$actions = array();
388 388
 		$DTT_ID = $this->_cur_dtt_id;
389
-		$latest_related_datetime = empty( $DTT_ID ) && ! empty( $this->_req_data['event_id'] ) && $item instanceof EE_Registration
389
+		$latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
390 390
 			? $item->get_latest_related_datetime()
391 391
 			: null;
392 392
 		$DTT_ID = $latest_related_datetime instanceof EE_Datetime
393 393
 			? $latest_related_datetime->ID()
394 394
 			: $DTT_ID;
395
-		if ( ! empty( $DTT_ID )
395
+		if ( ! empty($DTT_ID)
396 396
 		     && EE_Registry::instance()->CAP->current_user_can(
397 397
 				'ee_read_checkins',
398 398
 				'espresso_registrations_registration_checkins'
399 399
 			)
400 400
 		) {
401 401
 			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
402
-				array( 'action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID )
402
+				array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)
403 403
 			);
404 404
 			// get the timestamps for this registration's checkins, related to the selected datetime
405
-			$timestamps = $item->get_many_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ) ) );
406
-			if( ! empty( $timestamps ) ) {
405
+			$timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID)));
406
+			if ( ! empty($timestamps)) {
407 407
 				// get the last timestamp
408
-				$last_timestamp = end( $timestamps );
408
+				$last_timestamp = end($timestamps);
409 409
 				// checked in or checked out?
410
-				$checkin_status = $last_timestamp->get( 'CHK_in' ) 
411
-					? esc_html__( 'Checked In', 'event_espresso' )
412
-					: esc_html__( 'Checked Out', 'event_espresso' );
410
+				$checkin_status = $last_timestamp->get('CHK_in') 
411
+					? esc_html__('Checked In', 'event_espresso')
412
+					: esc_html__('Checked Out', 'event_espresso');
413 413
 				// get timestamp string
414
-				$timestamp_string = $last_timestamp->get_datetime( 'CHK_timestamp' );
415
-				$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__(
414
+				$timestamp_string = $last_timestamp->get_datetime('CHK_timestamp');
415
+				$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__(
416 416
 						'View this registrant\'s check-ins/checkouts for the datetime',
417 417
 						'event_espresso'
418
-					) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>';
418
+					).'">'.$checkin_status.': '.$timestamp_string.'</a>';
419 419
 			}
420 420
 		} 
421
-		return ( ! empty( $DTT_ID ) && ! empty( $timestamps ) ) 
422
-			? sprintf( '%1$s %2$s', $name_link, $this->row_actions( $actions, true ) ) 
421
+		return ( ! empty($DTT_ID) && ! empty($timestamps)) 
422
+			? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) 
423 423
 			: $name_link;
424 424
 	}
425 425
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @param \EE_Registration $item
430 430
 	 * @return string
431 431
 	 */
432
-	public function column_ATT_email( EE_Registration $item ) {
432
+	public function column_ATT_email(EE_Registration $item) {
433 433
 		$attendee = $item->attendee();
434 434
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
435 435
 	}
@@ -441,22 +441,22 @@  discard block
 block discarded – undo
441 441
 	 * @return bool|string
442 442
 	 * @throws \EE_Error
443 443
 	 */
444
-	public function column_Event( EE_Registration $item ) {
444
+	public function column_Event(EE_Registration $item) {
445 445
 		try {
446 446
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
447 447
 			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
448
-				array( 'action' => 'event_registrations', 'event_id' => $event->ID() ),
448
+				array('action' => 'event_registrations', 'event_id' => $event->ID()),
449 449
 				REG_ADMIN_URL
450 450
 			);
451 451
 			$event_label = EE_Registry::instance()->CAP->current_user_can(
452 452
 				'ee_read_checkins',
453 453
 				'espresso_registrations_registration_checkins'
454
-			) ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__(
454
+			) ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__(
455 455
 					'View Checkins for this Event',
456 456
 					'event_espresso'
457
-				) . '">' . $event->name() . '</a>' : $event->name();
458
-		} catch ( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
459
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
457
+				).'">'.$event->name().'</a>' : $event->name();
458
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
459
+			$event_label = esc_html__('Unknown', 'event_espresso');
460 460
 		}
461 461
 		return $event_label;
462 462
 	}
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
 	 * @param \EE_Registration $item
468 468
 	 * @return mixed|string|void
469 469
 	 */
470
-	public function column_PRC_name( EE_Registration $item ) {
471
-		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __( "Unknown", "event_espresso" );
470
+	public function column_PRC_name(EE_Registration $item) {
471
+		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
472 472
 	}
473 473
 
474 474
 
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 	 * @param \EE_Registration $item
480 480
 	 * @return string
481 481
 	 */
482
-	public function column__REG_final_price( EE_Registration $item ) {
483
-		return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
482
+	public function column__REG_final_price(EE_Registration $item) {
483
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
484 484
 	}
485 485
 
486 486
 
@@ -492,13 +492,13 @@  discard block
 block discarded – undo
492 492
 	 * @return string
493 493
 	 * @throws \EE_Error
494 494
 	 */
495
-	public function column_TXN_paid( EE_Registration $item ) {
496
-		if ( $item->count() === 1 ) {
497
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
495
+	public function column_TXN_paid(EE_Registration $item) {
496
+		if ($item->count() === 1) {
497
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
498 498
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
499 499
 			} else {
500 500
 				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
501
-					array( 'action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID() ),
501
+					array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
502 502
 					TXN_ADMIN_URL
503 503
 				);
504 504
 				return EE_Registry::instance()->CAP->current_user_can(
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
 				    . '" href="'
512 512
 				    . $view_txn_lnk_url
513 513
 				    . '"  title="'
514
-				    . esc_attr__( 'View Transaction', 'event_espresso' )
514
+				    . esc_attr__('View Transaction', 'event_espresso')
515 515
 				    . '">
516 516
 						'
517 517
 				    . $item->transaction()->pretty_paid()
518 518
 				    . '
519 519
 					</a>
520
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
520
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
521 521
 			}
522 522
 		} else {
523 523
 			return '<span class="reg-pad-rght"></span>';
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
 	 * @return string
534 534
 	 * @throws \EE_Error
535 535
 	 */
536
-	public function column_TXN_total( EE_Registration $item ) {
536
+	public function column_TXN_total(EE_Registration $item) {
537 537
 		$txn = $item->transaction();
538
-		$view_txn_url = add_query_arg( array( 'action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
539
-		if ( $item->get( 'REG_count' ) === 1 ) {
538
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
539
+		if ($item->get('REG_count') === 1) {
540 540
 			$line_total_obj = $txn->total_line_item();
541 541
 			$txn_total = $line_total_obj instanceof EE_Line_Item
542
-				? $line_total_obj->get_pretty( 'LIN_total' )
542
+				? $line_total_obj->get_pretty('LIN_total')
543 543
 				: __(
544 544
 					'View Transaction',
545 545
 					'event_espresso'
@@ -550,10 +550,10 @@  discard block
 block discarded – undo
550 550
 			) ? '<a href="'
551 551
 			    . $view_txn_url
552 552
 			    . '" title="'
553
-			    . esc_attr__( 'View Transaction', 'event_espresso' )
553
+			    . esc_attr__('View Transaction', 'event_espresso')
554 554
 			    . '"><span class="reg-pad-rght">'
555 555
 			    . $txn_total
556
-			    . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
556
+			    . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
557 557
 		} else {
558 558
 			return '<span class="reg-pad-rght"></span>';
559 559
 		}
Please login to merge, or discard this patch.
core/exceptions/ExceptionStackTraceDisplay.php 2 patches
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use ReflectionException;
8 8
 
9 9
 if (! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -25,53 +25,53 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 
28
-    /**
29
-     * @param Exception $exception
30
-     * @throws Exception
31
-     */
32
-    public function __construct(Exception $exception)
33
-    {
34
-        if (WP_DEBUG && ! defined('EE_TESTS_DIR')) {
35
-            $this->displayException($exception);
36
-        } else {
37
-            throw $exception;
38
-        }
39
-    }
28
+	/**
29
+	 * @param Exception $exception
30
+	 * @throws Exception
31
+	 */
32
+	public function __construct(Exception $exception)
33
+	{
34
+		if (WP_DEBUG && ! defined('EE_TESTS_DIR')) {
35
+			$this->displayException($exception);
36
+		} else {
37
+			throw $exception;
38
+		}
39
+	}
40 40
 
41 41
 
42 42
 
43
-    /**
44
-     * @access protected
45
-     * @param Exception $exception
46
-     * @throws ReflectionException
47
-     */
48
-    protected function displayException(Exception $exception)
49
-    {
50
-        $error_code = '';
51
-        $trace_details = '';
52
-        $time = time();
53
-        $trace = $exception->getTrace();
54
-        // get separate user and developer messages if they exist
55
-        $msg = explode('||', $exception->getMessage());
56
-        $user_msg = $msg[0];
57
-        $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
58
-        $msg = WP_DEBUG ? $dev_msg : $user_msg;
59
-        // start gathering output
60
-        $output = $this->exceptionStyles();
61
-        $output .= '
43
+	/**
44
+	 * @access protected
45
+	 * @param Exception $exception
46
+	 * @throws ReflectionException
47
+	 */
48
+	protected function displayException(Exception $exception)
49
+	{
50
+		$error_code = '';
51
+		$trace_details = '';
52
+		$time = time();
53
+		$trace = $exception->getTrace();
54
+		// get separate user and developer messages if they exist
55
+		$msg = explode('||', $exception->getMessage());
56
+		$user_msg = $msg[0];
57
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
58
+		$msg = WP_DEBUG ? $dev_msg : $user_msg;
59
+		// start gathering output
60
+		$output = $this->exceptionStyles();
61
+		$output .= '
62 62
 <div id="ee-error-message" class="error">';
63
-        if (! WP_DEBUG) {
64
-            $output .= '
63
+		if (! WP_DEBUG) {
64
+			$output .= '
65 65
 	<p>';
66
-        }
67
-        // process trace info
68
-        if (empty($trace)) {
69
-            $trace_details .= __(
70
-                'Sorry, but no trace information was available for this exception.',
71
-                'event_espresso'
72
-            );
73
-        } else {
74
-            $trace_details .= '
66
+		}
67
+		// process trace info
68
+		if (empty($trace)) {
69
+			$trace_details .= __(
70
+				'Sorry, but no trace information was available for this exception.',
71
+				'event_espresso'
72
+			);
73
+		} else {
74
+			$trace_details .= '
75 75
 			<div id="ee-trace-details">
76 76
 			<table width="100%" border="0" cellpadding="5" cellspacing="0">
77 77
 				<tr>
@@ -79,255 +79,255 @@  discard block
 block discarded – undo
79 79
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
80 80
 					<th scope="col" align="left" style="width:40%;">File</th>
81 81
 					<th scope="col" align="left">' . __('Class', 'event_espresso') . '->' . __('Method( arguments )',
82
-                    'event_espresso') . '</th>
82
+					'event_espresso') . '</th>
83 83
 				</tr>';
84
-            $last_on_stack = count($trace) - 1;
85
-            // reverse array so that stack is in proper chronological order
86
-            $sorted_trace = array_reverse($trace);
87
-            foreach ($sorted_trace as $nmbr => $trace) {
88
-                $file = isset($trace['file']) ? $trace['file'] : '';
89
-                $class = isset($trace['class']) ? $trace['class'] : '';
90
-                $type = isset($trace['type']) ? $trace['type'] : '';
91
-                $function = isset($trace['function']) ? $trace['function'] : '';
92
-                $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
93
-                $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args;
94
-                $line = isset($trace['line']) ? $trace['line'] : '';
95
-                $zebra = $nmbr % 2 !== 0 ? ' odd' : '';
96
-                if (empty($file) && ! empty($class)) {
97
-                    $a = new ReflectionClass($class);
98
-                    $file = $a->getFileName();
99
-                    if (empty($line) && ! empty($function)) {
100
-                        $b = new \ReflectionMethod($class, $function);
101
-                        $line = $b->getStartLine();
102
-                    }
103
-                }
104
-                if ($nmbr === $last_on_stack) {
105
-                    $file = $exception->getFile() !== '' ? $exception->getFile() : $file;
106
-                    $line = $exception->getLine() !== '' ? $exception->getLine() : $line;
107
-                    $error_code = $this->generate_error_code($file, $trace['function'], $line);
108
-                }
109
-                $file = \EEH_File::standardise_directory_separators($file);
110
-                $nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
111
-                $line = ! empty($line) ? $line : '&nbsp;';
112
-                $file = ! empty($file) ? $file : '&nbsp;';
113
-                $class_display = ! empty($class) ? $class : '';
114
-                $type = ! empty($type) ? $type : '';
115
-                $function = ! empty($function) ? $function : '';
116
-                $args = ! empty($args) ? '( ' . $args . ' )' : '()';
117
-                $trace_details .= '
84
+			$last_on_stack = count($trace) - 1;
85
+			// reverse array so that stack is in proper chronological order
86
+			$sorted_trace = array_reverse($trace);
87
+			foreach ($sorted_trace as $nmbr => $trace) {
88
+				$file = isset($trace['file']) ? $trace['file'] : '';
89
+				$class = isset($trace['class']) ? $trace['class'] : '';
90
+				$type = isset($trace['type']) ? $trace['type'] : '';
91
+				$function = isset($trace['function']) ? $trace['function'] : '';
92
+				$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
93
+				$args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args;
94
+				$line = isset($trace['line']) ? $trace['line'] : '';
95
+				$zebra = $nmbr % 2 !== 0 ? ' odd' : '';
96
+				if (empty($file) && ! empty($class)) {
97
+					$a = new ReflectionClass($class);
98
+					$file = $a->getFileName();
99
+					if (empty($line) && ! empty($function)) {
100
+						$b = new \ReflectionMethod($class, $function);
101
+						$line = $b->getStartLine();
102
+					}
103
+				}
104
+				if ($nmbr === $last_on_stack) {
105
+					$file = $exception->getFile() !== '' ? $exception->getFile() : $file;
106
+					$line = $exception->getLine() !== '' ? $exception->getLine() : $line;
107
+					$error_code = $this->generate_error_code($file, $trace['function'], $line);
108
+				}
109
+				$file = \EEH_File::standardise_directory_separators($file);
110
+				$nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
111
+				$line = ! empty($line) ? $line : '&nbsp;';
112
+				$file = ! empty($file) ? $file : '&nbsp;';
113
+				$class_display = ! empty($class) ? $class : '';
114
+				$type = ! empty($type) ? $type : '';
115
+				$function = ! empty($function) ? $function : '';
116
+				$args = ! empty($args) ? '( ' . $args . ' )' : '()';
117
+				$trace_details .= '
118 118
 					<tr>
119 119
 						<td align="right" valign="top" class="'
120
-                                  . $zebra
121
-                                  . '">'
122
-                                  . $nmbr
123
-                                  . '</td>
120
+								  . $zebra
121
+								  . '">'
122
+								  . $nmbr
123
+								  . '</td>
124 124
 						<td align="right" valign="top" class="'
125
-                                  . $zebra
126
-                                  . '">'
127
-                                  . $line
128
-                                  . '</td>
125
+								  . $zebra
126
+								  . '">'
127
+								  . $line
128
+								  . '</td>
129 129
 						<td align="left" valign="top" class="'
130
-                                  . $zebra
131
-                                  . '">'
132
-                                  . $file
133
-                                  . '</td>
130
+								  . $zebra
131
+								  . '">'
132
+								  . $file
133
+								  . '</td>
134 134
 						<td align="left" valign="top" class="'
135
-                                  . $zebra
136
-                                  . '">'
137
-                                  . $class_display
138
-                                  . $type
139
-                                  . $function
140
-                                  . $args
141
-                                  . '</td>
135
+								  . $zebra
136
+								  . '">'
137
+								  . $class_display
138
+								  . $type
139
+								  . $function
140
+								  . $args
141
+								  . '</td>
142 142
 					</tr>';
143
-            }
144
-            $trace_details .= '
143
+			}
144
+			$trace_details .= '
145 145
 			 </table>
146 146
 			</div>';
147
-        }
148
-        $code = $exception->getCode() ? $exception->getCode() : $error_code;
149
-        // add generic non-identifying messages for non-privileged users
150
-        if (! WP_DEBUG) {
151
-            $output .= '<span class="ee-error-user-msg-spn">'
152
-                       . trim($msg)
153
-                       . '</span> &nbsp; <sup>'
154
-                       . $code
155
-                       . '</sup><br />';
156
-        } else {
157
-            // or helpful developer messages if debugging is on
158
-            $output .= '
147
+		}
148
+		$code = $exception->getCode() ? $exception->getCode() : $error_code;
149
+		// add generic non-identifying messages for non-privileged users
150
+		if (! WP_DEBUG) {
151
+			$output .= '<span class="ee-error-user-msg-spn">'
152
+					   . trim($msg)
153
+					   . '</span> &nbsp; <sup>'
154
+					   . $code
155
+					   . '</sup><br />';
156
+		} else {
157
+			// or helpful developer messages if debugging is on
158
+			$output .= '
159 159
 		<div class="ee-error-dev-msg-dv">
160 160
 			<p class="ee-error-dev-msg-pg">
161 161
 				'
162
-                       . sprintf(
163
-                           __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
164
-                           '<strong class="ee-error-dev-msg-str">',
165
-                           get_class($exception),
166
-                           '</strong>  &nbsp; <span>',
167
-                           $code . '</span>'
168
-                       )
169
-                       . '<br />
162
+					   . sprintf(
163
+						   __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
164
+						   '<strong class="ee-error-dev-msg-str">',
165
+						   get_class($exception),
166
+						   '</strong>  &nbsp; <span>',
167
+						   $code . '</span>'
168
+					   )
169
+					   . '<br />
170 170
 				<span class="big-text">"'
171
-                       . trim($msg)
172
-                       . '"</span><br/>
171
+					   . trim($msg)
172
+					   . '"</span><br/>
173 173
 				<a id="display-ee-error-trace-1'
174
-                       . $time
175
-                       . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
176
-                       . $time
177
-                       . '">
174
+					   . $time
175
+					   . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
176
+					   . $time
177
+					   . '">
178 178
 					'
179
-                       . __('click to view backtrace and class/method details', 'event_espresso')
180
-                       . '
179
+					   . __('click to view backtrace and class/method details', 'event_espresso')
180
+					   . '
181 181
 				</a><br />
182 182
 				'
183
-                       . $exception->getFile()
184
-                       . sprintf(
185
-                           __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
186
-                           ' &nbsp; <span class="small-text lt-grey-text">',
187
-                           $exception->getLine(),
188
-                           '</span>'
189
-                       )
190
-                       . '
183
+					   . $exception->getFile()
184
+					   . sprintf(
185
+						   __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
186
+						   ' &nbsp; <span class="small-text lt-grey-text">',
187
+						   $exception->getLine(),
188
+						   '</span>'
189
+					   )
190
+					   . '
191 191
 			</p>
192 192
 			<div id="ee-error-trace-1'
193
-                       . $time
194
-                       . '-dv" class="ee-error-trace-dv" style="display: none;">
193
+					   . $time
194
+					   . '-dv" class="ee-error-trace-dv" style="display: none;">
195 195
 				'
196
-                       . $trace_details;
197
-            if (! empty($class)) {
198
-                $output .= '
196
+					   . $trace_details;
197
+			if (! empty($class)) {
198
+				$output .= '
199 199
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
200 200
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
201 201
 						<h3>' . __('Class Details', 'event_espresso') . '</h3>';
202
-                $a = new ReflectionClass($class);
203
-                $output .= '
202
+				$a = new ReflectionClass($class);
203
+				$output .= '
204 204
 						<pre>' . $a . '</pre>
205 205
 					</div>
206 206
 				</div>';
207
-            }
208
-            $output .= '
207
+			}
208
+			$output .= '
209 209
 			</div>
210 210
 		</div>
211 211
 		<br />';
212
-        }
213
-        // remove last linebreak
214
-        $output = substr($output, 0, -6);
215
-        if (! WP_DEBUG) {
216
-            $output .= '
212
+		}
213
+		// remove last linebreak
214
+		$output = substr($output, 0, -6);
215
+		if (! WP_DEBUG) {
216
+			$output .= '
217 217
 	</p>';
218
-        }
219
-        $output .= '
218
+		}
219
+		$output .= '
220 220
 </div>';
221
-        $output .= $this->printScripts(true);
222
-        if (defined('DOING_AJAX')) {
223
-            echo wp_json_encode(array('error' => $output));
224
-            exit();
225
-        }
226
-        echo $output;
227
-    }
221
+		$output .= $this->printScripts(true);
222
+		if (defined('DOING_AJAX')) {
223
+			echo wp_json_encode(array('error' => $output));
224
+			exit();
225
+		}
226
+		echo $output;
227
+	}
228 228
 
229 229
 
230 230
 
231
-    /**
232
-     * generate string from exception trace args
233
-     *
234
-     * @param array $arguments
235
-     * @param int   $indent
236
-     * @param bool  $array
237
-     * @return string
238
-     */
239
-    private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false)
240
-    {
241
-        $args = array();
242
-        $args_count = count($arguments);
243
-        if ($args_count > 2) {
244
-            $indent++;
245
-            $args[] = '<br />';
246
-        }
247
-        $x = 0;
248
-        foreach ($arguments as $arg) {
249
-            $x++;
250
-            for ($i = 0; $i < $indent; $i++) {
251
-                $args[] = ' &nbsp;&nbsp; ';
252
-            }
253
-            if (is_string($arg)) {
254
-                if (! $array && strlen($arg) > 75) {
255
-                    $args[] = '<br />';
256
-                    for ($i = 0; $i <= $indent; $i++) {
257
-                        $args[] = ' &nbsp;&nbsp; ';
258
-                    }
259
-                    $args[] = "'" . $arg . "'<br />";
260
-                } else {
261
-                    $args[] = " '" . $arg . "'";
262
-                }
263
-            } elseif (is_array($arg)) {
264
-                $arg_count = count($arg);
265
-                if ($arg_count > 2) {
266
-                    $indent++;
267
-                    $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')';
268
-                    $indent--;
269
-                } else if ($arg_count === 0) {
270
-                    $args[] = ' array()';
271
-                } else {
272
-                    $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )';
273
-                }
274
-            } elseif ($arg === null) {
275
-                $args[] = ' null';
276
-            } elseif (is_bool($arg)) {
277
-                $args[] = $arg ? ' true' : ' false';
278
-            } elseif (is_object($arg)) {
279
-                $args[] = get_class($arg);
280
-            } elseif (is_resource($arg)) {
281
-                $args[] = get_resource_type($arg);
282
-            } else {
283
-                $args[] = $arg;
284
-            }
285
-            if ($x === $args_count) {
286
-                if ($args_count > 2) {
287
-                    $args[] = '<br />';
288
-                    $indent--;
289
-                    for ($i = 1; $i < $indent; $i++) {
290
-                        $args[] = ' &nbsp;&nbsp; ';
291
-                    }
292
-                }
293
-            } else {
294
-                $args[] = $args_count > 2 ? ',<br />' : ', ';
295
-            }
296
-        }
297
-        return implode('', $args);
298
-    }
231
+	/**
232
+	 * generate string from exception trace args
233
+	 *
234
+	 * @param array $arguments
235
+	 * @param int   $indent
236
+	 * @param bool  $array
237
+	 * @return string
238
+	 */
239
+	private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false)
240
+	{
241
+		$args = array();
242
+		$args_count = count($arguments);
243
+		if ($args_count > 2) {
244
+			$indent++;
245
+			$args[] = '<br />';
246
+		}
247
+		$x = 0;
248
+		foreach ($arguments as $arg) {
249
+			$x++;
250
+			for ($i = 0; $i < $indent; $i++) {
251
+				$args[] = ' &nbsp;&nbsp; ';
252
+			}
253
+			if (is_string($arg)) {
254
+				if (! $array && strlen($arg) > 75) {
255
+					$args[] = '<br />';
256
+					for ($i = 0; $i <= $indent; $i++) {
257
+						$args[] = ' &nbsp;&nbsp; ';
258
+					}
259
+					$args[] = "'" . $arg . "'<br />";
260
+				} else {
261
+					$args[] = " '" . $arg . "'";
262
+				}
263
+			} elseif (is_array($arg)) {
264
+				$arg_count = count($arg);
265
+				if ($arg_count > 2) {
266
+					$indent++;
267
+					$args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')';
268
+					$indent--;
269
+				} else if ($arg_count === 0) {
270
+					$args[] = ' array()';
271
+				} else {
272
+					$args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )';
273
+				}
274
+			} elseif ($arg === null) {
275
+				$args[] = ' null';
276
+			} elseif (is_bool($arg)) {
277
+				$args[] = $arg ? ' true' : ' false';
278
+			} elseif (is_object($arg)) {
279
+				$args[] = get_class($arg);
280
+			} elseif (is_resource($arg)) {
281
+				$args[] = get_resource_type($arg);
282
+			} else {
283
+				$args[] = $arg;
284
+			}
285
+			if ($x === $args_count) {
286
+				if ($args_count > 2) {
287
+					$args[] = '<br />';
288
+					$indent--;
289
+					for ($i = 1; $i < $indent; $i++) {
290
+						$args[] = ' &nbsp;&nbsp; ';
291
+					}
292
+				}
293
+			} else {
294
+				$args[] = $args_count > 2 ? ',<br />' : ', ';
295
+			}
296
+		}
297
+		return implode('', $args);
298
+	}
299 299
 
300 300
 
301 301
 
302
-    /**
303
-     * create error code from filepath, function name,
304
-     * and line number where exception or error was thrown
305
-     *
306
-     * @access protected
307
-     * @param string $file
308
-     * @param string $func
309
-     * @param string $line
310
-     * @return string
311
-     */
312
-    protected function generate_error_code($file = '', $func = '', $line = '')
313
-    {
314
-        $file_bits = explode('.', basename($file));
315
-        $error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
316
-        $error_code .= ! empty($func) ? ' - ' . $func : '';
317
-        $error_code .= ! empty($line) ? ' - ' . $line : '';
318
-        return $error_code;
319
-    }
302
+	/**
303
+	 * create error code from filepath, function name,
304
+	 * and line number where exception or error was thrown
305
+	 *
306
+	 * @access protected
307
+	 * @param string $file
308
+	 * @param string $func
309
+	 * @param string $line
310
+	 * @return string
311
+	 */
312
+	protected function generate_error_code($file = '', $func = '', $line = '')
313
+	{
314
+		$file_bits = explode('.', basename($file));
315
+		$error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
316
+		$error_code .= ! empty($func) ? ' - ' . $func : '';
317
+		$error_code .= ! empty($line) ? ' - ' . $line : '';
318
+		return $error_code;
319
+	}
320 320
 
321 321
 
322 322
 
323
-    /**
324
-     * _exception_styles
325
-     *
326
-     * @return string
327
-     */
328
-    private function exceptionStyles()
329
-    {
330
-        return '
323
+	/**
324
+	 * _exception_styles
325
+	 *
326
+	 * @return string
327
+	 */
328
+	private function exceptionStyles()
329
+	{
330
+		return '
331 331
 <style type="text/css">
332 332
 	#ee-error-message {
333 333
 		max-width:90% !important;
@@ -384,30 +384,30 @@  discard block
 block discarded – undo
384 384
 		color: #999;
385 385
 	}
386 386
 </style>';
387
-    }
387
+	}
388 388
 
389 389
 
390 390
 
391
-    /**
392
-     * _print_scripts
393
-     *
394
-     * @param bool $force_print
395
-     * @return string
396
-     */
397
-    private function printScripts($force_print = false)
398
-    {
399
-        if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
400
-            if (wp_script_is('ee_error_js', 'enqueued')) {
401
-                return '';
402
-            }
403
-            if (wp_script_is('ee_error_js', 'registered')) {
404
-                wp_enqueue_style('espresso_default');
405
-                wp_enqueue_style('espresso_custom_css');
406
-                wp_enqueue_script( 'ee_error_js' );
391
+	/**
392
+	 * _print_scripts
393
+	 *
394
+	 * @param bool $force_print
395
+	 * @return string
396
+	 */
397
+	private function printScripts($force_print = false)
398
+	{
399
+		if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
400
+			if (wp_script_is('ee_error_js', 'enqueued')) {
401
+				return '';
402
+			}
403
+			if (wp_script_is('ee_error_js', 'registered')) {
404
+				wp_enqueue_style('espresso_default');
405
+				wp_enqueue_style('espresso_custom_css');
406
+				wp_enqueue_script( 'ee_error_js' );
407 407
 				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
408
-            }
409
-        } else {
410
-            return '
408
+			}
409
+		} else {
410
+			return '
411 411
 <script>
412 412
 /* <![CDATA[ */
413 413
 var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 <script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
418 418
 <script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
419 419
 ';
420
-        }
421
-        return '';
422
-    }
420
+		}
421
+		return '';
422
+	}
423 423
 
424 424
 
425 425
 
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use ReflectionClass;
7 7
 use ReflectionException;
8 8
 
9
-if (! defined('EVENT_ESPRESSO_VERSION')) {
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10 10
     exit('No direct script access allowed');
11 11
 }
12 12
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $output = $this->exceptionStyles();
61 61
         $output .= '
62 62
 <div id="ee-error-message" class="error">';
63
-        if (! WP_DEBUG) {
63
+        if ( ! WP_DEBUG) {
64 64
             $output .= '
65 65
 	<p>';
66 66
         }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 					<th scope="col" align="right" style="width:2.5%;">#</th>
79 79
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
80 80
 					<th scope="col" align="left" style="width:40%;">File</th>
81
-					<th scope="col" align="left">' . __('Class', 'event_espresso') . '->' . __('Method( arguments )',
82
-                    'event_espresso') . '</th>
81
+					<th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__('Method( arguments )',
82
+                    'event_espresso').'</th>
83 83
 				</tr>';
84 84
             $last_on_stack = count($trace) - 1;
85 85
             // reverse array so that stack is in proper chronological order
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 $type = isset($trace['type']) ? $trace['type'] : '';
91 91
                 $function = isset($trace['function']) ? $trace['function'] : '';
92 92
                 $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
93
-                $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args;
93
+                $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' : $args;
94 94
                 $line = isset($trace['line']) ? $trace['line'] : '';
95 95
                 $zebra = $nmbr % 2 !== 0 ? ' odd' : '';
96 96
                 if (empty($file) && ! empty($class)) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 $class_display = ! empty($class) ? $class : '';
114 114
                 $type = ! empty($type) ? $type : '';
115 115
                 $function = ! empty($function) ? $function : '';
116
-                $args = ! empty($args) ? '( ' . $args . ' )' : '()';
116
+                $args = ! empty($args) ? '( '.$args.' )' : '()';
117 117
                 $trace_details .= '
118 118
 					<tr>
119 119
 						<td align="right" valign="top" class="'
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $code = $exception->getCode() ? $exception->getCode() : $error_code;
149 149
         // add generic non-identifying messages for non-privileged users
150
-        if (! WP_DEBUG) {
150
+        if ( ! WP_DEBUG) {
151 151
             $output .= '<span class="ee-error-user-msg-spn">'
152 152
                        . trim($msg)
153 153
                        . '</span> &nbsp; <sup>'
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                            '<strong class="ee-error-dev-msg-str">',
165 165
                            get_class($exception),
166 166
                            '</strong>  &nbsp; <span>',
167
-                           $code . '</span>'
167
+                           $code.'</span>'
168 168
                        )
169 169
                        . '<br />
170 170
 				<span class="big-text">"'
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
                        . '-dv" class="ee-error-trace-dv" style="display: none;">
195 195
 				'
196 196
                        . $trace_details;
197
-            if (! empty($class)) {
197
+            if ( ! empty($class)) {
198 198
                 $output .= '
199 199
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
200 200
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
201
-						<h3>' . __('Class Details', 'event_espresso') . '</h3>';
201
+						<h3>' . __('Class Details', 'event_espresso').'</h3>';
202 202
                 $a = new ReflectionClass($class);
203 203
                 $output .= '
204
-						<pre>' . $a . '</pre>
204
+						<pre>' . $a.'</pre>
205 205
 					</div>
206 206
 				</div>';
207 207
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         }
213 213
         // remove last linebreak
214 214
         $output = substr($output, 0, -6);
215
-        if (! WP_DEBUG) {
215
+        if ( ! WP_DEBUG) {
216 216
             $output .= '
217 217
 	</p>';
218 218
         }
@@ -251,25 +251,25 @@  discard block
 block discarded – undo
251 251
                 $args[] = ' &nbsp;&nbsp; ';
252 252
             }
253 253
             if (is_string($arg)) {
254
-                if (! $array && strlen($arg) > 75) {
254
+                if ( ! $array && strlen($arg) > 75) {
255 255
                     $args[] = '<br />';
256 256
                     for ($i = 0; $i <= $indent; $i++) {
257 257
                         $args[] = ' &nbsp;&nbsp; ';
258 258
                     }
259
-                    $args[] = "'" . $arg . "'<br />";
259
+                    $args[] = "'".$arg."'<br />";
260 260
                 } else {
261
-                    $args[] = " '" . $arg . "'";
261
+                    $args[] = " '".$arg."'";
262 262
                 }
263 263
             } elseif (is_array($arg)) {
264 264
                 $arg_count = count($arg);
265 265
                 if ($arg_count > 2) {
266 266
                     $indent++;
267
-                    $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')';
267
+                    $args[] = ' array('.$this->_convert_args_to_string($arg, $indent, true).')';
268 268
                     $indent--;
269 269
                 } else if ($arg_count === 0) {
270 270
                     $args[] = ' array()';
271 271
                 } else {
272
-                    $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )';
272
+                    $args[] = ' array( '.$this->_convert_args_to_string($arg).' )';
273 273
                 }
274 274
             } elseif ($arg === null) {
275 275
                 $args[] = ' null';
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
     {
314 314
         $file_bits = explode('.', basename($file));
315 315
         $error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
316
-        $error_code .= ! empty($func) ? ' - ' . $func : '';
317
-        $error_code .= ! empty($line) ? ' - ' . $line : '';
316
+        $error_code .= ! empty($func) ? ' - '.$func : '';
317
+        $error_code .= ! empty($line) ? ' - '.$line : '';
318 318
         return $error_code;
319 319
     }
320 320
 
@@ -396,26 +396,26 @@  discard block
 block discarded – undo
396 396
      */
397 397
     private function printScripts($force_print = false)
398 398
     {
399
-        if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
399
+        if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
400 400
             if (wp_script_is('ee_error_js', 'enqueued')) {
401 401
                 return '';
402 402
             }
403 403
             if (wp_script_is('ee_error_js', 'registered')) {
404 404
                 wp_enqueue_style('espresso_default');
405 405
                 wp_enqueue_style('espresso_custom_css');
406
-                wp_enqueue_script( 'ee_error_js' );
407
-				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
406
+                wp_enqueue_script('ee_error_js');
407
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG));
408 408
             }
409 409
         } else {
410 410
             return '
411 411
 <script>
412 412
 /* <![CDATA[ */
413
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
413
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
414 414
 /* ]]> */
415 415
 </script>
416
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
417
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
418
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
416
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
417
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
418
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
419 419
 ';
420 420
         }
421 421
         return '';
Please login to merge, or discard this patch.
admin/extend/messages/Custom_Messages_Template_List_Table.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
      * This provides a count of events using this custom template
152 152
      *
153 153
      * @param  EE_Message_Template_Group $item message_template group data
154
-     * @return string column output
154
+     * @return integer column output
155 155
      */
156 156
     public function column_events($item)
157 157
     {
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -12,246 +12,246 @@
 block discarded – undo
12 12
 class Custom_Messages_Template_List_Table extends Messages_Template_List_Table
13 13
 {
14 14
 
15
-    /**
16
-     * Setup initial data.
17
-     */
18
-    protected function _setup_data()
19
-    {
20
-        $this->_data           = $this->get_admin_page()->get_message_templates(
21
-            $this->_per_page,
22
-            $this->_view,
23
-            false,
24
-            false,
25
-            false
26
-        );
27
-        $this->_all_data_count = $this->get_admin_page()->get_message_templates(
28
-            $this->_per_page,
29
-            $this->_view,
30
-            true,
31
-            true,
32
-            false
33
-        );
34
-    }
15
+	/**
16
+	 * Setup initial data.
17
+	 */
18
+	protected function _setup_data()
19
+	{
20
+		$this->_data           = $this->get_admin_page()->get_message_templates(
21
+			$this->_per_page,
22
+			$this->_view,
23
+			false,
24
+			false,
25
+			false
26
+		);
27
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates(
28
+			$this->_per_page,
29
+			$this->_view,
30
+			true,
31
+			true,
32
+			false
33
+		);
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * Set initial properties
39
-     */
40
-    protected function _set_properties()
41
-    {
42
-        parent::_set_properties();
43
-        $this->_wp_list_args = array(
44
-            'singular' => esc_html__('Message Template Group', 'event_espresso'),
45
-            'plural'   => esc_html__('Message Template', 'event_espresso'),
46
-            'ajax'     => true, //for now,
47
-            'screen'   => $this->get_admin_page()->get_current_screen()->id,
48
-        );
37
+	/**
38
+	 * Set initial properties
39
+	 */
40
+	protected function _set_properties()
41
+	{
42
+		parent::_set_properties();
43
+		$this->_wp_list_args = array(
44
+			'singular' => esc_html__('Message Template Group', 'event_espresso'),
45
+			'plural'   => esc_html__('Message Template', 'event_espresso'),
46
+			'ajax'     => true, //for now,
47
+			'screen'   => $this->get_admin_page()->get_current_screen()->id,
48
+		);
49 49
 
50
-        $this->_columns = array_merge(
51
-            array(
52
-                'cb' => '<input type="checkbox" />',
53
-                'name' => esc_html__('Template Name', 'event_espresso'),
54
-            ),
55
-            $this->_columns,
56
-            array(
57
-                'events' => esc_html__('Events', 'event_espresso'),
58
-                'actions' => ''
59
-            )
60
-        );
61
-    }
50
+		$this->_columns = array_merge(
51
+			array(
52
+				'cb' => '<input type="checkbox" />',
53
+				'name' => esc_html__('Template Name', 'event_espresso'),
54
+			),
55
+			$this->_columns,
56
+			array(
57
+				'events' => esc_html__('Events', 'event_espresso'),
58
+				'actions' => ''
59
+			)
60
+		);
61
+	}
62 62
 
63 63
 
64
-    /**
65
-     * Custom message for when there are no items found.
66
-     *
67
-     * @since 4.3.0
68
-     */
69
-    public function no_items()
70
-    {
71
-        if ($this->_view !== 'trashed') {
72
-            printf(
73
-                esc_html__(
74
-                    '%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.',
75
-                    'event_espresso'
76
-                ),
77
-                '<strong>',
78
-                '</strong>'
79
-            );
80
-        } else {
81
-            parent::no_items();
82
-        }
83
-    }
64
+	/**
65
+	 * Custom message for when there are no items found.
66
+	 *
67
+	 * @since 4.3.0
68
+	 */
69
+	public function no_items()
70
+	{
71
+		if ($this->_view !== 'trashed') {
72
+			printf(
73
+				esc_html__(
74
+					'%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.',
75
+					'event_espresso'
76
+				),
77
+				'<strong>',
78
+				'</strong>'
79
+			);
80
+		} else {
81
+			parent::no_items();
82
+		}
83
+	}
84 84
 
85 85
 
86
-    /**
87
-     * @param EE_Message_Template_Group $item
88
-     * @return string
89
-     */
90
-    public function column_cb($item)
91
-    {
92
-        return sprintf('<input type="checkbox" name="checkbox[%s]" value="1" />', $item->GRP_ID());
93
-    }
86
+	/**
87
+	 * @param EE_Message_Template_Group $item
88
+	 * @return string
89
+	 */
90
+	public function column_cb($item)
91
+	{
92
+		return sprintf('<input type="checkbox" name="checkbox[%s]" value="1" />', $item->GRP_ID());
93
+	}
94 94
 
95 95
 
96
-    /**
97
-     * @param EE_Message_Template_Group $item
98
-     * @return string
99
-     */
100
-    public function column_name($item)
101
-    {
102
-        return '<p>' . $item->name() . '</p>';
103
-    }
96
+	/**
97
+	 * @param EE_Message_Template_Group $item
98
+	 * @return string
99
+	 */
100
+	public function column_name($item)
101
+	{
102
+		return '<p>' . $item->name() . '</p>';
103
+	}
104 104
 
105 105
 
106
-    /**
107
-     * @param EE_Message_Template_Group $item
108
-     * @return string
109
-     */
110
-    public function column_actions($item)
111
-    {
112
-        if (EE_Registry::instance()->CAP->current_user_can(
113
-            'ee_edit_messages',
114
-            'espresso_messages_add_new_message_template'
115
-        )) {
116
-            $create_args = array(
117
-                'GRP_ID'       => $item->ID(),
118
-                'messenger'    => $item->messenger(),
119
-                'message_type' => $item->message_type(),
120
-                'action'       => 'add_new_message_template',
121
-            );
122
-            $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
123
-            return sprintf(
124
-                '<p><a href="%s" class="button button-small">%s</a></p>',
125
-                $create_link,
126
-                esc_html__('Create Custom', 'event_espresso')
127
-            );
128
-        }
129
-        return '';
130
-    }
106
+	/**
107
+	 * @param EE_Message_Template_Group $item
108
+	 * @return string
109
+	 */
110
+	public function column_actions($item)
111
+	{
112
+		if (EE_Registry::instance()->CAP->current_user_can(
113
+			'ee_edit_messages',
114
+			'espresso_messages_add_new_message_template'
115
+		)) {
116
+			$create_args = array(
117
+				'GRP_ID'       => $item->ID(),
118
+				'messenger'    => $item->messenger(),
119
+				'message_type' => $item->message_type(),
120
+				'action'       => 'add_new_message_template',
121
+			);
122
+			$create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL);
123
+			return sprintf(
124
+				'<p><a href="%s" class="button button-small">%s</a></p>',
125
+				$create_link,
126
+				esc_html__('Create Custom', 'event_espresso')
127
+			);
128
+		}
129
+		return '';
130
+	}
131 131
 
132
-    /**
133
-     * Set the view counts on the _views property
134
-     */
135
-    protected function _add_view_counts()
136
-    {
137
-        foreach ($this->_views as $view => $args) {
138
-            $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates(
139
-                $this->_per_page,
140
-                $view,
141
-                true,
142
-                true,
143
-                false
144
-            );
145
-        }
146
-    }
132
+	/**
133
+	 * Set the view counts on the _views property
134
+	 */
135
+	protected function _add_view_counts()
136
+	{
137
+		foreach ($this->_views as $view => $args) {
138
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates(
139
+				$this->_per_page,
140
+				$view,
141
+				true,
142
+				true,
143
+				false
144
+			);
145
+		}
146
+	}
147 147
 
148 148
 
149
-    /**
150
-     * column_events
151
-     * This provides a count of events using this custom template
152
-     *
153
-     * @param  EE_Message_Template_Group $item message_template group data
154
-     * @return string column output
155
-     */
156
-    public function column_events($item)
157
-    {
158
-        return $item->count_events();
159
-    }
149
+	/**
150
+	 * column_events
151
+	 * This provides a count of events using this custom template
152
+	 *
153
+	 * @param  EE_Message_Template_Group $item message_template group data
154
+	 * @return string column output
155
+	 */
156
+	public function column_events($item)
157
+	{
158
+		return $item->count_events();
159
+	}
160 160
 
161 161
 
162
-    /**
163
-     * Add additional actions for custom message template list view.
164
-     * @param EE_Message_Template_Group $item
165
-     * @return array
166
-     * @throws EE_Error
167
-     */
168
-    protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item)
169
-    {
170
-        $actions = parent::_get_actions_for_messenger_column($item);
162
+	/**
163
+	 * Add additional actions for custom message template list view.
164
+	 * @param EE_Message_Template_Group $item
165
+	 * @return array
166
+	 * @throws EE_Error
167
+	 */
168
+	protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item)
169
+	{
170
+		$actions = parent::_get_actions_for_messenger_column($item);
171 171
 
172
-        //add additional actions for trash/restore etc.
173
-        $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'   => 'trash_message_template',
174
-                                                                       'id'       => $item->GRP_ID(),
175
-                                                                       'noheader' => true,
176
-        ), EE_MSG_ADMIN_URL);
177
-        // restore link
178
-        $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'   => 'restore_message_template',
179
-                                                                         'id'       => $item->GRP_ID(),
180
-                                                                         'noheader' => true,
181
-        ), EE_MSG_ADMIN_URL);
182
-        // delete price link
183
-        $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'   => 'delete_message_template',
184
-                                                                        'id'       => $item->GRP_ID(),
185
-                                                                        'noheader' => true,
186
-        ), EE_MSG_ADMIN_URL);
172
+		//add additional actions for trash/restore etc.
173
+		$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'   => 'trash_message_template',
174
+																	   'id'       => $item->GRP_ID(),
175
+																	   'noheader' => true,
176
+		), EE_MSG_ADMIN_URL);
177
+		// restore link
178
+		$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'   => 'restore_message_template',
179
+																		 'id'       => $item->GRP_ID(),
180
+																		 'noheader' => true,
181
+		), EE_MSG_ADMIN_URL);
182
+		// delete price link
183
+		$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'   => 'delete_message_template',
184
+																		'id'       => $item->GRP_ID(),
185
+																		'noheader' => true,
186
+		), EE_MSG_ADMIN_URL);
187 187
 
188
-        if (! $item->get('MTP_deleted')
189
-            && EE_Registry::instance()->CAP->current_user_can(
190
-                'ee_delete_message',
191
-                'espresso_messages_trash_message_template',
192
-                $item->ID()
193
-            )
194
-        ) {
195
-            $actions['trash'] = '<a href="'
196
-                                . $trash_lnk_url
197
-                                . '" title="'
198
-                                . esc_attr__('Move Template Group to Trash', 'event_espresso')
199
-                                . '">'
200
-                                . esc_html__('Move to Trash', 'event_espresso')
201
-                                . '</a>';
202
-        } else {
203
-            if (EE_Registry::instance()->CAP->current_user_can(
204
-                'ee_delete_message',
205
-                'espresso_messages_restore_message_template',
206
-                $item->ID()
207
-            )) {
208
-                $actions['restore'] = '<a href="'
209
-                                      . $restore_lnk_url
210
-                                      . '" title="'
211
-                                      . esc_attr__('Restore Message Template', 'event_espresso')
212
-                                      . '">'
213
-                                      . esc_html__('Restore', 'event_espresso') . '</a>';
214
-            }
188
+		if (! $item->get('MTP_deleted')
189
+			&& EE_Registry::instance()->CAP->current_user_can(
190
+				'ee_delete_message',
191
+				'espresso_messages_trash_message_template',
192
+				$item->ID()
193
+			)
194
+		) {
195
+			$actions['trash'] = '<a href="'
196
+								. $trash_lnk_url
197
+								. '" title="'
198
+								. esc_attr__('Move Template Group to Trash', 'event_espresso')
199
+								. '">'
200
+								. esc_html__('Move to Trash', 'event_espresso')
201
+								. '</a>';
202
+		} else {
203
+			if (EE_Registry::instance()->CAP->current_user_can(
204
+				'ee_delete_message',
205
+				'espresso_messages_restore_message_template',
206
+				$item->ID()
207
+			)) {
208
+				$actions['restore'] = '<a href="'
209
+									  . $restore_lnk_url
210
+									  . '" title="'
211
+									  . esc_attr__('Restore Message Template', 'event_espresso')
212
+									  . '">'
213
+									  . esc_html__('Restore', 'event_espresso') . '</a>';
214
+			}
215 215
 
216
-            if ($this->_view === 'trashed'
217
-                && EE_Registry::instance()->CAP->current_user_can(
218
-                    'ee_delete_message',
219
-                    'espresso_messages_delete_message_template',
220
-                    $item->ID()
221
-                )) {
222
-                $actions['delete'] = '<a href="'
223
-                                     . $delete_lnk_url
224
-                                     . '" title="'
225
-                                     . esc_attr__('Delete Template Group Permanently', 'event_espresso')
226
-                                     . '">'
227
-                                     . esc_html__('Delete Permanently', 'event_espresso')
228
-                                     . '</a>';
229
-            }
230
-        }
231
-        return $actions;
232
-    }
216
+			if ($this->_view === 'trashed'
217
+				&& EE_Registry::instance()->CAP->current_user_can(
218
+					'ee_delete_message',
219
+					'espresso_messages_delete_message_template',
220
+					$item->ID()
221
+				)) {
222
+				$actions['delete'] = '<a href="'
223
+									 . $delete_lnk_url
224
+									 . '" title="'
225
+									 . esc_attr__('Delete Template Group Permanently', 'event_espresso')
226
+									 . '">'
227
+									 . esc_html__('Delete Permanently', 'event_espresso')
228
+									 . '</a>';
229
+			}
230
+		}
231
+		return $actions;
232
+	}
233 233
 
234 234
 
235
-    /**
236
-     * Generate dropdown filter select input for messengers
237
-     * @param bool $global
238
-     * @return string
239
-     * @throws EE_Error
240
-     */
241
-    protected function _get_messengers_dropdown_filter($global = true)
242
-    {
243
-        return parent::_get_messengers_dropdown_filter(false);
244
-    }
235
+	/**
236
+	 * Generate dropdown filter select input for messengers
237
+	 * @param bool $global
238
+	 * @return string
239
+	 * @throws EE_Error
240
+	 */
241
+	protected function _get_messengers_dropdown_filter($global = true)
242
+	{
243
+		return parent::_get_messengers_dropdown_filter(false);
244
+	}
245 245
 
246 246
 
247
-    /**
248
-     * Generate dropdown filter select input for message types
249
-     * @param bool $global
250
-     * @return string
251
-     * @throws EE_Error
252
-     */
253
-    protected function _get_message_types_dropdown_filter($global = true)
254
-    {
255
-        return parent::_get_message_types_dropdown_filter(false);
256
-    }
247
+	/**
248
+	 * Generate dropdown filter select input for message types
249
+	 * @param bool $global
250
+	 * @return string
251
+	 * @throws EE_Error
252
+	 */
253
+	protected function _get_message_types_dropdown_filter($global = true)
254
+	{
255
+		return parent::_get_message_types_dropdown_filter(false);
256
+	}
257 257
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     protected function _setup_data()
19 19
     {
20
-        $this->_data           = $this->get_admin_page()->get_message_templates(
20
+        $this->_data = $this->get_admin_page()->get_message_templates(
21 21
             $this->_per_page,
22 22
             $this->_view,
23 23
             false,
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function column_name($item)
101 101
     {
102
-        return '<p>' . $item->name() . '</p>';
102
+        return '<p>'.$item->name().'</p>';
103 103
     }
104 104
 
105 105
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                                                                         'noheader' => true,
186 186
         ), EE_MSG_ADMIN_URL);
187 187
 
188
-        if (! $item->get('MTP_deleted')
188
+        if ( ! $item->get('MTP_deleted')
189 189
             && EE_Registry::instance()->CAP->current_user_can(
190 190
                 'ee_delete_message',
191 191
                 'espresso_messages_trash_message_template',
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                                       . '" title="'
211 211
                                       . esc_attr__('Restore Message Template', 'event_espresso')
212 212
                                       . '">'
213
-                                      . esc_html__('Restore', 'event_espresso') . '</a>';
213
+                                      . esc_html__('Restore', 'event_espresso').'</a>';
214 214
             }
215 215
 
216 216
             if ($this->_view === 'trashed'
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Template_List_Table.class.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     protected function _setup_data()
29 29
     {
30
-        $this->_data           = $this->get_admin_page()->get_message_templates(
30
+        $this->_data = $this->get_admin_page()->get_message_templates(
31 31
             $this->_per_page,
32 32
             $this->_view,
33 33
             false
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             'ajax'     => true, //for now,
53 53
             'screen'   => $this->get_admin_page()->get_current_screen()->id,
54 54
         );
55
-        $this->_columns      = array(
55
+        $this->_columns = array(
56 56
             //'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
57 57
             'message_type' => esc_html__('Message Type', 'event_espresso'),
58 58
             'messenger'    => esc_html__('Messenger', 'event_espresso'),
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $message_type = $item->message_type_obj();
81 81
         $messenger    = $item->messenger_obj();
82 82
 
83
-        if (! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
83
+        if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
84 84
             echo '';
85 85
             return;
86 86
         }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function column_description($item)
158 158
     {
159
-        return '<p>' . $item->message_type_obj()->description . '</p>';
159
+        return '<p>'.$item->message_type_obj()->description.'</p>';
160 160
     }
161 161
 
162 162
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         $edit_url = '';
270 270
         // edit link but only if item isn't trashed.
271
-        if (! $item->get('MTP_deleted')
271
+        if ( ! $item->get('MTP_deleted')
272 272
             && EE_Registry::instance()->CAP->current_user_can(
273 273
                 'ee_edit_message',
274 274
                 'espresso_messages_edit_message_template',
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     protected function _get_context_links(EE_Message_Template_Group $item)
296 296
     {
297 297
         //first check if we even show the context links or not.
298
-        if (! EE_Registry::instance()->CAP->current_user_can(
298
+        if ( ! EE_Registry::instance()->CAP->current_user_can(
299 299
             'ee_edit_message',
300 300
             'espresso_messages_edit_message_template',
301 301
             $item->ID()
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                              && $context_templates[$context]['to'] instanceof EE_Message_Template
315 315
                 ? $context_templates[$context]['to']->get('MTP_content')
316 316
                 : null;
317
-            $inactive      = empty($mtp_to)
317
+            $inactive = empty($mtp_to)
318 318
                              && ! empty($context_templates[$context]['to'])
319 319
                 ? ' class="mtp-inactive"'
320 320
                 : '';
@@ -324,15 +324,15 @@  discard block
 block discarded – undo
324 324
                 'id'      => $item->GRP_ID(),
325 325
                 'context' => $context,
326 326
             ), EE_MSG_ADMIN_URL);
327
-            $ctxt[]        =  '<a' . $inactive
328
-                  . ' href="' . $edit_link . '"'
329
-                  . ' class="' . $item->message_type() . '-' . $context . '-edit-link"'
330
-                  . ' title="' . esc_attr__('Edit Context', 'event_espresso') . '">'
327
+            $ctxt[] = '<a'.$inactive
328
+                  . ' href="'.$edit_link.'"'
329
+                  . ' class="'.$item->message_type().'-'.$context.'-edit-link"'
330
+                  . ' title="'.esc_attr__('Edit Context', 'event_espresso').'">'
331 331
                   . $context_title
332 332
                   . '</a>';
333 333
         }
334 334
 
335
-        return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])) . implode(' | ', $ctxt);
335
+        return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])).implode(' | ', $ctxt);
336 336
     }
337 337
 
338 338
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
     {
347 347
         $edit_url = $this->_get_edit_url($item);
348 348
         return $edit_url
349
-            ? '<a href="' . $edit_url . '"'
350
-              . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">'
349
+            ? '<a href="'.$edit_url.'"'
350
+              . ' title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'
351 351
               . ucwords($item->messenger_obj()->label['singular'])
352 352
               . '</a>'
353 353
             : ucwords($item->messenger_obj()->label['singular']);
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
         $actions = array();
366 366
         if ($edit_url = $this->_get_edit_url($item)) {
367 367
             $actions = array(
368
-                'edit' => '<a href="' . $edit_url . '"'
369
-                          . ' class="' . $item->message_type() . '-edit-link"'
370
-                          . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">'
368
+                'edit' => '<a href="'.$edit_url.'"'
369
+                          . ' class="'.$item->message_type().'-edit-link"'
370
+                          . ' title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'
371 371
                           . esc_html__('Edit', 'event_espresso')
372 372
                           . '</a>'
373 373
             );
Please login to merge, or discard this patch.
Indentation   +365 added lines, -365 removed lines patch added patch discarded remove patch
@@ -13,370 +13,370 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @return Messages_Admin_Page
18
-     */
19
-    public function get_admin_page()
20
-    {
21
-        return $this->_admin_page;
22
-    }
23
-
24
-
25
-    /**
26
-     * Setup data object
27
-     */
28
-    protected function _setup_data()
29
-    {
30
-        $this->_data           = $this->get_admin_page()->get_message_templates(
31
-            $this->_per_page,
32
-            $this->_view,
33
-            false
34
-        );
35
-        $this->_all_data_count = $this->get_admin_page()->get_message_templates(
36
-            $this->_per_page,
37
-            $this->_view,
38
-            true,
39
-            true
40
-        );
41
-    }
42
-
43
-
44
-    /**
45
-     * Set internal properties
46
-     */
47
-    protected function _set_properties()
48
-    {
49
-        $this->_wp_list_args = array(
50
-            'singular' => esc_html__('Message Template Group', 'event_espresso'),
51
-            'plural'   => esc_html__('Message Template', 'event_espresso'),
52
-            'ajax'     => true, //for now,
53
-            'screen'   => $this->get_admin_page()->get_current_screen()->id,
54
-        );
55
-        $this->_columns      = array(
56
-            //'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
57
-            'message_type' => esc_html__('Message Type', 'event_espresso'),
58
-            'messenger'    => esc_html__('Messenger', 'event_espresso'),
59
-            'description'  => esc_html__('Description', 'event_espresso'),
60
-        );
61
-
62
-        $this->_sortable_columns = array(
63
-            'messenger' => array('MTP_messenger' => true),
64
-        );
65
-
66
-        $this->_hidden_columns = array();
67
-    }
68
-
69
-
70
-    /**
71
-     * Overriding the single_row method from parent to verify whether the $item has an accessible
72
-     * message_type or messenger object before generating the row.
73
-     *
74
-     * @param EE_Message_Template_Group $item
75
-     * @return string
76
-     * @throws EE_Error
77
-     */
78
-    public function single_row($item)
79
-    {
80
-        $message_type = $item->message_type_obj();
81
-        $messenger    = $item->messenger_obj();
82
-
83
-        if (! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
84
-            echo '';
85
-            return;
86
-        }
87
-
88
-        parent::single_row($item);
89
-    }
90
-
91
-
92
-    /**
93
-     * @return array
94
-     * @throws EE_Error
95
-     */
96
-    protected function _get_table_filters()
97
-    {
98
-        $filters = array();
99
-
100
-        //get select inputs
101
-        $select_inputs = array(
102
-            $this->_get_messengers_dropdown_filter(),
103
-            $this->_get_message_types_dropdown_filter(),
104
-        );
105
-
106
-        //set filters to select inputs if they aren't empty
107
-        foreach ($select_inputs as $select_input) {
108
-            if ($select_input) {
109
-                $filters[] = $select_input;
110
-            }
111
-        }
112
-        return $filters;
113
-    }
114
-
115
-    /**
116
-     * We're just removing the search box for message templates, not needed.
117
-     *
118
-     * @param string $text
119
-     * @param string $input_id
120
-     * @return string ;
121
-     */
122
-    public function search_box($text, $input_id)
123
-    {
124
-        return '';
125
-    }
126
-
127
-
128
-    /**
129
-     * Add counts to the _views property
130
-     */
131
-    protected function _add_view_counts()
132
-    {
133
-        foreach ($this->_views as $view => $args) {
134
-            $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates(
135
-                $this->_per_page,
136
-                $view,
137
-                true,
138
-                true
139
-            );
140
-        }
141
-    }
142
-
143
-
144
-    /**
145
-     * @param EE_Message_Template_Group $item
146
-     * @return string
147
-     */
148
-    public function column_cb($item)
149
-    {
150
-        return '';
151
-    }
152
-
153
-
154
-    /**
155
-     * @param EE_Message_Template_Group $item
156
-     * @return string
157
-     * @throws EE_Error
158
-     */
159
-    public function column_description($item)
160
-    {
161
-        return '<p>' . $item->message_type_obj()->description . '</p>';
162
-    }
163
-
164
-
165
-    /**
166
-     * @param EE_Message_Template_Group $item
167
-     * @return string
168
-     * @throws EE_Error
169
-     */
170
-    public function column_messenger($item)
171
-    {
172
-        //Return the name contents
173
-        return sprintf(
174
-            '%1$s <span style="color:silver">(id:%2$s)</span><br />%3$s%4$s',
175
-            /* $1%s */
176
-            $this->_get_name_link_for_messenger($item),
177
-            /* $2%s */
178
-            $item->GRP_ID(),
179
-            /* %4$s */
180
-            $this->_get_context_links($item),
181
-            /* $3%s */
182
-            $this->row_actions($this->_get_actions_for_messenger_column($item))
183
-        );
184
-    }
185
-
186
-    /**
187
-     * column_message_type
188
-     *
189
-     * @param  EE_Message_Template_Group $item message info for the row
190
-     * @return string message_type name
191
-     * @throws EE_Error
192
-     */
193
-    public function column_message_type($item)
194
-    {
195
-        return ucwords($item->message_type_obj()->label['singular']);
196
-    }
197
-
198
-
199
-    /**
200
-     * Generate dropdown filter select input for messengers
201
-     *
202
-     * @param bool $global
203
-     * @return string
204
-     * @throws EE_Error
205
-     */
206
-    protected function _get_messengers_dropdown_filter($global = true)
207
-    {
208
-        $messenger_options                                   = array();
209
-        $active_message_template_groups_grouped_by_messenger = EEM_Message_Template_Group::instance()->get_all(
210
-            array(
211
-                array(
212
-                    'MTP_is_active' => true,
213
-                    'MTP_is_global' => $global,
214
-                ),
215
-                'group_by' => 'MTP_messenger',
216
-            )
217
-        );
218
-
219
-        foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
220
-            if ($active_message_template_group instanceof EE_Message_Template_Group) {
221
-                $messenger                          = $active_message_template_group->messenger_obj();
222
-                $messenger_label                    = $messenger instanceof EE_messenger
223
-                    ? $messenger->label['singular']
224
-                    : $active_message_template_group->messenger();
225
-                $messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label);
226
-            }
227
-        }
228
-        return $this->get_admin_page()->get_messengers_select_input($messenger_options);
229
-    }
230
-
231
-
232
-    /**
233
-     * Generate dropdown filter select input for message types
234
-     *
235
-     * @param bool $global
236
-     * @return string
237
-     * @throws EE_Error
238
-     */
239
-    protected function _get_message_types_dropdown_filter($global = true)
240
-    {
241
-        $message_type_options                                   = array();
242
-        $active_message_template_groups_grouped_by_message_type = EEM_Message_Template_Group::instance()->get_all(
243
-            array(
244
-                array(
245
-                    'MTP_is_active' => true,
246
-                    'MTP_is_global' => true,
247
-                ),
248
-                'group_by' => 'MTP_message_type',
249
-            )
250
-        );
251
-
252
-        foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
253
-            if ($active_message_template_group instanceof EE_Message_Template_Group) {
254
-                $message_type               = $active_message_template_group->message_type_obj();
255
-                $message_type_label         = $message_type instanceof EE_message_type
256
-                    ? $message_type->label['singular']
257
-                    : $active_message_template_group->message_type();
258
-                $message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label);
259
-            }
260
-        }
261
-        return $this->get_admin_page()->get_message_types_select_input($message_type_options);
262
-    }
263
-
264
-
265
-    /**
266
-     * Return the edit url for the message template group.
267
-     * @param EE_Message_Template_Group $item
268
-     * @return string
269
-     * @throws EE_Error
270
-     */
271
-    protected function _get_edit_url(EE_Message_Template_Group $item)
272
-    {
273
-        $edit_url = '';
274
-        // edit link but only if item isn't trashed.
275
-        if (! $item->get('MTP_deleted')
276
-            && EE_Registry::instance()->CAP->current_user_can(
277
-                'ee_edit_message',
278
-                'espresso_messages_edit_message_template',
279
-                $item->ID()
280
-            )) {
281
-            $edit_url = EE_Admin_Page::add_query_args_and_nonce(
282
-                array(
283
-                    'action' => 'edit_message_template',
284
-                    'id'     => $item->GRP_ID(),
285
-                ),
286
-                EE_MSG_ADMIN_URL
287
-            );
288
-        }
289
-        return $edit_url;
290
-    }
291
-
292
-
293
-    /**
294
-     * Get the context link string for the messenger column.
295
-     * @param EE_Message_Template_Group $item
296
-     * @return string
297
-     * @throws EE_Error
298
-     */
299
-    protected function _get_context_links(EE_Message_Template_Group $item)
300
-    {
301
-        //first check if we even show the context links or not.
302
-        if (! EE_Registry::instance()->CAP->current_user_can(
303
-            'ee_edit_message',
304
-            'espresso_messages_edit_message_template',
305
-            $item->ID()
306
-        )
307
-            || $item->get('MTP_deleted')
308
-        ) {
309
-            return '';
310
-        }
311
-        //we want to display the contexts in here so we need to set them up
312
-        $c_label           = $item->context_label();
313
-        $c_configs         = $item->contexts_config();
314
-        $ctxt              = array();
315
-        $context_templates = $item->context_templates();
316
-        foreach ($context_templates as $context => $template_fields) {
317
-            $mtp_to        = ! empty($context_templates[$context]['to'])
318
-                             && $context_templates[$context]['to'] instanceof EE_Message_Template
319
-                ? $context_templates[$context]['to']->get('MTP_content')
320
-                : null;
321
-            $inactive      = empty($mtp_to)
322
-                             && ! empty($context_templates[$context]['to'])
323
-                ? ' class="mtp-inactive"'
324
-                : '';
325
-            $context_title = ucwords($c_configs[$context]['label']);
326
-            $edit_link     = EE_Admin_Page::add_query_args_and_nonce(array(
327
-                'action'  => 'edit_message_template',
328
-                'id'      => $item->GRP_ID(),
329
-                'context' => $context,
330
-            ), EE_MSG_ADMIN_URL);
331
-            $ctxt[]        =  '<a' . $inactive
332
-                  . ' href="' . $edit_link . '"'
333
-                  . ' class="' . $item->message_type() . '-' . $context . '-edit-link"'
334
-                  . ' title="' . esc_attr__('Edit Context', 'event_espresso') . '">'
335
-                  . $context_title
336
-                  . '</a>';
337
-        }
338
-
339
-        return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])) . implode(' | ', $ctxt);
340
-    }
341
-
342
-
343
-    /**
344
-     * Get the Name string from the messenger column (linked to edit if the context allows for that).
345
-     * @param EE_Message_Template_Group $item
346
-     * @return string
347
-     * @throws EE_Error
348
-     */
349
-    protected function _get_name_link_for_messenger(EE_Message_Template_Group $item)
350
-    {
351
-        $edit_url = $this->_get_edit_url($item);
352
-        return $edit_url
353
-            ? '<a href="' . $edit_url . '"'
354
-              . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">'
355
-              . ucwords($item->messenger_obj()->label['singular'])
356
-              . '</a>'
357
-            : ucwords($item->messenger_obj()->label['singular']);
358
-    }
359
-
360
-
361
-    /**
362
-     * Return the actions array for the messenger column.
363
-     * @param EE_Message_Template_Group $item
364
-     * @return array
365
-     * @throws EE_Error
366
-     */
367
-    protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item)
368
-    {
369
-        $actions = array();
370
-        if ($edit_url = $this->_get_edit_url($item)) {
371
-            $actions = array(
372
-                'edit' => '<a href="' . $edit_url . '"'
373
-                          . ' class="' . $item->message_type() . '-edit-link"'
374
-                          . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">'
375
-                          . esc_html__('Edit', 'event_espresso')
376
-                          . '</a>'
377
-            );
378
-        }
379
-        return $actions;
380
-    }
16
+	/**
17
+	 * @return Messages_Admin_Page
18
+	 */
19
+	public function get_admin_page()
20
+	{
21
+		return $this->_admin_page;
22
+	}
23
+
24
+
25
+	/**
26
+	 * Setup data object
27
+	 */
28
+	protected function _setup_data()
29
+	{
30
+		$this->_data           = $this->get_admin_page()->get_message_templates(
31
+			$this->_per_page,
32
+			$this->_view,
33
+			false
34
+		);
35
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates(
36
+			$this->_per_page,
37
+			$this->_view,
38
+			true,
39
+			true
40
+		);
41
+	}
42
+
43
+
44
+	/**
45
+	 * Set internal properties
46
+	 */
47
+	protected function _set_properties()
48
+	{
49
+		$this->_wp_list_args = array(
50
+			'singular' => esc_html__('Message Template Group', 'event_espresso'),
51
+			'plural'   => esc_html__('Message Template', 'event_espresso'),
52
+			'ajax'     => true, //for now,
53
+			'screen'   => $this->get_admin_page()->get_current_screen()->id,
54
+		);
55
+		$this->_columns      = array(
56
+			//'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
57
+			'message_type' => esc_html__('Message Type', 'event_espresso'),
58
+			'messenger'    => esc_html__('Messenger', 'event_espresso'),
59
+			'description'  => esc_html__('Description', 'event_espresso'),
60
+		);
61
+
62
+		$this->_sortable_columns = array(
63
+			'messenger' => array('MTP_messenger' => true),
64
+		);
65
+
66
+		$this->_hidden_columns = array();
67
+	}
68
+
69
+
70
+	/**
71
+	 * Overriding the single_row method from parent to verify whether the $item has an accessible
72
+	 * message_type or messenger object before generating the row.
73
+	 *
74
+	 * @param EE_Message_Template_Group $item
75
+	 * @return string
76
+	 * @throws EE_Error
77
+	 */
78
+	public function single_row($item)
79
+	{
80
+		$message_type = $item->message_type_obj();
81
+		$messenger    = $item->messenger_obj();
82
+
83
+		if (! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
84
+			echo '';
85
+			return;
86
+		}
87
+
88
+		parent::single_row($item);
89
+	}
90
+
91
+
92
+	/**
93
+	 * @return array
94
+	 * @throws EE_Error
95
+	 */
96
+	protected function _get_table_filters()
97
+	{
98
+		$filters = array();
99
+
100
+		//get select inputs
101
+		$select_inputs = array(
102
+			$this->_get_messengers_dropdown_filter(),
103
+			$this->_get_message_types_dropdown_filter(),
104
+		);
105
+
106
+		//set filters to select inputs if they aren't empty
107
+		foreach ($select_inputs as $select_input) {
108
+			if ($select_input) {
109
+				$filters[] = $select_input;
110
+			}
111
+		}
112
+		return $filters;
113
+	}
114
+
115
+	/**
116
+	 * We're just removing the search box for message templates, not needed.
117
+	 *
118
+	 * @param string $text
119
+	 * @param string $input_id
120
+	 * @return string ;
121
+	 */
122
+	public function search_box($text, $input_id)
123
+	{
124
+		return '';
125
+	}
126
+
127
+
128
+	/**
129
+	 * Add counts to the _views property
130
+	 */
131
+	protected function _add_view_counts()
132
+	{
133
+		foreach ($this->_views as $view => $args) {
134
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates(
135
+				$this->_per_page,
136
+				$view,
137
+				true,
138
+				true
139
+			);
140
+		}
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param EE_Message_Template_Group $item
146
+	 * @return string
147
+	 */
148
+	public function column_cb($item)
149
+	{
150
+		return '';
151
+	}
152
+
153
+
154
+	/**
155
+	 * @param EE_Message_Template_Group $item
156
+	 * @return string
157
+	 * @throws EE_Error
158
+	 */
159
+	public function column_description($item)
160
+	{
161
+		return '<p>' . $item->message_type_obj()->description . '</p>';
162
+	}
163
+
164
+
165
+	/**
166
+	 * @param EE_Message_Template_Group $item
167
+	 * @return string
168
+	 * @throws EE_Error
169
+	 */
170
+	public function column_messenger($item)
171
+	{
172
+		//Return the name contents
173
+		return sprintf(
174
+			'%1$s <span style="color:silver">(id:%2$s)</span><br />%3$s%4$s',
175
+			/* $1%s */
176
+			$this->_get_name_link_for_messenger($item),
177
+			/* $2%s */
178
+			$item->GRP_ID(),
179
+			/* %4$s */
180
+			$this->_get_context_links($item),
181
+			/* $3%s */
182
+			$this->row_actions($this->_get_actions_for_messenger_column($item))
183
+		);
184
+	}
185
+
186
+	/**
187
+	 * column_message_type
188
+	 *
189
+	 * @param  EE_Message_Template_Group $item message info for the row
190
+	 * @return string message_type name
191
+	 * @throws EE_Error
192
+	 */
193
+	public function column_message_type($item)
194
+	{
195
+		return ucwords($item->message_type_obj()->label['singular']);
196
+	}
197
+
198
+
199
+	/**
200
+	 * Generate dropdown filter select input for messengers
201
+	 *
202
+	 * @param bool $global
203
+	 * @return string
204
+	 * @throws EE_Error
205
+	 */
206
+	protected function _get_messengers_dropdown_filter($global = true)
207
+	{
208
+		$messenger_options                                   = array();
209
+		$active_message_template_groups_grouped_by_messenger = EEM_Message_Template_Group::instance()->get_all(
210
+			array(
211
+				array(
212
+					'MTP_is_active' => true,
213
+					'MTP_is_global' => $global,
214
+				),
215
+				'group_by' => 'MTP_messenger',
216
+			)
217
+		);
218
+
219
+		foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
220
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
221
+				$messenger                          = $active_message_template_group->messenger_obj();
222
+				$messenger_label                    = $messenger instanceof EE_messenger
223
+					? $messenger->label['singular']
224
+					: $active_message_template_group->messenger();
225
+				$messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label);
226
+			}
227
+		}
228
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
229
+	}
230
+
231
+
232
+	/**
233
+	 * Generate dropdown filter select input for message types
234
+	 *
235
+	 * @param bool $global
236
+	 * @return string
237
+	 * @throws EE_Error
238
+	 */
239
+	protected function _get_message_types_dropdown_filter($global = true)
240
+	{
241
+		$message_type_options                                   = array();
242
+		$active_message_template_groups_grouped_by_message_type = EEM_Message_Template_Group::instance()->get_all(
243
+			array(
244
+				array(
245
+					'MTP_is_active' => true,
246
+					'MTP_is_global' => true,
247
+				),
248
+				'group_by' => 'MTP_message_type',
249
+			)
250
+		);
251
+
252
+		foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
253
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
254
+				$message_type               = $active_message_template_group->message_type_obj();
255
+				$message_type_label         = $message_type instanceof EE_message_type
256
+					? $message_type->label['singular']
257
+					: $active_message_template_group->message_type();
258
+				$message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label);
259
+			}
260
+		}
261
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
262
+	}
263
+
264
+
265
+	/**
266
+	 * Return the edit url for the message template group.
267
+	 * @param EE_Message_Template_Group $item
268
+	 * @return string
269
+	 * @throws EE_Error
270
+	 */
271
+	protected function _get_edit_url(EE_Message_Template_Group $item)
272
+	{
273
+		$edit_url = '';
274
+		// edit link but only if item isn't trashed.
275
+		if (! $item->get('MTP_deleted')
276
+			&& EE_Registry::instance()->CAP->current_user_can(
277
+				'ee_edit_message',
278
+				'espresso_messages_edit_message_template',
279
+				$item->ID()
280
+			)) {
281
+			$edit_url = EE_Admin_Page::add_query_args_and_nonce(
282
+				array(
283
+					'action' => 'edit_message_template',
284
+					'id'     => $item->GRP_ID(),
285
+				),
286
+				EE_MSG_ADMIN_URL
287
+			);
288
+		}
289
+		return $edit_url;
290
+	}
291
+
292
+
293
+	/**
294
+	 * Get the context link string for the messenger column.
295
+	 * @param EE_Message_Template_Group $item
296
+	 * @return string
297
+	 * @throws EE_Error
298
+	 */
299
+	protected function _get_context_links(EE_Message_Template_Group $item)
300
+	{
301
+		//first check if we even show the context links or not.
302
+		if (! EE_Registry::instance()->CAP->current_user_can(
303
+			'ee_edit_message',
304
+			'espresso_messages_edit_message_template',
305
+			$item->ID()
306
+		)
307
+			|| $item->get('MTP_deleted')
308
+		) {
309
+			return '';
310
+		}
311
+		//we want to display the contexts in here so we need to set them up
312
+		$c_label           = $item->context_label();
313
+		$c_configs         = $item->contexts_config();
314
+		$ctxt              = array();
315
+		$context_templates = $item->context_templates();
316
+		foreach ($context_templates as $context => $template_fields) {
317
+			$mtp_to        = ! empty($context_templates[$context]['to'])
318
+							 && $context_templates[$context]['to'] instanceof EE_Message_Template
319
+				? $context_templates[$context]['to']->get('MTP_content')
320
+				: null;
321
+			$inactive      = empty($mtp_to)
322
+							 && ! empty($context_templates[$context]['to'])
323
+				? ' class="mtp-inactive"'
324
+				: '';
325
+			$context_title = ucwords($c_configs[$context]['label']);
326
+			$edit_link     = EE_Admin_Page::add_query_args_and_nonce(array(
327
+				'action'  => 'edit_message_template',
328
+				'id'      => $item->GRP_ID(),
329
+				'context' => $context,
330
+			), EE_MSG_ADMIN_URL);
331
+			$ctxt[]        =  '<a' . $inactive
332
+				  . ' href="' . $edit_link . '"'
333
+				  . ' class="' . $item->message_type() . '-' . $context . '-edit-link"'
334
+				  . ' title="' . esc_attr__('Edit Context', 'event_espresso') . '">'
335
+				  . $context_title
336
+				  . '</a>';
337
+		}
338
+
339
+		return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])) . implode(' | ', $ctxt);
340
+	}
341
+
342
+
343
+	/**
344
+	 * Get the Name string from the messenger column (linked to edit if the context allows for that).
345
+	 * @param EE_Message_Template_Group $item
346
+	 * @return string
347
+	 * @throws EE_Error
348
+	 */
349
+	protected function _get_name_link_for_messenger(EE_Message_Template_Group $item)
350
+	{
351
+		$edit_url = $this->_get_edit_url($item);
352
+		return $edit_url
353
+			? '<a href="' . $edit_url . '"'
354
+			  . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">'
355
+			  . ucwords($item->messenger_obj()->label['singular'])
356
+			  . '</a>'
357
+			: ucwords($item->messenger_obj()->label['singular']);
358
+	}
359
+
360
+
361
+	/**
362
+	 * Return the actions array for the messenger column.
363
+	 * @param EE_Message_Template_Group $item
364
+	 * @return array
365
+	 * @throws EE_Error
366
+	 */
367
+	protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item)
368
+	{
369
+		$actions = array();
370
+		if ($edit_url = $this->_get_edit_url($item)) {
371
+			$actions = array(
372
+				'edit' => '<a href="' . $edit_url . '"'
373
+						  . ' class="' . $item->message_type() . '-edit-link"'
374
+						  . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">'
375
+						  . esc_html__('Edit', 'event_espresso')
376
+						  . '</a>'
377
+			);
378
+		}
379
+		return $actions;
380
+	}
381 381
 }
382 382
 
Please login to merge, or discard this patch.
modules/venues_archive/EED_Venues_Archive.module.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@
 block discarded – undo
39 39
 	 *  @return 	void
40 40
 	 */
41 41
 	public static function set_hooks() {
42
-        $post_type = get_post_type_object('espresso_venues');
43
-        $custom_post_types = EE_Register_CPTs::get_CPTs();
44
-        EE_Config::register_route(
45
-            $custom_post_types['espresso_venues']['plural_slug'],
46
-            'Venues_Archive',
47
-            'run'
48
-        );
49
-    }
42
+		$post_type = get_post_type_object('espresso_venues');
43
+		$custom_post_types = EE_Register_CPTs::get_CPTs();
44
+		EE_Config::register_route(
45
+			$custom_post_types['espresso_venues']['plural_slug'],
46
+			'Venues_Archive',
47
+			'run'
48
+		);
49
+	}
50 50
 
51 51
 	/**
52 52
 	 * 	set_hooks_admin - for hooking into EE Admin Core, other modules, etc
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venues_Archive
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 * @access    public
66 66
 	 * @param \WP $WP
67 67
 	 */
68
-	public function run( $WP ) {
68
+	public function run($WP) {
69 69
 		// check what template is loaded
70
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
71
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
70
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
71
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
72 72
 	}
73 73
 
74 74
 
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
 	 * @param  string $template
81 81
 	 * @return string
82 82
 	 */
83
-	public function template_include( $template ) {
83
+	public function template_include($template) {
84 84
 		// not a custom template?
85
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) {
85
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') {
86 86
 			EEH_Template::load_espresso_theme_functions();
87 87
 			// then add extra event data via hooks
88
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
88
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
89 89
 			// don't know if theme uses the_excerpt
90
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
90
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
91 91
 			// or the_content
92
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
92
+			add_filter('the_content', array($this, 'venue_details'), 100);
93 93
 			// don't display entry meta because the existing theme will take care of that
94
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
94
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
95 95
 		}
96 96
 		return $template;
97 97
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param  string $title
106 106
 	 * @return string
107 107
 	 */
108
-	public function the_title( $title = '' ) {
108
+	public function the_title($title = '') {
109 109
 		return $title;
110 110
 	}
111 111
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param  string $content
118 118
 	 * @return string
119 119
 	 */
120
-	public function venue_details( $content ) {
120
+	public function venue_details($content) {
121 121
 		global $post;
122 122
 		if (
123 123
 			$post->post_type == 'espresso_venues'
@@ -127,22 +127,22 @@  discard block
 block discarded – undo
127 127
 			// it uses the_content() for displaying the $post->post_content
128 128
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
129 129
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
130
-			remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
131
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
130
+			remove_filter('the_excerpt', array($this, 'venue_details'), 100);
131
+			remove_filter('the_content', array($this, 'venue_details'), 100);
132 132
 			// add filters we want
133
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
134
-			add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
133
+			add_filter('the_content', array($this, 'venue_location'), 110);
134
+			add_filter('the_excerpt', array($this, 'venue_location'), 110);
135 135
 			// now load our template
136
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
136
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
137 137
 			//now add our filter back in, plus some others
138
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
139
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
138
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
139
+			add_filter('the_content', array($this, 'venue_details'), 100);
140 140
 			// remove other filters we added so they won't get applied to the next post
141
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
142
-			remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
141
+			remove_filter('the_content', array($this, 'venue_location'), 110);
142
+			remove_filter('the_excerpt', array($this, 'venue_location'), 110);
143 143
 			// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
144 144
 		}
145
-		return ! empty( $template ) ? $template : $content;
145
+		return ! empty($template) ? $template : $content;
146 146
 	}
147 147
 
148 148
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 * @param  string $content
155 155
 	 * @return string
156 156
 	 */
157
-	public function venue_location( $content ) {
158
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
157
+	public function venue_location($content) {
158
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
159 159
 	}
160 160
 
161 161
 
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function wp_enqueue_scripts() {
171 171
 		// get some style
172
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) {
172
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) {
173 173
 			// first check theme folder
174
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
175
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
176
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
177
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
174
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
175
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
176
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
177
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
178 178
 			}
179
-			wp_enqueue_style( $this->theme );
179
+			wp_enqueue_style($this->theme);
180 180
 		}
181 181
 	}
182 182
 
Please login to merge, or discard this patch.
modules/venue_single/EED_Venue_Single.module.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,20 +32,20 @@
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-    /**
35
+	/**
36 36
 	 * 	set_hooks - for hooking into EE Core, other modules, etc
37 37
 	 *
38 38
 	 *  @access 	public
39 39
 	 *  @return 	void
40 40
 	 */
41 41
 	public static function set_hooks() {
42
-        $custom_post_types = EE_Register_CPTs::get_CPTs();
43
-        EE_Config::register_route(
44
-            $custom_post_types['espresso_venues']['singular_slug'],
45
-            'Venue_Single',
46
-            'run'
47
-        );
48
-    }
42
+		$custom_post_types = EE_Register_CPTs::get_CPTs();
43
+		EE_Config::register_route(
44
+			$custom_post_types['espresso_venues']['singular_slug'],
45
+			'Venue_Single',
46
+			'run'
47
+		);
48
+	}
49 49
 
50 50
 	/**
51 51
 	 * 	set_hooks_admin - for hooking into EE Admin Core, other modules, etc
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venue_Single
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 * @access    public
65 65
 	 * @param \WP $WP
66 66
 	 */
67
-	public function run( $WP ) {
67
+	public function run($WP) {
68 68
 		// check what template is loaded
69
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
70
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
69
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
70
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
71 71
 	}
72 72
 
73 73
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	 * @param  string $template
80 80
 	 * @return string
81 81
 	 */
82
-	public function template_include( $template ) {
82
+	public function template_include($template) {
83 83
 		// not a custom template?
84
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) {
84
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') {
85 85
 			EEH_Template::load_espresso_theme_functions();
86 86
 			// then add extra event data via hooks
87
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
88
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
87
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
88
+			add_filter('the_content', array($this, 'venue_details'), 100);
89 89
 			// don't display entry meta because the existing theme will take car of that
90
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
90
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
91 91
 		}
92 92
 		return $template;
93 93
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @param  string $title
102 102
 	 * @return string
103 103
 	 */
104
-	public function the_title( $title = '' ) {
104
+	public function the_title($title = '') {
105 105
 		return $title;
106 106
 	}
107 107
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param  string $content
114 114
 	 * @return string
115 115
 	 */
116
-	public function venue_details( $content ) {
116
+	public function venue_details($content) {
117 117
 		global $post;
118 118
 		if (
119 119
 			$post->post_type == 'espresso_venues'
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
 			// it uses the_content() for displaying the $post->post_content
124 124
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
125 125
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
126
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
126
+			remove_filter('the_content', array($this, 'venue_details'), 100);
127 127
 			// add filters we want
128
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
128
+			add_filter('the_content', array($this, 'venue_location'), 110);
129 129
 			// now load our template
130
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
130
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
131 131
 			// remove other filters we added so they won't get applied to the next post
132
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
132
+			remove_filter('the_content', array($this, 'venue_location'), 110);
133 133
 		}
134 134
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
135
-		return ! empty( $template ) ? $template : $content;
135
+		return ! empty($template) ? $template : $content;
136 136
 	}
137 137
 
138 138
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 * @param  string $content
145 145
 	 * @return string
146 146
 	 */
147
-	public function venue_location( $content ) {
148
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
147
+	public function venue_location($content) {
148
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
149 149
 	}
150 150
 
151 151
 
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function wp_enqueue_scripts() {
160 160
 		// get some style
161
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) {
161
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) {
162 162
 			// first check theme folder
163
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
164
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
165
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
166
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
163
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
164
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
165
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
166
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
167 167
 			}
168
-			wp_enqueue_style( $this->theme );
169
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
170
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
168
+			wp_enqueue_style($this->theme);
169
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
170
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
171 171
 			}
172 172
 		}
173 173
 	}
Please login to merge, or discard this patch.
modules/event_single/EED_Event_Single.module.php 1 patch
Indentation   +462 added lines, -462 removed lines patch added patch discarded remove patch
@@ -13,467 +13,467 @@  discard block
 block discarded – undo
13 13
 class EED_Event_Single extends EED_Module
14 14
 {
15 15
 
16
-    const EVENT_DETAILS_PRIORITY = 100;
17
-    const EVENT_DATETIMES_PRIORITY = 110;
18
-    const EVENT_TICKETS_PRIORITY = 120;
19
-    const EVENT_VENUES_PRIORITY = 130;
20
-
21
-    /**
22
-     * @type bool $using_get_the_excerpt
23
-     */
24
-    protected static $using_get_the_excerpt = false;
25
-
26
-
27
-    /**
28
-     * @type EE_Template_Part_Manager $template_parts
29
-     */
30
-    protected $template_parts;
31
-
32
-
33
-    /**
34
-     * @return EED_Module|EED_Event_Single
35
-     */
36
-    public static function instance()
37
-    {
38
-        return parent::get_instance(__CLASS__);
39
-    }
40
-
41
-
42
-    /**
43
-     * set_hooks - for hooking into EE Core, other modules, etc
44
-     *
45
-     * @return    void
46
-     */
47
-    public static function set_hooks()
48
-    {
49
-        add_filter('FHEE_run_EE_wp', '__return_true');
50
-        add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
51
-        $custom_post_types = EE_Register_CPTs::get_CPTs();
52
-        EE_Config::register_route(
53
-            $custom_post_types['espresso_events']['singular_slug'],
54
-            'Event_Single',
55
-            'run'
56
-        );
57
-    }
58
-
59
-    /**
60
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
61
-     *
62
-     * @return    void
63
-     */
64
-    public static function set_hooks_admin()
65
-    {
66
-        add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
67
-    }
68
-
69
-
70
-    /**
71
-     * set_definitions
72
-     *
73
-     * @static
74
-     * @return void
75
-     */
76
-    public static function set_definitions()
77
-    {
78
-        define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS);
79
-        define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS);
80
-    }
81
-
82
-
83
-    /**
84
-     * set_config
85
-     *
86
-     * @void
87
-     */
88
-    protected function set_config()
89
-    {
90
-        $this->set_config_section('template_settings');
91
-        $this->set_config_class('EE_Event_Single_Config');
92
-        $this->set_config_name('EED_Event_Single');
93
-    }
94
-
95
-
96
-    /**
97
-     * initialize_template_parts
98
-     *
99
-     * @param EE_Config_Base|EE_Event_Single_Config $config
100
-     * @return EE_Template_Part_Manager
101
-     */
102
-    public function initialize_template_parts(EE_Event_Single_Config $config = null)
103
-    {
104
-        /** @type EE_Event_Single_Config $config */
105
-        $config = $config instanceof EE_Event_Single_Config ? $config : $this->config();
106
-        EEH_Autoloader::instance()->register_template_part_autoloaders();
107
-        $template_parts = new EE_Template_Part_Manager();
108
-        $template_parts->add_template_part(
109
-            'tickets',
110
-            __('Ticket Selector', 'event_espresso'),
111
-            'content-espresso_events-tickets.php',
112
-            $config->display_order_tickets
113
-        );
114
-        $template_parts->add_template_part(
115
-            'datetimes',
116
-            __('Dates and Times', 'event_espresso'),
117
-            'content-espresso_events-datetimes.php',
118
-            $config->display_order_datetimes
119
-        );
120
-        $template_parts->add_template_part(
121
-            'event',
122
-            __('Event Description', 'event_espresso'),
123
-            'content-espresso_events-details.php',
124
-            $config->display_order_event
125
-        );
126
-        $template_parts->add_template_part(
127
-            'venue',
128
-            __('Venue Information', 'event_espresso'),
129
-            'content-espresso_events-venues.php',
130
-            $config->display_order_venue
131
-        );
132
-        do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts);
133
-        return $template_parts;
134
-    }
135
-
136
-
137
-    /**
138
-     * run - initial module setup
139
-     *
140
-     * @param WP $WP
141
-     * @return    void
142
-     */
143
-    public function run($WP)
144
-    {
145
-        // ensure valid EE_Events_Single_Config() object exists
146
-        $this->set_config();
147
-        // check what template is loaded
148
-        add_filter('template_include', array($this, 'template_include'), 999, 1);
149
-        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
150
-        // load css
151
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
152
-    }
153
-
154
-
155
-    /**
156
-     * template_include
157
-     *
158
-     * @param    string $template
159
-     * @return    string
160
-     */
161
-    public function template_include($template)
162
-    {
163
-        global $post;
164
-        /** @type EE_Event_Single_Config $config */
165
-        $config = $this->config();
166
-        if ($config->display_status_banner_single) {
167
-            add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2);
168
-        }
169
-        // not a custom template?
170
-        if (
171
-            !post_password_required($post)
172
-            && (
173
-                apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false)
174
-                || EE_Registry::instance()
175
-                    ->load_core('Front_Controller')
176
-                    ->get_selected_template() !== 'single-espresso_events.php'
177
-            )
178
-
179
-        ) {
180
-            EEH_Template::load_espresso_theme_functions();
181
-            // then add extra event data via hooks
182
-            add_action('loop_start', array('EED_Event_Single', 'loop_start'));
183
-            add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1);
184
-            add_filter(
185
-                'the_content',
186
-                array('EED_Event_Single', 'event_details'),
187
-                EED_Event_Single::EVENT_DETAILS_PRIORITY
188
-            );
189
-            add_action('loop_end', array('EED_Event_Single', 'loop_end'));
190
-            // don't display entry meta because the existing theme will take car of that
191
-            add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
192
-        }
193
-        return $template;
194
-    }
195
-
196
-
197
-    /**
198
-     * loop_start
199
-     *
200
-     * @param    array $wp_query_array an array containing the WP_Query object
201
-     * @return    void
202
-     */
203
-    public static function loop_start($wp_query_array)
204
-    {
205
-        global $post;
206
-        do_action('AHEE_event_details_before_post', $post, $wp_query_array);
207
-    }
208
-
209
-
210
-    /**
211
-     * the_title
212
-     *
213
-     * @param    string $title
214
-     * @param    int $id
215
-     * @return    string
216
-     */
217
-    public static function the_title($title = '', $id = 0)
218
-    {
219
-        global $post;
220
-        return in_the_loop() && $post->ID === (int)$id
221
-            ? espresso_event_status_banner($post->ID) . $title
222
-            : $title;
223
-    }
224
-
225
-
226
-    /**
227
-     * get_the_excerpt
228
-     * kinda hacky, but if a theme is using get_the_excerpt(),
229
-     * then we need to remove our filters on the_content()
230
-     *
231
-     * @param        string $excerpt
232
-     * @return        string
233
-     */
234
-    public static function get_the_excerpt($excerpt = '')
235
-    {
236
-        EED_Event_Single::$using_get_the_excerpt = true;
237
-        add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1);
238
-        return $excerpt;
239
-    }
240
-
241
-
242
-    /**
243
-     * end_get_the_excerpt
244
-     *
245
-     * @param  string $text
246
-     * @return string
247
-     */
248
-    public static function end_get_the_excerpt($text = '')
249
-    {
250
-        EED_Event_Single::$using_get_the_excerpt = false;
251
-        return $text;
252
-    }
253
-
254
-
255
-    /**
256
-     * event_details
257
-     *
258
-     * @param    string $content
259
-     * @return    string
260
-     */
261
-    public static function event_details($content)
262
-    {
263
-        global $post;
264
-        static $current_post_ID = 0;
265
-        if (
266
-            $current_post_ID !== $post->ID
267
-            && $post->post_type === 'espresso_events'
268
-            && !EED_Event_Single::$using_get_the_excerpt
269
-            && !post_password_required()
270
-        ) {
271
-            // Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
272
-            // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early
273
-            // BEFORE headers are sent in order to examine the post content and generate content for the HTML header.
274
-            // We want to allow those plugins to still do their thing and have access to our content, but depending on
275
-            // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
276
-            // so the following allows this filter to be applied multiple times, but only once for real
277
-            $current_post_ID = did_action('loop_start') ? $post->ID : 0;
278
-            if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) {
279
-                // we need to first remove this callback from being applied to the_content()
280
-                // (otherwise it will recurse and blow up the interweb)
281
-                remove_filter(
282
-                    'the_content',
283
-                    array('EED_Event_Single', 'event_details'),
284
-                    EED_Event_Single::EVENT_DETAILS_PRIORITY
285
-                );
286
-                EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts();
287
-                $content = EEH_Template::locate_template('content-espresso_events-details.php');
288
-                $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content);
289
-                add_filter(
290
-                    'the_content',
291
-                    array('EED_Event_Single', 'event_details'),
292
-                    EED_Event_Single::EVENT_DETAILS_PRIORITY
293
-                );
294
-            } else {
295
-                $content = EED_Event_Single::use_filterable_display_order();
296
-            }
297
-        }
298
-        return $content;
299
-    }
300
-
301
-
302
-    /**
303
-     * use_filterable_display_order
304
-     *
305
-     * @return string
306
-     */
307
-    protected static function use_filterable_display_order()
308
-    {
309
-        // since the 'content-espresso_events-details.php' template might be used directly from within a theme,
310
-        // it uses the_content() for displaying the $post->post_content
311
-        // so in order to load a template that uses the_content()
312
-        // from within a callback being used to filter the_content(),
313
-        // we need to first remove this callback from being applied to the_content()
314
-        // (otherwise it will recurse and blow up the interweb)
315
-        remove_filter(
316
-            'the_content',
317
-            array('EED_Event_Single', 'event_details'),
318
-            EED_Event_Single::EVENT_DETAILS_PRIORITY
319
-        );
320
-        //now add additional content
321
-        add_filter(
322
-            'the_content',
323
-            array('EED_Event_Single', 'event_datetimes'),
324
-            EED_Event_Single::EVENT_DATETIMES_PRIORITY,
325
-            1
326
-        );
327
-        add_filter(
328
-            'the_content',
329
-            array('EED_Event_Single', 'event_tickets'),
330
-            EED_Event_Single::EVENT_TICKETS_PRIORITY,
331
-            1
332
-        );
333
-        add_filter(
334
-            'the_content',
335
-            array('EED_Event_Single', 'event_venues'),
336
-            EED_Event_Single::EVENT_VENUES_PRIORITY,
337
-            1
338
-        );
339
-        do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters');
340
-        // now load our template
341
-        $content = EEH_Template::locate_template('content-espresso_events-details.php');
342
-        //now add our filter back in, plus some others
343
-        add_filter(
344
-            'the_content',
345
-            array('EED_Event_Single', 'event_details'),
346
-            EED_Event_Single::EVENT_DETAILS_PRIORITY
347
-        );
348
-        remove_filter(
349
-            'the_content',
350
-            array('EED_Event_Single', 'event_datetimes'),
351
-            EED_Event_Single::EVENT_DATETIMES_PRIORITY
352
-        );
353
-        remove_filter(
354
-            'the_content',
355
-            array('EED_Event_Single', 'event_tickets'),
356
-            EED_Event_Single::EVENT_TICKETS_PRIORITY
357
-        );
358
-        remove_filter(
359
-            'the_content',
360
-            array('EED_Event_Single', 'event_venues'),
361
-            EED_Event_Single::EVENT_VENUES_PRIORITY
362
-        );
363
-        do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters');
364
-        // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
365
-        return $content;
366
-    }
367
-
368
-
369
-    /**
370
-     * event_datetimes - adds datetimes ABOVE content
371
-     *
372
-     * @param        string $content
373
-     * @return        string
374
-     */
375
-    public static function event_datetimes($content)
376
-    {
377
-        return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
378
-    }
379
-
380
-
381
-    /**
382
-     * event_tickets - adds tickets ABOVE content (which includes datetimes)
383
-     *
384
-     * @param        string $content
385
-     * @return        string
386
-     */
387
-    public static function event_tickets($content)
388
-    {
389
-        return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
390
-    }
391
-
392
-
393
-    /**
394
-     * event_venues
395
-     *
396
-     * @param    string $content
397
-     * @return    string
398
-     */
399
-    public static function event_venue($content)
400
-    {
401
-        return EED_Event_Single::event_venues($content);
402
-    }
403
-
404
-
405
-    /**
406
-     * event_venues - adds venues BELOW content
407
-     *
408
-     * @param        string $content
409
-     * @return        string
410
-     */
411
-    public static function event_venues($content)
412
-    {
413
-        return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
414
-    }
415
-
416
-
417
-    /**
418
-     * loop_end
419
-     *
420
-     * @param        array $wp_query_array an array containing the WP_Query object
421
-     * @return        void
422
-     */
423
-    public static function loop_end($wp_query_array)
424
-    {
425
-        global $post;
426
-        do_action('AHEE_event_details_after_post', $post, $wp_query_array);
427
-    }
428
-
429
-
430
-    /**
431
-     * wp_enqueue_scripts
432
-     *
433
-     * @return    void
434
-     */
435
-    public function wp_enqueue_scripts()
436
-    {
437
-        // get some style
438
-        if (
439
-            apply_filters('FHEE_enable_default_espresso_css', TRUE)
440
-            && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)
441
-        ) {
442
-            // first check uploads folder
443
-            if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
444
-                wp_register_style(
445
-                    $this->theme,
446
-                    get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
447
-                    array('dashicons', 'espresso_default')
448
-                );
449
-            } else {
450
-                wp_register_style(
451
-                    $this->theme,
452
-                    EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
453
-                    array('dashicons', 'espresso_default')
454
-                );
455
-            }
456
-            wp_enqueue_script($this->theme);
457
-            if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
458
-                add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
459
-            }
460
-        }
461
-    }
462
-
463
-
464
-    /**
465
-     * display_venue
466
-     *
467
-     * @return    bool
468
-     */
469
-    public static function display_venue()
470
-    {
471
-        /** @type EE_Event_Single_Config $config */
472
-        $config = EED_Event_Single::instance()->config();
473
-        $display_venue = $config->display_venue === null ? true : $config->display_venue;
474
-        $venue_name = EEH_Venue_View::venue_name();
475
-        return $display_venue && !empty($venue_name);
476
-    }
16
+	const EVENT_DETAILS_PRIORITY = 100;
17
+	const EVENT_DATETIMES_PRIORITY = 110;
18
+	const EVENT_TICKETS_PRIORITY = 120;
19
+	const EVENT_VENUES_PRIORITY = 130;
20
+
21
+	/**
22
+	 * @type bool $using_get_the_excerpt
23
+	 */
24
+	protected static $using_get_the_excerpt = false;
25
+
26
+
27
+	/**
28
+	 * @type EE_Template_Part_Manager $template_parts
29
+	 */
30
+	protected $template_parts;
31
+
32
+
33
+	/**
34
+	 * @return EED_Module|EED_Event_Single
35
+	 */
36
+	public static function instance()
37
+	{
38
+		return parent::get_instance(__CLASS__);
39
+	}
40
+
41
+
42
+	/**
43
+	 * set_hooks - for hooking into EE Core, other modules, etc
44
+	 *
45
+	 * @return    void
46
+	 */
47
+	public static function set_hooks()
48
+	{
49
+		add_filter('FHEE_run_EE_wp', '__return_true');
50
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
51
+		$custom_post_types = EE_Register_CPTs::get_CPTs();
52
+		EE_Config::register_route(
53
+			$custom_post_types['espresso_events']['singular_slug'],
54
+			'Event_Single',
55
+			'run'
56
+		);
57
+	}
58
+
59
+	/**
60
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
61
+	 *
62
+	 * @return    void
63
+	 */
64
+	public static function set_hooks_admin()
65
+	{
66
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
67
+	}
68
+
69
+
70
+	/**
71
+	 * set_definitions
72
+	 *
73
+	 * @static
74
+	 * @return void
75
+	 */
76
+	public static function set_definitions()
77
+	{
78
+		define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS);
79
+		define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS);
80
+	}
81
+
82
+
83
+	/**
84
+	 * set_config
85
+	 *
86
+	 * @void
87
+	 */
88
+	protected function set_config()
89
+	{
90
+		$this->set_config_section('template_settings');
91
+		$this->set_config_class('EE_Event_Single_Config');
92
+		$this->set_config_name('EED_Event_Single');
93
+	}
94
+
95
+
96
+	/**
97
+	 * initialize_template_parts
98
+	 *
99
+	 * @param EE_Config_Base|EE_Event_Single_Config $config
100
+	 * @return EE_Template_Part_Manager
101
+	 */
102
+	public function initialize_template_parts(EE_Event_Single_Config $config = null)
103
+	{
104
+		/** @type EE_Event_Single_Config $config */
105
+		$config = $config instanceof EE_Event_Single_Config ? $config : $this->config();
106
+		EEH_Autoloader::instance()->register_template_part_autoloaders();
107
+		$template_parts = new EE_Template_Part_Manager();
108
+		$template_parts->add_template_part(
109
+			'tickets',
110
+			__('Ticket Selector', 'event_espresso'),
111
+			'content-espresso_events-tickets.php',
112
+			$config->display_order_tickets
113
+		);
114
+		$template_parts->add_template_part(
115
+			'datetimes',
116
+			__('Dates and Times', 'event_espresso'),
117
+			'content-espresso_events-datetimes.php',
118
+			$config->display_order_datetimes
119
+		);
120
+		$template_parts->add_template_part(
121
+			'event',
122
+			__('Event Description', 'event_espresso'),
123
+			'content-espresso_events-details.php',
124
+			$config->display_order_event
125
+		);
126
+		$template_parts->add_template_part(
127
+			'venue',
128
+			__('Venue Information', 'event_espresso'),
129
+			'content-espresso_events-venues.php',
130
+			$config->display_order_venue
131
+		);
132
+		do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts);
133
+		return $template_parts;
134
+	}
135
+
136
+
137
+	/**
138
+	 * run - initial module setup
139
+	 *
140
+	 * @param WP $WP
141
+	 * @return    void
142
+	 */
143
+	public function run($WP)
144
+	{
145
+		// ensure valid EE_Events_Single_Config() object exists
146
+		$this->set_config();
147
+		// check what template is loaded
148
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
149
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
150
+		// load css
151
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
152
+	}
153
+
154
+
155
+	/**
156
+	 * template_include
157
+	 *
158
+	 * @param    string $template
159
+	 * @return    string
160
+	 */
161
+	public function template_include($template)
162
+	{
163
+		global $post;
164
+		/** @type EE_Event_Single_Config $config */
165
+		$config = $this->config();
166
+		if ($config->display_status_banner_single) {
167
+			add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2);
168
+		}
169
+		// not a custom template?
170
+		if (
171
+			!post_password_required($post)
172
+			&& (
173
+				apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false)
174
+				|| EE_Registry::instance()
175
+					->load_core('Front_Controller')
176
+					->get_selected_template() !== 'single-espresso_events.php'
177
+			)
178
+
179
+		) {
180
+			EEH_Template::load_espresso_theme_functions();
181
+			// then add extra event data via hooks
182
+			add_action('loop_start', array('EED_Event_Single', 'loop_start'));
183
+			add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1);
184
+			add_filter(
185
+				'the_content',
186
+				array('EED_Event_Single', 'event_details'),
187
+				EED_Event_Single::EVENT_DETAILS_PRIORITY
188
+			);
189
+			add_action('loop_end', array('EED_Event_Single', 'loop_end'));
190
+			// don't display entry meta because the existing theme will take car of that
191
+			add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
192
+		}
193
+		return $template;
194
+	}
195
+
196
+
197
+	/**
198
+	 * loop_start
199
+	 *
200
+	 * @param    array $wp_query_array an array containing the WP_Query object
201
+	 * @return    void
202
+	 */
203
+	public static function loop_start($wp_query_array)
204
+	{
205
+		global $post;
206
+		do_action('AHEE_event_details_before_post', $post, $wp_query_array);
207
+	}
208
+
209
+
210
+	/**
211
+	 * the_title
212
+	 *
213
+	 * @param    string $title
214
+	 * @param    int $id
215
+	 * @return    string
216
+	 */
217
+	public static function the_title($title = '', $id = 0)
218
+	{
219
+		global $post;
220
+		return in_the_loop() && $post->ID === (int)$id
221
+			? espresso_event_status_banner($post->ID) . $title
222
+			: $title;
223
+	}
224
+
225
+
226
+	/**
227
+	 * get_the_excerpt
228
+	 * kinda hacky, but if a theme is using get_the_excerpt(),
229
+	 * then we need to remove our filters on the_content()
230
+	 *
231
+	 * @param        string $excerpt
232
+	 * @return        string
233
+	 */
234
+	public static function get_the_excerpt($excerpt = '')
235
+	{
236
+		EED_Event_Single::$using_get_the_excerpt = true;
237
+		add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1);
238
+		return $excerpt;
239
+	}
240
+
241
+
242
+	/**
243
+	 * end_get_the_excerpt
244
+	 *
245
+	 * @param  string $text
246
+	 * @return string
247
+	 */
248
+	public static function end_get_the_excerpt($text = '')
249
+	{
250
+		EED_Event_Single::$using_get_the_excerpt = false;
251
+		return $text;
252
+	}
253
+
254
+
255
+	/**
256
+	 * event_details
257
+	 *
258
+	 * @param    string $content
259
+	 * @return    string
260
+	 */
261
+	public static function event_details($content)
262
+	{
263
+		global $post;
264
+		static $current_post_ID = 0;
265
+		if (
266
+			$current_post_ID !== $post->ID
267
+			&& $post->post_type === 'espresso_events'
268
+			&& !EED_Event_Single::$using_get_the_excerpt
269
+			&& !post_password_required()
270
+		) {
271
+			// Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
272
+			// Reason being is that some plugins, like Yoast, need to run through a copy of the loop early
273
+			// BEFORE headers are sent in order to examine the post content and generate content for the HTML header.
274
+			// We want to allow those plugins to still do their thing and have access to our content, but depending on
275
+			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
276
+			// so the following allows this filter to be applied multiple times, but only once for real
277
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
278
+			if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) {
279
+				// we need to first remove this callback from being applied to the_content()
280
+				// (otherwise it will recurse and blow up the interweb)
281
+				remove_filter(
282
+					'the_content',
283
+					array('EED_Event_Single', 'event_details'),
284
+					EED_Event_Single::EVENT_DETAILS_PRIORITY
285
+				);
286
+				EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts();
287
+				$content = EEH_Template::locate_template('content-espresso_events-details.php');
288
+				$content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content);
289
+				add_filter(
290
+					'the_content',
291
+					array('EED_Event_Single', 'event_details'),
292
+					EED_Event_Single::EVENT_DETAILS_PRIORITY
293
+				);
294
+			} else {
295
+				$content = EED_Event_Single::use_filterable_display_order();
296
+			}
297
+		}
298
+		return $content;
299
+	}
300
+
301
+
302
+	/**
303
+	 * use_filterable_display_order
304
+	 *
305
+	 * @return string
306
+	 */
307
+	protected static function use_filterable_display_order()
308
+	{
309
+		// since the 'content-espresso_events-details.php' template might be used directly from within a theme,
310
+		// it uses the_content() for displaying the $post->post_content
311
+		// so in order to load a template that uses the_content()
312
+		// from within a callback being used to filter the_content(),
313
+		// we need to first remove this callback from being applied to the_content()
314
+		// (otherwise it will recurse and blow up the interweb)
315
+		remove_filter(
316
+			'the_content',
317
+			array('EED_Event_Single', 'event_details'),
318
+			EED_Event_Single::EVENT_DETAILS_PRIORITY
319
+		);
320
+		//now add additional content
321
+		add_filter(
322
+			'the_content',
323
+			array('EED_Event_Single', 'event_datetimes'),
324
+			EED_Event_Single::EVENT_DATETIMES_PRIORITY,
325
+			1
326
+		);
327
+		add_filter(
328
+			'the_content',
329
+			array('EED_Event_Single', 'event_tickets'),
330
+			EED_Event_Single::EVENT_TICKETS_PRIORITY,
331
+			1
332
+		);
333
+		add_filter(
334
+			'the_content',
335
+			array('EED_Event_Single', 'event_venues'),
336
+			EED_Event_Single::EVENT_VENUES_PRIORITY,
337
+			1
338
+		);
339
+		do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters');
340
+		// now load our template
341
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
342
+		//now add our filter back in, plus some others
343
+		add_filter(
344
+			'the_content',
345
+			array('EED_Event_Single', 'event_details'),
346
+			EED_Event_Single::EVENT_DETAILS_PRIORITY
347
+		);
348
+		remove_filter(
349
+			'the_content',
350
+			array('EED_Event_Single', 'event_datetimes'),
351
+			EED_Event_Single::EVENT_DATETIMES_PRIORITY
352
+		);
353
+		remove_filter(
354
+			'the_content',
355
+			array('EED_Event_Single', 'event_tickets'),
356
+			EED_Event_Single::EVENT_TICKETS_PRIORITY
357
+		);
358
+		remove_filter(
359
+			'the_content',
360
+			array('EED_Event_Single', 'event_venues'),
361
+			EED_Event_Single::EVENT_VENUES_PRIORITY
362
+		);
363
+		do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters');
364
+		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
365
+		return $content;
366
+	}
367
+
368
+
369
+	/**
370
+	 * event_datetimes - adds datetimes ABOVE content
371
+	 *
372
+	 * @param        string $content
373
+	 * @return        string
374
+	 */
375
+	public static function event_datetimes($content)
376
+	{
377
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content;
378
+	}
379
+
380
+
381
+	/**
382
+	 * event_tickets - adds tickets ABOVE content (which includes datetimes)
383
+	 *
384
+	 * @param        string $content
385
+	 * @return        string
386
+	 */
387
+	public static function event_tickets($content)
388
+	{
389
+		return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content;
390
+	}
391
+
392
+
393
+	/**
394
+	 * event_venues
395
+	 *
396
+	 * @param    string $content
397
+	 * @return    string
398
+	 */
399
+	public static function event_venue($content)
400
+	{
401
+		return EED_Event_Single::event_venues($content);
402
+	}
403
+
404
+
405
+	/**
406
+	 * event_venues - adds venues BELOW content
407
+	 *
408
+	 * @param        string $content
409
+	 * @return        string
410
+	 */
411
+	public static function event_venues($content)
412
+	{
413
+		return $content . EEH_Template::locate_template('content-espresso_events-venues.php');
414
+	}
415
+
416
+
417
+	/**
418
+	 * loop_end
419
+	 *
420
+	 * @param        array $wp_query_array an array containing the WP_Query object
421
+	 * @return        void
422
+	 */
423
+	public static function loop_end($wp_query_array)
424
+	{
425
+		global $post;
426
+		do_action('AHEE_event_details_after_post', $post, $wp_query_array);
427
+	}
428
+
429
+
430
+	/**
431
+	 * wp_enqueue_scripts
432
+	 *
433
+	 * @return    void
434
+	 */
435
+	public function wp_enqueue_scripts()
436
+	{
437
+		// get some style
438
+		if (
439
+			apply_filters('FHEE_enable_default_espresso_css', TRUE)
440
+			&& apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)
441
+		) {
442
+			// first check uploads folder
443
+			if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
444
+				wp_register_style(
445
+					$this->theme,
446
+					get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
447
+					array('dashicons', 'espresso_default')
448
+				);
449
+			} else {
450
+				wp_register_style(
451
+					$this->theme,
452
+					EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
453
+					array('dashicons', 'espresso_default')
454
+				);
455
+			}
456
+			wp_enqueue_script($this->theme);
457
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
458
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
459
+			}
460
+		}
461
+	}
462
+
463
+
464
+	/**
465
+	 * display_venue
466
+	 *
467
+	 * @return    bool
468
+	 */
469
+	public static function display_venue()
470
+	{
471
+		/** @type EE_Event_Single_Config $config */
472
+		$config = EED_Event_Single::instance()->config();
473
+		$display_venue = $config->display_venue === null ? true : $config->display_venue;
474
+		$venue_name = EEH_Venue_View::venue_name();
475
+		return $display_venue && !empty($venue_name);
476
+	}
477 477
 
478 478
 
479 479
 }
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
  */
488 488
 function espresso_display_venue_in_event_details()
489 489
 {
490
-    return EED_Event_Single::display_venue();
490
+	return EED_Event_Single::display_venue();
491 491
 }
492 492
 
493 493
 
Please login to merge, or discard this patch.
modules/events_archive/EED_Events_Archive.module.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class EED_Events_Archive  extends EED_Module {
16 16
 
17
-    const EVENT_DETAILS_PRIORITY = 100;
18
-    const EVENT_DATETIMES_PRIORITY = 110;
19
-    const EVENT_TICKETS_PRIORITY = 120;
20
-    const EVENT_VENUES_PRIORITY = 130;
17
+	const EVENT_DETAILS_PRIORITY = 100;
18
+	const EVENT_DATETIMES_PRIORITY = 110;
19
+	const EVENT_TICKETS_PRIORITY = 120;
20
+	const EVENT_VENUES_PRIORITY = 130;
21 21
 
22 22
 
23
-    public static $espresso_event_list_ID = 0;
23
+	public static $espresso_event_list_ID = 0;
24 24
 	public static $espresso_grid_event_lists = array();
25 25
 
26 26
 	/**
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	protected static $using_get_the_excerpt = false;
30 30
 
31
-    /**
32
-     * Used to flag when the event list is being called from an external iframe.
33
-     *
34
-     * @var bool $iframe
35
-     */
36
-    protected static $iframe = false;
31
+	/**
32
+	 * Used to flag when the event list is being called from an external iframe.
33
+	 *
34
+	 * @var bool $iframe
35
+	 */
36
+	protected static $iframe = false;
37 37
 
38
-    /**
38
+	/**
39 39
 	 * @var \EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton $_iframe_embed_button
40 40
 	 */
41 41
 	private static $_iframe_embed_button;
42 42
 
43
-    /**
43
+	/**
44 44
 	 * @type EE_Template_Part_Manager $template_parts
45 45
 	 */
46 46
 	protected $template_parts;
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 	 *  @return 	void
64 64
 	 */
65 65
 	public static function set_hooks() {
66
-        $custom_post_types = EE_Register_CPTs::get_CPTs();
67
-        EE_Config::register_route(
68
-            $custom_post_types['espresso_events']['plural_slug'],
69
-            'Events_Archive',
70
-            'run'
71
-        );
72
-        EE_Config::register_route(
73
-            'event_list',
74
-            'Events_Archive',
75
-            'event_list'
76
-        );
77
-        EE_Config::register_route(
78
-            'iframe',
79
-            'Events_Archive',
80
-            'event_list_iframe',
81
-            'event_list'
82
-        );
83
-        add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
66
+		$custom_post_types = EE_Register_CPTs::get_CPTs();
67
+		EE_Config::register_route(
68
+			$custom_post_types['espresso_events']['plural_slug'],
69
+			'Events_Archive',
70
+			'run'
71
+		);
72
+		EE_Config::register_route(
73
+			'event_list',
74
+			'Events_Archive',
75
+			'event_list'
76
+		);
77
+		EE_Config::register_route(
78
+			'iframe',
79
+			'Events_Archive',
80
+			'event_list_iframe',
81
+			'event_list'
82
+		);
83
+		add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
84 84
 	}
85 85
 
86 86
 	/**
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 
225 225
 
226 226
 	/**
227
-     * most likely called by the ESPRESSO_EVENTS shortcode which uses this module to do some of it's lifting
228
-     *
229
-     * @return    void
227
+	 * most likely called by the ESPRESSO_EVENTS shortcode which uses this module to do some of it's lifting
228
+	 *
229
+	 * @return    void
230 230
 	 */
231 231
 	public function event_list() {
232 232
 		// ensure valid EE_Events_Archive_Config() object exists
@@ -237,36 +237,36 @@  discard block
 block discarded – undo
237 237
 
238 238
 
239 239
 
240
-    /**
241
-     * @access    public
242
-     * @return    void
243
-     * @throws \EE_Error
244
-     * @throws \DomainException
245
-     */
240
+	/**
241
+	 * @access    public
242
+	 * @return    void
243
+	 * @throws \EE_Error
244
+	 * @throws \DomainException
245
+	 */
246 246
 	public function event_list_iframe() {
247
-        \EED_Events_Archive::$iframe = true;
247
+		\EED_Events_Archive::$iframe = true;
248 248
 		$event_list_iframe = new EventsArchiveIframe( $this );
249 249
 		$event_list_iframe->display();
250 250
 	}
251 251
 
252 252
 
253 253
 
254
-    /**
255
-     * @access public
256
-     * @return string
257
-     */
254
+	/**
255
+	 * @access public
256
+	 * @return string
257
+	 */
258 258
 	public static function is_iframe() {
259
-        return \EED_Events_Archive::$iframe;
259
+		return \EED_Events_Archive::$iframe;
260 260
 	}
261 261
 
262 262
 
263 263
 
264
-    /**
265
-     * @access public
266
-     * @return string
267
-     */
264
+	/**
265
+	 * @access public
266
+	 * @return string
267
+	 */
268 268
 	public static function link_target() {
269
-        return \EED_Events_Archive::$iframe ? ' target="_blank"' : '';
269
+		return \EED_Events_Archive::$iframe ? ' target="_blank"' : '';
270 270
 	}
271 271
 
272 272
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 			}
295 295
 			// if NOT a custom template
296 296
 			if (
297
-                apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false)
297
+				apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false)
298 298
 				|| EE_Registry::instance()
299
-                    ->load_core( 'Front_Controller' )
300
-                    ->get_selected_template() !== 'archive-espresso_events.php'
299
+					->load_core( 'Front_Controller' )
300
+					->get_selected_template() !== 'archive-espresso_events.php'
301 301
 			) {
302 302
 				// don't display entry meta because the existing theme will take care of that
303 303
 				add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' );
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 				EEH_Template::load_espresso_theme_functions();
306 306
 				// because we don't know if the theme is using the_excerpt()
307 307
 				add_filter(
308
-				    'the_excerpt',
309
-                    array( 'EED_Events_Archive', 'event_details' ),
310
-                    EED_Events_Archive::EVENT_DETAILS_PRIORITY
311
-                );
308
+					'the_excerpt',
309
+					array( 'EED_Events_Archive', 'event_details' ),
310
+					EED_Events_Archive::EVENT_DETAILS_PRIORITY
311
+				);
312 312
 				// or the_content
313 313
 				add_filter(
314
-				    'the_content',
315
-                    array( 'EED_Events_Archive', 'event_details' ),
316
-                    EED_Events_Archive::EVENT_DETAILS_PRIORITY
317
-                );
314
+					'the_content',
315
+					array( 'EED_Events_Archive', 'event_details' ),
316
+					EED_Events_Archive::EVENT_DETAILS_PRIORITY
317
+				);
318 318
 				// and just in case they are running get_the_excerpt() which DESTROYS things
319 319
 				add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
320 320
 				// don't display entry meta because the existing theme will take care of that
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 		}
340 340
 		if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) {
341 341
 			remove_filter(
342
-			    'the_excerpt',
343
-                array( 'EED_Events_Archive', 'event_details' ),
344
-                EED_Events_Archive::EVENT_DETAILS_PRIORITY
345
-            );
342
+				'the_excerpt',
343
+				array( 'EED_Events_Archive', 'event_details' ),
344
+				EED_Events_Archive::EVENT_DETAILS_PRIORITY
345
+			);
346 346
 			remove_filter(
347
-			    'the_content',
348
-                array( 'EED_Events_Archive', 'event_details' ),
349
-                EED_Events_Archive::EVENT_DETAILS_PRIORITY
350
-            );
347
+				'the_content',
348
+				array( 'EED_Events_Archive', 'event_details' ),
349
+				EED_Events_Archive::EVENT_DETAILS_PRIORITY
350
+			);
351 351
 			$excerpt = EED_Events_Archive::event_details( $excerpt );
352 352
 		} else {
353 353
 			EED_Events_Archive::$using_get_the_excerpt = true;
@@ -438,17 +438,17 @@  discard block
 block discarded – undo
438 438
 		// no further password checks required atm
439 439
 		add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' );
440 440
 		// we need to first remove this callback from being applied to the_content() or the_excerpt()
441
-        // (otherwise it will recurse and blow up the interweb)
441
+		// (otherwise it will recurse and blow up the interweb)
442 442
 		remove_filter(
443
-		    'the_excerpt',
444
-            array( 'EED_Events_Archive', 'event_details' ),
445
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
446
-        );
443
+			'the_excerpt',
444
+			array( 'EED_Events_Archive', 'event_details' ),
445
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
446
+		);
447 447
 		remove_filter(
448
-		    'the_content',
449
-            array( 'EED_Events_Archive', 'event_details' ),
450
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
451
-        );
448
+			'the_content',
449
+			array( 'EED_Events_Archive', 'event_details' ),
450
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
451
+		);
452 452
 		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
453 453
 		// now add additional content depending on whether event is using the_excerpt() or the_content()
454 454
 		EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts();
@@ -456,20 +456,20 @@  discard block
 block discarded – undo
456 456
 		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content );
457 457
 		// re-add our main filters (or else the next event won't have them)
458 458
 		add_filter(
459
-		    'the_excerpt',
460
-            array( 'EED_Events_Archive', 'event_details' ),
461
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
462
-        );
459
+			'the_excerpt',
460
+			array( 'EED_Events_Archive', 'event_details' ),
461
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
462
+		);
463 463
 		add_filter(
464
-		    'the_content',
465
-            array( 'EED_Events_Archive', 'event_details' ),
466
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
467
-        );
464
+			'the_content',
465
+			array( 'EED_Events_Archive', 'event_details' ),
466
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
467
+		);
468 468
 		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
469 469
 		remove_filter(
470
-		    'FHEE__EED_Events_Archive__event_details__no_post_password_required',
471
-            '__return_true'
472
-        );
470
+			'FHEE__EED_Events_Archive__event_details__no_post_password_required',
471
+			'__return_true'
472
+		);
473 473
 		return $content;
474 474
 	}
475 475
 
@@ -485,15 +485,15 @@  discard block
 block discarded – undo
485 485
 		// we need to first remove this callback from being applied to the_content()
486 486
 		// (otherwise it will recurse and blow up the interweb)
487 487
 		remove_filter(
488
-		    'the_excerpt',
489
-            array( 'EED_Events_Archive', 'event_details' ),
490
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
491
-        );
488
+			'the_excerpt',
489
+			array( 'EED_Events_Archive', 'event_details' ),
490
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
491
+		);
492 492
 		remove_filter(
493
-		    'the_content',
494
-            array( 'EED_Events_Archive', 'event_details' ),
495
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
496
-        );
493
+			'the_content',
494
+			array( 'EED_Events_Archive', 'event_details' ),
495
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
496
+		);
497 497
 		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
498 498
 		//now add additional content depending on whether event is using the_excerpt() or the_content()
499 499
 		EED_Events_Archive::_add_additional_excerpt_filters();
@@ -503,15 +503,15 @@  discard block
 block discarded – undo
503 503
 		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
504 504
 		// re-add our main filters (or else the next event won't have them)
505 505
 		add_filter(
506
-		    'the_excerpt',
507
-            array( 'EED_Events_Archive', 'event_details' ),
508
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
509
-        );
506
+			'the_excerpt',
507
+			array( 'EED_Events_Archive', 'event_details' ),
508
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
509
+		);
510 510
 		add_filter(
511
-		    'the_content',
512
-            array( 'EED_Events_Archive', 'event_details' ),
513
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
514
-        );
511
+			'the_content',
512
+			array( 'EED_Events_Archive', 'event_details' ),
513
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
514
+		);
515 515
 		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
516 516
 		// but remove the other filters so that they don't get applied to the next post
517 517
 		EED_Events_Archive::_remove_additional_events_archive_filters();
@@ -588,20 +588,20 @@  discard block
 block discarded – undo
588 588
 	 */
589 589
 	private static function _add_additional_excerpt_filters() {
590 590
 		add_filter(
591
-		    'the_excerpt',
592
-            array( 'EED_Events_Archive', 'event_datetimes' ),
593
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
594
-        );
591
+			'the_excerpt',
592
+			array( 'EED_Events_Archive', 'event_datetimes' ),
593
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
594
+		);
595 595
 		add_filter(
596
-		    'the_excerpt',
597
-            array( 'EED_Events_Archive', 'event_tickets' ),
598
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
599
-        );
596
+			'the_excerpt',
597
+			array( 'EED_Events_Archive', 'event_tickets' ),
598
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
599
+		);
600 600
 		add_filter(
601
-		    'the_excerpt',
602
-            array( 'EED_Events_Archive', 'event_venues' ),
603
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
604
-        );
601
+			'the_excerpt',
602
+			array( 'EED_Events_Archive', 'event_venues' ),
603
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
604
+		);
605 605
 	}
606 606
 
607 607
 
@@ -614,20 +614,20 @@  discard block
 block discarded – undo
614 614
 	 */
615 615
 	private static function _add_additional_content_filters() {
616 616
 		add_filter(
617
-		    'the_content',
618
-            array( 'EED_Events_Archive', 'event_datetimes' ),
619
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
620
-        );
617
+			'the_content',
618
+			array( 'EED_Events_Archive', 'event_datetimes' ),
619
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
620
+		);
621 621
 		add_filter(
622
-		    'the_content',
623
-            array( 'EED_Events_Archive', 'event_tickets' ),
624
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
625
-        );
622
+			'the_content',
623
+			array( 'EED_Events_Archive', 'event_tickets' ),
624
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
625
+		);
626 626
 		add_filter(
627
-		    'the_content',
628
-            array( 'EED_Events_Archive', 'event_venues' ),
629
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
630
-        );
627
+			'the_content',
628
+			array( 'EED_Events_Archive', 'event_venues' ),
629
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
630
+		);
631 631
 	}
632 632
 
633 633
 
@@ -640,35 +640,35 @@  discard block
 block discarded – undo
640 640
 	 */
641 641
 	private static function _remove_additional_events_archive_filters() {
642 642
 		remove_filter(
643
-		    'the_excerpt',
644
-            array( 'EED_Events_Archive', 'event_datetimes' ),
645
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
646
-        );
643
+			'the_excerpt',
644
+			array( 'EED_Events_Archive', 'event_datetimes' ),
645
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
646
+		);
647 647
 		remove_filter(
648
-		    'the_excerpt',
649
-            array( 'EED_Events_Archive', 'event_tickets' ),
650
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
651
-        );
648
+			'the_excerpt',
649
+			array( 'EED_Events_Archive', 'event_tickets' ),
650
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
651
+		);
652 652
 		remove_filter(
653
-		    'the_excerpt',
654
-            array( 'EED_Events_Archive', 'event_venues' ),
655
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
656
-        );
653
+			'the_excerpt',
654
+			array( 'EED_Events_Archive', 'event_venues' ),
655
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
656
+		);
657 657
 		remove_filter(
658
-		    'the_content',
659
-            array( 'EED_Events_Archive', 'event_datetimes' ),
660
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
661
-        );
658
+			'the_content',
659
+			array( 'EED_Events_Archive', 'event_datetimes' ),
660
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
661
+		);
662 662
 		remove_filter(
663
-		    'the_content',
664
-            array( 'EED_Events_Archive', 'event_tickets' ),
665
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
666
-        );
663
+			'the_content',
664
+			array( 'EED_Events_Archive', 'event_tickets' ),
665
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
666
+		);
667 667
 		remove_filter(
668
-		    'the_content',
669
-            array( 'EED_Events_Archive', 'event_venues' ),
670
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
671
-        );
668
+			'the_content',
669
+			array( 'EED_Events_Archive', 'event_venues' ),
670
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
671
+		);
672 672
 	}
673 673
 
674 674
 
@@ -683,50 +683,50 @@  discard block
 block discarded – undo
683 683
 		//remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
684 684
 		remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 1 );
685 685
 		remove_filter(
686
-		    'the_excerpt',
687
-            array( 'EED_Events_Archive', 'event_details' ),
688
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
689
-        );
686
+			'the_excerpt',
687
+			array( 'EED_Events_Archive', 'event_details' ),
688
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
689
+		);
690 690
 		remove_filter(
691
-		    'the_excerpt',
692
-            array( 'EED_Events_Archive', 'event_datetimes' ),
693
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
694
-        );
691
+			'the_excerpt',
692
+			array( 'EED_Events_Archive', 'event_datetimes' ),
693
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
694
+		);
695 695
 		remove_filter(
696
-		    'the_excerpt',
697
-            array( 'EED_Events_Archive', 'event_tickets' ),
698
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
699
-        );
696
+			'the_excerpt',
697
+			array( 'EED_Events_Archive', 'event_tickets' ),
698
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
699
+		);
700 700
 		remove_filter(
701
-		    'the_excerpt',
702
-            array( 'EED_Events_Archive', 'event_venues' ),
703
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
704
-        );
701
+			'the_excerpt',
702
+			array( 'EED_Events_Archive', 'event_venues' ),
703
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
704
+		);
705 705
 		remove_filter(
706
-		    'the_content',
707
-            array( 'EED_Events_Archive', 'event_details' ),
708
-            EED_Events_Archive::EVENT_DETAILS_PRIORITY
709
-        );
706
+			'the_content',
707
+			array( 'EED_Events_Archive', 'event_details' ),
708
+			EED_Events_Archive::EVENT_DETAILS_PRIORITY
709
+		);
710 710
 		remove_filter(
711
-		    'the_content',
712
-            array( 'EED_Events_Archive', 'event_datetimes' ),
713
-            EED_Events_Archive::EVENT_DATETIMES_PRIORITY
714
-        );
711
+			'the_content',
712
+			array( 'EED_Events_Archive', 'event_datetimes' ),
713
+			EED_Events_Archive::EVENT_DATETIMES_PRIORITY
714
+		);
715 715
 		remove_filter(
716
-		    'the_content',
717
-            array( 'EED_Events_Archive', 'event_tickets' ),
718
-            EED_Events_Archive::EVENT_TICKETS_PRIORITY
719
-        );
716
+			'the_content',
717
+			array( 'EED_Events_Archive', 'event_tickets' ),
718
+			EED_Events_Archive::EVENT_TICKETS_PRIORITY
719
+		);
720 720
 		remove_filter(
721
-		    'the_content',
722
-            array( 'EED_Events_Archive', 'event_venues' ),
723
-            EED_Events_Archive::EVENT_VENUES_PRIORITY
724
-        );
721
+			'the_content',
722
+			array( 'EED_Events_Archive', 'event_venues' ),
723
+			EED_Events_Archive::EVENT_VENUES_PRIORITY
724
+		);
725 725
 		// don't display entry meta because the existing theme will take care of that
726 726
 		remove_filter(
727
-		    'FHEE__content_espresso_events_details_template__display_entry_meta',
728
-            '__return_false'
729
-        );
727
+			'FHEE__content_espresso_events_details_template__display_entry_meta',
728
+			'__return_false'
729
+		);
730 730
 	}
731 731
 
732 732
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 *  @return 	void
742 742
 	 */
743 743
 	public function load_event_list_assets() {
744
-        do_action( 'AHEE__EED_Events_Archive__before_load_assets' );
744
+		do_action( 'AHEE__EED_Events_Archive__before_load_assets' );
745 745
 		add_filter( 'FHEE_load_EE_Session', '__return_true' );
746 746
 		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
747 747
 		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
Please login to merge, or discard this patch.
Spacing   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\libraries\iframe_display\EventListIframeEmbedButton;
4 4
 use EventEspresso\modules\events_archive\EventsArchiveIframe;
5 5
 
6
-defined( 'EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
6
+defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
7 7
 
8 8
 /**
9 9
  * Event List
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return EED_Events_Archive
52 52
 	 */
53 53
 	public static function instance() {
54
-		return parent::get_instance( __CLASS__ );
54
+		return parent::get_instance(__CLASS__);
55 55
 	}
56 56
 
57 57
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             'event_list_iframe',
81 81
             'event_list'
82 82
         );
83
-        add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
83
+        add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2);
84 84
 	}
85 85
 
86 86
 	/**
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *  @return 	void
91 91
 	 */
92 92
 	public static function set_hooks_admin() {
93
-		add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 );
93
+		add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2);
94 94
 		// hook into the end of the \EE_Admin_Page::_load_page_dependencies()
95 95
 		// to load assets for "espresso_events" page on the "default" route (action)
96 96
 		add_action(
97 97
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__default',
98
-			array( 'EED_Events_Archive', 'event_list_iframe_embed_button' ),
98
+			array('EED_Events_Archive', 'event_list_iframe_embed_button'),
99 99
 			10
100 100
 		);
101 101
 	}
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 *  @return 	void
111 111
 	 */
112 112
 	public static function set_definitions() {
113
-		define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
114
-		define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
113
+		define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
114
+		define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
115 115
 	}
116 116
 
117 117
 
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * set up EE_Events_Archive_Config
121 121
 	 */
122
-	protected function set_config(){
123
-		$this->set_config_section( 'template_settings' );
124
-		$this->set_config_class( 'EE_Events_Archive_Config' );
125
-		$this->set_config_name( 'EED_Events_Archive' );
122
+	protected function set_config() {
123
+		$this->set_config_section('template_settings');
124
+		$this->set_config_class('EE_Events_Archive_Config');
125
+		$this->set_config_name('EED_Events_Archive');
126 126
 	}
127 127
 
128 128
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @return EventListIframeEmbedButton
132 132
 	 */
133 133
 	public static function get_iframe_embed_button() {
134
-		if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton ) {
134
+		if ( ! self::$_iframe_embed_button instanceof EventListIframeEmbedButton) {
135 135
 			self::$_iframe_embed_button = new EventListIframeEmbedButton();
136 136
 		}
137 137
 		return self::$_iframe_embed_button;
@@ -157,35 +157,35 @@  discard block
 block discarded – undo
157 157
 	 * @param \EE_Events_Archive_Config $config
158 158
 	 * @return \EE_Template_Part_Manager
159 159
 	 */
160
-	public function initialize_template_parts( EE_Events_Archive_Config $config = null ) {
160
+	public function initialize_template_parts(EE_Events_Archive_Config $config = null) {
161 161
 		$config = $config instanceof EE_Events_Archive_Config ? $config : $this->config();
162 162
 		EEH_Autoloader::instance()->register_template_part_autoloaders();
163 163
 		$template_parts = new EE_Template_Part_Manager();
164 164
 		$template_parts->add_template_part(
165 165
 			'tickets',
166
-			__( 'Ticket Selector', 'event_espresso' ),
166
+			__('Ticket Selector', 'event_espresso'),
167 167
 			'content-espresso_events-tickets.php',
168 168
 			$config->display_order_tickets
169 169
 		);
170 170
 		$template_parts->add_template_part(
171 171
 			'datetimes',
172
-			__( 'Dates and Times', 'event_espresso' ),
172
+			__('Dates and Times', 'event_espresso'),
173 173
 			'content-espresso_events-datetimes.php',
174 174
 			$config->display_order_datetimes
175 175
 		);
176 176
 		$template_parts->add_template_part(
177 177
 			'event',
178
-			__( 'Event Description', 'event_espresso' ),
178
+			__('Event Description', 'event_espresso'),
179 179
 			'content-espresso_events-details.php',
180 180
 			$config->display_order_event
181 181
 		);
182 182
 		$template_parts->add_template_part(
183 183
 			'venue',
184
-			__( 'Venue Information', 'event_espresso' ),
184
+			__('Venue Information', 'event_espresso'),
185 185
 			'content-espresso_events-venues.php',
186 186
 			$config->display_order_venue
187 187
 		);
188
-		do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts );
188
+		do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts);
189 189
 		return $template_parts;
190 190
 	}
191 191
 
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 * @param WP $WP
199 199
 	 * @return    void
200 200
 	 */
201
-	public function run( $WP ) {
202
-		do_action( 'AHEE__EED_Events_Archive__before_run' );
201
+	public function run($WP) {
202
+		do_action('AHEE__EED_Events_Archive__before_run');
203 203
 		// ensure valid EE_Events_Archive_Config() object exists
204 204
 		$this->set_config();
205 205
 		/** @type EE_Events_Archive_Config $config */
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 		EEH_Event_Query::add_query_filters();
212 212
 		// set params that will get used by the filters
213 213
 		EEH_Event_Query::set_query_params(
214
-			'', 	// month
215
-			'', 	// category
216
-			$config->display_expired_events, 	// show_expired
217
-			'start_date', 	// orderby
214
+			'', // month
215
+			'', // category
216
+			$config->display_expired_events, // show_expired
217
+			'start_date', // orderby
218 218
 			'ASC' 	// sort
219 219
 		);
220 220
 		// check what template is loaded
221
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
221
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
222 222
 	}
223 223
 
224 224
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      */
246 246
 	public function event_list_iframe() {
247 247
         \EED_Events_Archive::$iframe = true;
248
-		$event_list_iframe = new EventsArchiveIframe( $this );
248
+		$event_list_iframe = new EventsArchiveIframe($this);
249 249
 		$event_list_iframe->display();
250 250
 	}
251 251
 
@@ -283,42 +283,42 @@  discard block
 block discarded – undo
283 283
 	 * @param string $template
284 284
 	 * @return    string
285 285
 	 */
286
-	public function template_include( $template = '' ) {
286
+	public function template_include($template = '') {
287 287
 		// don't add content filter for dedicated EE child themes or private posts
288
-		if ( ! EEH_Template::is_espresso_theme() ) {
288
+		if ( ! EEH_Template::is_espresso_theme()) {
289 289
 			/** @type EE_Events_Archive_Config $config */
290 290
 			$config = $this->config();
291 291
 			// add status banner ?
292
-			if ( $config->display_status_banner ) {
293
-				add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 );
292
+			if ($config->display_status_banner) {
293
+				add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2);
294 294
 			}
295 295
 			// if NOT a custom template
296 296
 			if (
297 297
                 apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', false)
298 298
 				|| EE_Registry::instance()
299
-                    ->load_core( 'Front_Controller' )
299
+                    ->load_core('Front_Controller')
300 300
                     ->get_selected_template() !== 'archive-espresso_events.php'
301 301
 			) {
302 302
 				// don't display entry meta because the existing theme will take care of that
303
-				add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' );
303
+				add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true');
304 304
 			// load functions.php file for the theme (loaded by WP if using child theme)
305 305
 				EEH_Template::load_espresso_theme_functions();
306 306
 				// because we don't know if the theme is using the_excerpt()
307 307
 				add_filter(
308 308
 				    'the_excerpt',
309
-                    array( 'EED_Events_Archive', 'event_details' ),
309
+                    array('EED_Events_Archive', 'event_details'),
310 310
                     EED_Events_Archive::EVENT_DETAILS_PRIORITY
311 311
                 );
312 312
 				// or the_content
313 313
 				add_filter(
314 314
 				    'the_content',
315
-                    array( 'EED_Events_Archive', 'event_details' ),
315
+                    array('EED_Events_Archive', 'event_details'),
316 316
                     EED_Events_Archive::EVENT_DETAILS_PRIORITY
317 317
                 );
318 318
 				// and just in case they are running get_the_excerpt() which DESTROYS things
319
-				add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
319
+				add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
320 320
 				// don't display entry meta because the existing theme will take care of that
321
-				add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
321
+				add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
322 322
 			}
323 323
 		}
324 324
 		return $template;
@@ -333,25 +333,25 @@  discard block
 block discarded – undo
333 333
 	 * 	@param		string 	$excerpt
334 334
 	 * 	@return 		string
335 335
 	 */
336
-	public static function get_the_excerpt( $excerpt = '' ) {
337
-		if ( post_password_required() ) {
336
+	public static function get_the_excerpt($excerpt = '') {
337
+		if (post_password_required()) {
338 338
 			return $excerpt;
339 339
 		}
340
-		if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) {
340
+		if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) {
341 341
 			remove_filter(
342 342
 			    'the_excerpt',
343
-                array( 'EED_Events_Archive', 'event_details' ),
343
+                array('EED_Events_Archive', 'event_details'),
344 344
                 EED_Events_Archive::EVENT_DETAILS_PRIORITY
345 345
             );
346 346
 			remove_filter(
347 347
 			    'the_content',
348
-                array( 'EED_Events_Archive', 'event_details' ),
348
+                array('EED_Events_Archive', 'event_details'),
349 349
                 EED_Events_Archive::EVENT_DETAILS_PRIORITY
350 350
             );
351
-			$excerpt = EED_Events_Archive::event_details( $excerpt );
351
+			$excerpt = EED_Events_Archive::event_details($excerpt);
352 352
 		} else {
353 353
 			EED_Events_Archive::$using_get_the_excerpt = true;
354
-			add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 );
354
+			add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1);
355 355
 		}
356 356
 		return $excerpt;
357 357
 	}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @param  string $text
366 366
 	 * @return string
367 367
 	 */
368
-	public static function end_get_the_excerpt( $text = '' ) {
368
+	public static function end_get_the_excerpt($text = '') {
369 369
 		EED_Events_Archive::$using_get_the_excerpt = false;
370 370
 		return $text;
371 371
 	}
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
 	 * @param 		string 		$id
381 381
 	 * @return 		string
382 382
 	 */
383
-	public static function the_title( $title = '', $id = '' ) {
383
+	public static function the_title($title = '', $id = '') {
384 384
 	global $post;
385
-	if ( $post instanceof WP_Post ) {
386
-		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID  ) . $title :  $title;
385
+	if ($post instanceof WP_Post) {
386
+		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title;
387 387
 	}
388 388
 	return $title;
389 389
 }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	 * 	@param		string 	$content
398 398
 	 * 	@return 		string
399 399
 	 */
400
-	public static function event_details( $content ) {
400
+	public static function event_details($content) {
401 401
 		global $post;
402 402
 		static $current_post_ID = 0;
403 403
 		if (
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 			&& ! EED_Events_Archive::$using_get_the_excerpt
407 407
 			&& ! post_password_required()
408 408
 			&& (
409
-				apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false )
410
-				|| ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false )
409
+				apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false)
410
+				|| ! apply_filters('FHEE__content_espresso_events__template_loaded', false)
411 411
 			)
412 412
 		) {
413 413
 			// Set current post ID to prevent showing content twice, but only if headers have definitely been sent.
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 			// We want to allow those plugins to still do their thing and have access to our content, but depending on
417 417
 			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
418 418
 			// so the following allows this filter to be applied multiple times, but only once for real
419
-			$current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0;
420
-			if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) {
419
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
420
+			if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) {
421 421
 				$content = \EED_Events_Archive::use_sortable_display_order();
422 422
 			} else {
423 423
 				$content = \EED_Events_Archive::use_filterable_display_order();
@@ -436,36 +436,36 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	protected static function use_sortable_display_order() {
438 438
 		// no further password checks required atm
439
-		add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' );
439
+		add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true');
440 440
 		// we need to first remove this callback from being applied to the_content() or the_excerpt()
441 441
         // (otherwise it will recurse and blow up the interweb)
442 442
 		remove_filter(
443 443
 		    'the_excerpt',
444
-            array( 'EED_Events_Archive', 'event_details' ),
444
+            array('EED_Events_Archive', 'event_details'),
445 445
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
446 446
         );
447 447
 		remove_filter(
448 448
 		    'the_content',
449
-            array( 'EED_Events_Archive', 'event_details' ),
449
+            array('EED_Events_Archive', 'event_details'),
450 450
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
451 451
         );
452
-		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
452
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
453 453
 		// now add additional content depending on whether event is using the_excerpt() or the_content()
454 454
 		EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts();
455
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
456
-		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content );
455
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
456
+		$content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content);
457 457
 		// re-add our main filters (or else the next event won't have them)
458 458
 		add_filter(
459 459
 		    'the_excerpt',
460
-            array( 'EED_Events_Archive', 'event_details' ),
460
+            array('EED_Events_Archive', 'event_details'),
461 461
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
462 462
         );
463 463
 		add_filter(
464 464
 		    'the_content',
465
-            array( 'EED_Events_Archive', 'event_details' ),
465
+            array('EED_Events_Archive', 'event_details'),
466 466
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
467 467
         );
468
-		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
468
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
469 469
 		remove_filter(
470 470
 		    'FHEE__EED_Events_Archive__event_details__no_post_password_required',
471 471
             '__return_true'
@@ -486,36 +486,36 @@  discard block
 block discarded – undo
486 486
 		// (otherwise it will recurse and blow up the interweb)
487 487
 		remove_filter(
488 488
 		    'the_excerpt',
489
-            array( 'EED_Events_Archive', 'event_details' ),
489
+            array('EED_Events_Archive', 'event_details'),
490 490
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
491 491
         );
492 492
 		remove_filter(
493 493
 		    'the_content',
494
-            array( 'EED_Events_Archive', 'event_details' ),
494
+            array('EED_Events_Archive', 'event_details'),
495 495
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
496 496
         );
497
-		remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
497
+		remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1);
498 498
 		//now add additional content depending on whether event is using the_excerpt() or the_content()
499 499
 		EED_Events_Archive::_add_additional_excerpt_filters();
500 500
 		EED_Events_Archive::_add_additional_content_filters();
501
-		do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' );
501
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters');
502 502
 		// now load our template
503
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
503
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
504 504
 		// re-add our main filters (or else the next event won't have them)
505 505
 		add_filter(
506 506
 		    'the_excerpt',
507
-            array( 'EED_Events_Archive', 'event_details' ),
507
+            array('EED_Events_Archive', 'event_details'),
508 508
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
509 509
         );
510 510
 		add_filter(
511 511
 		    'the_content',
512
-            array( 'EED_Events_Archive', 'event_details' ),
512
+            array('EED_Events_Archive', 'event_details'),
513 513
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
514 514
         );
515
-		add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 );
515
+		add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1);
516 516
 		// but remove the other filters so that they don't get applied to the next post
517 517
 		EED_Events_Archive::_remove_additional_events_archive_filters();
518
-		do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' );
518
+		do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters');
519 519
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
520 520
 		//return ! empty( $template ) ? $template : $content;
521 521
 		return $content;
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	 * 	@param		string 	$content
531 531
 	 *  	@return 		string
532 532
 	 */
533
-	public static function event_datetimes( $content ) {
534
-		if ( post_password_required() ) {
533
+	public static function event_datetimes($content) {
534
+		if (post_password_required()) {
535 535
 			return $content;
536 536
 		}
537
-		return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content;
537
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
538 538
 	}
539 539
 
540 540
 	/**
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
 	 * 	@param		string 	$content
545 545
 	 *  	@return 		string
546 546
 	 */
547
-	public static function event_tickets( $content ) {
548
-		if ( post_password_required() ) {
547
+	public static function event_tickets($content) {
548
+		if (post_password_required()) {
549 549
 			return $content;
550 550
 		}
551
-		return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content;
551
+		return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
552 552
 	}
553 553
 
554 554
 
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 	 * @param    string $content
561 561
 	 * @return    string
562 562
 	 */
563
-	public static function event_venue( $content ) {
564
-		return EED_Events_Archive::event_venues( $content );
563
+	public static function event_venue($content) {
564
+		return EED_Events_Archive::event_venues($content);
565 565
 	}
566 566
 
567 567
 	/**
@@ -571,11 +571,11 @@  discard block
 block discarded – undo
571 571
 	 * 	@param		string 	$content
572 572
 	 *  	@return 		string
573 573
 	 */
574
-	public static function event_venues( $content ) {
575
-		if ( post_password_required() ) {
574
+	public static function event_venues($content) {
575
+		if (post_password_required()) {
576 576
 			return $content;
577 577
 		}
578
-		return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' );
578
+		return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
579 579
 	}
580 580
 
581 581
 
@@ -589,17 +589,17 @@  discard block
 block discarded – undo
589 589
 	private static function _add_additional_excerpt_filters() {
590 590
 		add_filter(
591 591
 		    'the_excerpt',
592
-            array( 'EED_Events_Archive', 'event_datetimes' ),
592
+            array('EED_Events_Archive', 'event_datetimes'),
593 593
             EED_Events_Archive::EVENT_DATETIMES_PRIORITY
594 594
         );
595 595
 		add_filter(
596 596
 		    'the_excerpt',
597
-            array( 'EED_Events_Archive', 'event_tickets' ),
597
+            array('EED_Events_Archive', 'event_tickets'),
598 598
             EED_Events_Archive::EVENT_TICKETS_PRIORITY
599 599
         );
600 600
 		add_filter(
601 601
 		    'the_excerpt',
602
-            array( 'EED_Events_Archive', 'event_venues' ),
602
+            array('EED_Events_Archive', 'event_venues'),
603 603
             EED_Events_Archive::EVENT_VENUES_PRIORITY
604 604
         );
605 605
 	}
@@ -615,17 +615,17 @@  discard block
 block discarded – undo
615 615
 	private static function _add_additional_content_filters() {
616 616
 		add_filter(
617 617
 		    'the_content',
618
-            array( 'EED_Events_Archive', 'event_datetimes' ),
618
+            array('EED_Events_Archive', 'event_datetimes'),
619 619
             EED_Events_Archive::EVENT_DATETIMES_PRIORITY
620 620
         );
621 621
 		add_filter(
622 622
 		    'the_content',
623
-            array( 'EED_Events_Archive', 'event_tickets' ),
623
+            array('EED_Events_Archive', 'event_tickets'),
624 624
             EED_Events_Archive::EVENT_TICKETS_PRIORITY
625 625
         );
626 626
 		add_filter(
627 627
 		    'the_content',
628
-            array( 'EED_Events_Archive', 'event_venues' ),
628
+            array('EED_Events_Archive', 'event_venues'),
629 629
             EED_Events_Archive::EVENT_VENUES_PRIORITY
630 630
         );
631 631
 	}
@@ -641,32 +641,32 @@  discard block
 block discarded – undo
641 641
 	private static function _remove_additional_events_archive_filters() {
642 642
 		remove_filter(
643 643
 		    'the_excerpt',
644
-            array( 'EED_Events_Archive', 'event_datetimes' ),
644
+            array('EED_Events_Archive', 'event_datetimes'),
645 645
             EED_Events_Archive::EVENT_DATETIMES_PRIORITY
646 646
         );
647 647
 		remove_filter(
648 648
 		    'the_excerpt',
649
-            array( 'EED_Events_Archive', 'event_tickets' ),
649
+            array('EED_Events_Archive', 'event_tickets'),
650 650
             EED_Events_Archive::EVENT_TICKETS_PRIORITY
651 651
         );
652 652
 		remove_filter(
653 653
 		    'the_excerpt',
654
-            array( 'EED_Events_Archive', 'event_venues' ),
654
+            array('EED_Events_Archive', 'event_venues'),
655 655
             EED_Events_Archive::EVENT_VENUES_PRIORITY
656 656
         );
657 657
 		remove_filter(
658 658
 		    'the_content',
659
-            array( 'EED_Events_Archive', 'event_datetimes' ),
659
+            array('EED_Events_Archive', 'event_datetimes'),
660 660
             EED_Events_Archive::EVENT_DATETIMES_PRIORITY
661 661
         );
662 662
 		remove_filter(
663 663
 		    'the_content',
664
-            array( 'EED_Events_Archive', 'event_tickets' ),
664
+            array('EED_Events_Archive', 'event_tickets'),
665 665
             EED_Events_Archive::EVENT_TICKETS_PRIORITY
666 666
         );
667 667
 		remove_filter(
668 668
 		    'the_content',
669
-            array( 'EED_Events_Archive', 'event_venues' ),
669
+            array('EED_Events_Archive', 'event_venues'),
670 670
             EED_Events_Archive::EVENT_VENUES_PRIORITY
671 671
         );
672 672
 	}
@@ -681,45 +681,45 @@  discard block
 block discarded – undo
681 681
 	 */
682 682
 	public static function remove_all_events_archive_filters() {
683 683
 		//remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 );
684
-		remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 1 );
684
+		remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 1);
685 685
 		remove_filter(
686 686
 		    'the_excerpt',
687
-            array( 'EED_Events_Archive', 'event_details' ),
687
+            array('EED_Events_Archive', 'event_details'),
688 688
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
689 689
         );
690 690
 		remove_filter(
691 691
 		    'the_excerpt',
692
-            array( 'EED_Events_Archive', 'event_datetimes' ),
692
+            array('EED_Events_Archive', 'event_datetimes'),
693 693
             EED_Events_Archive::EVENT_DATETIMES_PRIORITY
694 694
         );
695 695
 		remove_filter(
696 696
 		    'the_excerpt',
697
-            array( 'EED_Events_Archive', 'event_tickets' ),
697
+            array('EED_Events_Archive', 'event_tickets'),
698 698
             EED_Events_Archive::EVENT_TICKETS_PRIORITY
699 699
         );
700 700
 		remove_filter(
701 701
 		    'the_excerpt',
702
-            array( 'EED_Events_Archive', 'event_venues' ),
702
+            array('EED_Events_Archive', 'event_venues'),
703 703
             EED_Events_Archive::EVENT_VENUES_PRIORITY
704 704
         );
705 705
 		remove_filter(
706 706
 		    'the_content',
707
-            array( 'EED_Events_Archive', 'event_details' ),
707
+            array('EED_Events_Archive', 'event_details'),
708 708
             EED_Events_Archive::EVENT_DETAILS_PRIORITY
709 709
         );
710 710
 		remove_filter(
711 711
 		    'the_content',
712
-            array( 'EED_Events_Archive', 'event_datetimes' ),
712
+            array('EED_Events_Archive', 'event_datetimes'),
713 713
             EED_Events_Archive::EVENT_DATETIMES_PRIORITY
714 714
         );
715 715
 		remove_filter(
716 716
 		    'the_content',
717
-            array( 'EED_Events_Archive', 'event_tickets' ),
717
+            array('EED_Events_Archive', 'event_tickets'),
718 718
             EED_Events_Archive::EVENT_TICKETS_PRIORITY
719 719
         );
720 720
 		remove_filter(
721 721
 		    'the_content',
722
-            array( 'EED_Events_Archive', 'event_venues' ),
722
+            array('EED_Events_Archive', 'event_venues'),
723 723
             EED_Events_Archive::EVENT_VENUES_PRIORITY
724 724
         );
725 725
 		// don't display entry meta because the existing theme will take care of that
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 	 *  @return 	void
742 742
 	 */
743 743
 	public function load_event_list_assets() {
744
-        do_action( 'AHEE__EED_Events_Archive__before_load_assets' );
745
-		add_filter( 'FHEE_load_EE_Session', '__return_true' );
746
-		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
747
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
748
-		if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
749
-			add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
744
+        do_action('AHEE__EED_Events_Archive__before_load_assets');
745
+		add_filter('FHEE_load_EE_Session', '__return_true');
746
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
747
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
748
+		if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
749
+			add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
750 750
 		}
751 751
 	}
752 752
 
@@ -763,13 +763,13 @@  discard block
 block discarded – undo
763 763
 	 */
764 764
 	public function wp_enqueue_scripts() {
765 765
 		// get some style
766
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) {
766
+		if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) {
767 767
 			// first check uploads folder
768
-			if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
769
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
768
+			if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
769
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
770 770
 			} else {
771 771
 		}
772
-		wp_enqueue_style( $this->theme );
772
+		wp_enqueue_style($this->theme);
773 773
 
774 774
 	}
775 775
 }
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
 	 */
788 788
 	public static function template_settings_form() {
789 789
 	$template_settings = EE_Registry::instance()->CFG->template_settings;
790
-	$template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
791
-	$template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive );
790
+	$template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
791
+	$template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive);
792 792
 	$events_archive_settings = array(
793 793
 		'display_status_banner' => 0,
794 794
 		'display_description' => 1,
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 		'display_venue' => 0,
798 798
 		'display_expired_events' => 0
799 799
 	);
800
-	$events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive );
801
-	EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings );
800
+	$events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive);
801
+	EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings);
802 802
 }
803 803
 
804 804
 
@@ -814,16 +814,16 @@  discard block
 block discarded – undo
814 814
 	 *  @param 	EE_Request_Handler $REQ
815 815
 	 *  @return 	EE_Template_Config
816 816
 	 */
817
-	public static function update_template_settings( $CFG, $REQ ) {
817
+	public static function update_template_settings($CFG, $REQ) {
818 818
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
819 819
 		// unless we are resetting the config...
820
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
821
-			$CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
822
-			$CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
823
-			$CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
824
-			$CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
825
-			$CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
826
-			$CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;			}
820
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
821
+			$CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
822
+			$CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
823
+			$CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
824
+			$CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
825
+			$CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
826
+			$CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; }
827 827
 		return $CFG;
828 828
 	}
829 829
 
@@ -836,10 +836,10 @@  discard block
 block discarded – undo
836 836
 	 * @param string $extra_class
837 837
 	 * @return    string
838 838
 	 */
839
-	public static function event_list_css( $extra_class = '' ) {
840
-		$event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array();
839
+	public static function event_list_css($extra_class = '') {
840
+		$event_list_css = ! empty($extra_class) ? array($extra_class) : array();
841 841
 		$event_list_css[] = 'espresso-event-list-event';
842
-		return implode( ' ', $event_list_css );
842
+		return implode(' ', $event_list_css);
843 843
 	}
844 844
 
845 845
 
@@ -866,9 +866,9 @@  discard block
 block discarded – undo
866 866
 	 * @param $value
867 867
 	 * @return    bool
868 868
 	 */
869
-	public static function display_description( $value ) {
869
+	public static function display_description($value) {
870 870
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
871
-		$display_description= isset( $config->display_description ) ? $config->display_description : 1;
871
+		$display_description = isset($config->display_description) ? $config->display_description : 1;
872 872
 		return $display_description === $value ? TRUE : FALSE;
873 873
 	}
874 874
 
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 	 */
882 882
 	public static function display_ticket_selector() {
883 883
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
884
-		return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE;
884
+		return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE;
885 885
 	}
886 886
 
887 887
 
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 	 */
895 895
 	public static function display_venue() {
896 896
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
897
-		return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE;
897
+		return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE;
898 898
 	}
899 899
 
900 900
 
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 	 */
907 907
 	public static function display_datetimes() {
908 908
 		$config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive;
909
-		return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE;
909
+		return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE;
910 910
 }
911 911
 
912 912
 
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	 *  @return 	string
922 922
 	 */
923 923
 	public static function event_list_title() {
924
-		return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' ));
924
+		return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso'));
925 925
 	}
926 926
 
927 927
 
@@ -930,11 +930,11 @@  discard block
 block discarded – undo
930 930
 	/**
931 931
 	 * 	@since 4.4.0
932 932
 	 */
933
-	public static function _doing_it_wrong_notice( $function = '' ) {
933
+	public static function _doing_it_wrong_notice($function = '') {
934 934
 		EE_Error::doing_it_wrong(
935 935
 			__FUNCTION__,
936 936
 			sprintf(
937
-				__( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ),
937
+				__('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'),
938 938
 				$function,
939 939
 				'<br />',
940 940
 				'4.6.0'
@@ -956,89 +956,89 @@  discard block
 block discarded – undo
956 956
 	 * 	@deprecated
957 957
 	 * 	@since 4.4.0
958 958
 	 */
959
-	public function posts_fields( $SQL, WP_Query $wp_query ) {
960
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
961
-		return EEH_Event_Query::posts_fields( $SQL, $wp_query );
959
+	public function posts_fields($SQL, WP_Query $wp_query) {
960
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
961
+		return EEH_Event_Query::posts_fields($SQL, $wp_query);
962 962
 	}
963 963
 	/**
964 964
 	 * 	@deprecated
965 965
 	 * 	@since 4.4.0
966 966
 	 */
967
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
968
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
969
-		return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params );
967
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
968
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
969
+		return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params);
970 970
 	}
971 971
 	/**
972 972
 	 * 	@deprecated
973 973
 	 * 	@since 4.4.0
974 974
 	 */
975
-	public function posts_join( $SQL, WP_Query $wp_query ) {
976
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
977
-		return EEH_Event_Query::posts_join( $SQL, $wp_query );
975
+	public function posts_join($SQL, WP_Query $wp_query) {
976
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
977
+		return EEH_Event_Query::posts_join($SQL, $wp_query);
978 978
 	}
979 979
 	/**
980 980
 	 * 	@deprecated
981 981
 	 * 	@since 4.4.0
982 982
 	 */
983
-	public static function posts_join_sql_for_terms( $join_terms = NULL ) {
984
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
985
-		return EEH_Event_Query::posts_join_sql_for_terms( $join_terms );
983
+	public static function posts_join_sql_for_terms($join_terms = NULL) {
984
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
985
+		return EEH_Event_Query::posts_join_sql_for_terms($join_terms);
986 986
 	}
987 987
 	/**
988 988
 	 * 	@deprecated
989 989
 	 * 	@since 4.4.0
990 990
 	 */
991
-	public static function posts_join_for_orderby( $orderby_params = array() ) {
992
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
993
-		return EEH_Event_Query::posts_join_for_orderby( $orderby_params );
991
+	public static function posts_join_for_orderby($orderby_params = array()) {
992
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
993
+		return EEH_Event_Query::posts_join_for_orderby($orderby_params);
994 994
 	}
995 995
 	/**
996 996
 	 * 	@deprecated
997 997
 	 * 	@since 4.4.0
998 998
 	 */
999
-	public function posts_where( $SQL, WP_Query $wp_query ) {
1000
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
1001
-		return EEH_Event_Query::posts_where( $SQL, $wp_query );
999
+	public function posts_where($SQL, WP_Query $wp_query) {
1000
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1001
+		return EEH_Event_Query::posts_where($SQL, $wp_query);
1002 1002
 	}
1003 1003
 	/**
1004 1004
 	 * 	@deprecated
1005 1005
 	 * 	@since 4.4.0
1006 1006
 	 */
1007
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
1008
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
1009
-		return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired );
1007
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
1008
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1009
+		return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired);
1010 1010
 	}
1011 1011
 	/**
1012 1012
 	 * 	@deprecated
1013 1013
 	 * 	@since 4.4.0
1014 1014
 	 */
1015
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
1016
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
1017
-		return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug );
1015
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
1016
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1017
+		return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug);
1018 1018
 	}
1019 1019
 	/**
1020 1020
 	 * 	@deprecated
1021 1021
 	 * 	@since 4.4.0
1022 1022
 	 */
1023
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
1024
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
1025
-		return EEH_Event_Query::posts_where_sql_for_event_list_month( $month );
1023
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
1024
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1025
+		return EEH_Event_Query::posts_where_sql_for_event_list_month($month);
1026 1026
 	}
1027 1027
 	/**
1028 1028
 	 * 	@deprecated
1029 1029
 	 * 	@since 4.4.0
1030 1030
 	 */
1031
-	public function posts_orderby( $SQL, WP_Query $wp_query ) {
1032
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
1033
-		return EEH_Event_Query::posts_orderby( $SQL, $wp_query );
1031
+	public function posts_orderby($SQL, WP_Query $wp_query) {
1032
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1033
+		return EEH_Event_Query::posts_orderby($SQL, $wp_query);
1034 1034
 	}
1035 1035
 	/**
1036 1036
 	 * 	@deprecated
1037 1037
 	 * 	@since 4.4.0
1038 1038
 	 */
1039
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
1040
-		EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ );
1041
-		return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort );
1039
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
1040
+		EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__);
1041
+		return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort);
1042 1042
 	}
1043 1043
 
1044 1044
 
@@ -1069,8 +1069,8 @@  discard block
 block discarded – undo
1069 1069
  * @param string $extra_class
1070 1070
  * @return string
1071 1071
  */
1072
-function espresso_event_list_css( $extra_class = '' ) {
1073
-	return EED_Events_Archive::event_list_css( $extra_class );
1072
+function espresso_event_list_css($extra_class = '') {
1073
+	return EED_Events_Archive::event_list_css($extra_class);
1074 1074
 }
1075 1075
 
1076 1076
 /**
@@ -1084,14 +1084,14 @@  discard block
 block discarded – undo
1084 1084
  * @return bool
1085 1085
  */
1086 1086
 function espresso_display_full_description_in_event_list() {
1087
-	return EED_Events_Archive::display_description( 2 );
1087
+	return EED_Events_Archive::display_description(2);
1088 1088
 }
1089 1089
 
1090 1090
 /**
1091 1091
  * @return bool
1092 1092
  */
1093 1093
 function espresso_display_excerpt_in_event_list() {
1094
-	return EED_Events_Archive::display_description( 1 );
1094
+	return EED_Events_Archive::display_description(1);
1095 1095
 }
1096 1096
 
1097 1097
 /**
Please login to merge, or discard this patch.