Completed
Branch BUG-10438-happy-accident-datet... (509e8f)
by
unknown
16:03
created
core/helpers/EEH_Event_View.helper.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
 	 * @param    int $EVT_ID
41 41
 	 * @return    object
42 42
 	 */
43
-	public static function get_event( $EVT_ID = 0 ) {
44
-		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID );
43
+	public static function get_event($EVT_ID = 0) {
44
+		$EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID);
45 45
 		// do we already have the Event  you are looking for?
46
-		if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) {
46
+		if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
47 47
 			return EEH_Event_View::$_event;
48 48
 		}
49 49
 		EEH_Event_View::$_event = NULL;
50 50
 		// international newspaper?
51 51
 		global $post;
52 52
 		// if this is being called from an EE_Event post, then we can just grab the attached EE_Event object
53
-		 if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) {
53
+		 if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) {
54 54
 //			d( $post );
55 55
 			// grab the event we're looking for
56
-			if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) {
56
+			if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) {
57 57
 				EEH_Event_View::$_event = $post->EE_Event;
58 58
 //				d( EEH_Event_View::$_event );
59 59
 			}
60 60
 			// now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID...
61
-			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) {
61
+			if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
62 62
 				// sigh... pull it from the db
63
-				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
63
+				EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
64 64
 //				d( EEH_Event_View::$_event );
65 65
 			}
66 66
 		}
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param    int $EVT_ID
77 77
 	 * @return    boolean
78 78
 	 */
79
-	public static function display_ticket_selector( $EVT_ID = 0 ) {
80
-		$event = EEH_Event_View::get_event( $EVT_ID );
79
+	public static function display_ticket_selector($EVT_ID = 0) {
80
+		$event = EEH_Event_View::get_event($EVT_ID);
81 81
 		return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE;
82 82
 	}
83 83
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param    int $EVT_ID
91 91
 	 * @return    string
92 92
 	 */
93
-	public static function event_status( $EVT_ID = 0 ) {
94
-		$event = EEH_Event_View::get_event( $EVT_ID );
95
-		return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : '';
93
+	public static function event_status($EVT_ID = 0) {
94
+		$event = EEH_Event_View::get_event($EVT_ID);
95
+		return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : '';
96 96
 	}
97 97
 
98 98
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param    int $EVT_ID
105 105
 	 *  @return 	string
106 106
 	 */
107
-	public static function event_active_status( $EVT_ID = 0 ) {
108
-		$event = EEH_Event_View::get_event( $EVT_ID );
107
+	public static function event_active_status($EVT_ID = 0) {
108
+		$event = EEH_Event_View::get_event($EVT_ID);
109 109
 		return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive';
110 110
 	}
111 111
 
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 * @param    int $EVT_ID
119 119
 	 *  @return 	string
120 120
 	 */
121
-	public static function event_has_content_or_excerpt( $EVT_ID = 0 ) {
122
-		$event = EEH_Event_View::get_event( $EVT_ID );
121
+	public static function event_has_content_or_excerpt($EVT_ID = 0) {
122
+		$event = EEH_Event_View::get_event($EVT_ID);
123 123
 		$has_content_or_excerpt = FALSE;
124
-		if ( $event instanceof EE_Event ) {
125
-			$has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE;
124
+		if ($event instanceof EE_Event) {
125
+			$has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE;
126 126
 		}
127
-		if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) {
127
+		if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) {
128 128
 			$has_content_or_excerpt = FALSE;
129 129
 		}
130 130
 		return $has_content_or_excerpt;
@@ -140,34 +140,34 @@  discard block
 block discarded – undo
140 140
 	 * @param null $more
141 141
 	 * @return    string
142 142
 	 */
143
-	public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) {
143
+	public static function event_content_or_excerpt($num_words = NULL, $more = NULL) {
144 144
 		global $post;
145 145
 
146 146
 		ob_start();
147
-		if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) {
147
+		if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
148 148
 			// admin has chosen "full description" for the "Event Espresso - Events > Templates > Display Description" option
149 149
 			the_content();
150
-		} else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) ) {
150
+		} else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) {
151 151
             // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
152 152
 			// AND an excerpt actually exists
153 153
 			the_excerpt();
154
-		} else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) {
154
+		} else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) {
155 155
             // admin has chosen "excerpt (short desc)" for the "Event Espresso - Events > Templates > Display Description" option
156 156
 			// but NO excerpt actually exists, so we need to create one
157
-			if ( ! empty( $num_words )) {
158
-				if ( empty( $more )) {
159
-					$more_link_text = __( '(more…)' );
160
-					$more = ' <a href="' . get_permalink() . '"';
157
+			if ( ! empty($num_words)) {
158
+				if (empty($more)) {
159
+					$more_link_text = __('(more&hellip;)');
160
+					$more = ' <a href="'.get_permalink().'"';
161 161
 					$more .= ' class="more-link"';
162 162
 					$more .= \EED_Events_Archive::link_target();
163
-					$more .= '>' . $more_link_text . '</a>';
164
-                    $more = apply_filters( 'the_content_more_link', $more, $more_link_text );
163
+					$more .= '>'.$more_link_text.'</a>';
164
+                    $more = apply_filters('the_content_more_link', $more, $more_link_text);
165 165
 				}
166
-				$content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' ));
166
+				$content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
167 167
 
168
-				$content =  wp_trim_words( $content, $num_words, ' ' ) . $more;
168
+				$content = wp_trim_words($content, $num_words, ' ').$more;
169 169
             } else {
170
-                $content =  get_the_content();
170
+                $content = get_the_content();
171 171
 			}
172 172
 			global $allowedtags;
173 173
 			// make sure links are allowed
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
             // but get previous value so we can reset it
182 182
             $prev_value = $allowedtags['a']['target'];
183 183
             $allowedtags['a']['target'] = true;
184
-			$content = wp_kses( $content, $allowedtags );
185
-			$content = strip_shortcodes( $content );
186
-			echo apply_filters( 'the_content', $content );
184
+			$content = wp_kses($content, $allowedtags);
185
+			$content = strip_shortcodes($content);
186
+			echo apply_filters('the_content', $content);
187 187
 			$allowedtags['a']['target'] = $prev_value;
188 188
         } else {
189 189
             // admin has chosen "none" for the "Event Espresso - Events > Templates > Display Description" option
190
-			echo apply_filters( 'the_content', '' );
190
+			echo apply_filters('the_content', '');
191 191
 		}
192 192
 		return ob_get_clean();
193 193
 	}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	 * @param    int $EVT_ID
202 202
 	 *  @return 	EE_Ticket[]
203 203
 	 */
204
-	public static function event_tickets_available( $EVT_ID = 0 ) {
205
-		$event = EEH_Event_View::get_event( $EVT_ID );
204
+	public static function event_tickets_available($EVT_ID = 0) {
205
+		$event = EEH_Event_View::get_event($EVT_ID);
206 206
 		$tickets_available_for_purchase = array();
207
-		if( $event instanceof EE_Event ) {
208
-			$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE );
209
-			foreach( $datetimes as $datetime ) {
210
-				$tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() );
207
+		if ($event instanceof EE_Event) {
208
+			$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE);
209
+			foreach ($datetimes as $datetime) {
210
+				$tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
211 211
 			}
212 212
 		}
213 213
 		return $tickets_available_for_purchase;
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 	 * @param 	  bool   $hide_uncategorized
224 224
 	 * @return    string
225 225
 	 */
226
-	public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) {
226
+	public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) {
227 227
 		$category_links = array();
228
-		$event = EEH_Event_View::get_event( $EVT_ID );
229
-		if ( $event instanceof EE_Event ) {
230
-			$event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' );
231
-			if ( $event_categories ) {
228
+		$event = EEH_Event_View::get_event($EVT_ID);
229
+		if ($event instanceof EE_Event) {
230
+			$event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
231
+			if ($event_categories) {
232 232
 				// loop thru terms and create links
233
-				foreach ( $event_categories as $term ) {
234
-					$url = get_term_link( $term, 'espresso_venue_categories' );
235
-					if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) {
236
-						$category_links[] = '<a href="' . esc_url( $url )
233
+				foreach ($event_categories as $term) {
234
+					$url = get_term_link($term, 'espresso_venue_categories');
235
+					if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) {
236
+						$category_links[] = '<a href="'.esc_url($url)
237 237
                                             . '" rel="tag"'
238 238
                                             . \EED_Events_Archive::link_target()
239 239
                                             .'>'
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				}
244 244
 			}
245 245
 		}
246
-		return implode( ', ', $category_links );
246
+		return implode(', ', $category_links);
247 247
 	}
248 248
 
249 249
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * @param int    $EVT_ID
258 258
 	 * @return    string
259 259
 	 */
260
-	public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
261
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
262
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
263
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) :  '';
260
+	public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
261
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
262
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
263
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
264 264
 	}
265 265
 
266 266
 
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 * @param int    $EVT_ID
275 275
 	 * @return    string
276 276
 	 */
277
-	public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
278
-		$datetime = EEH_Event_View::get_last_date_obj( $EVT_ID );
279
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
280
-		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
277
+	public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
278
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
279
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
280
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
281 281
 	}
282 282
 
283 283
 
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 	 * @param int    $EVT_ID
292 292
 	 * @return    string
293 293
 	 */
294
-	public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
295
-		$datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID );
296
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
297
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : '';
294
+	public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
295
+		$datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
296
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
297
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
298 298
 	}
299 299
 
300 300
 
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 	 * @param int    $EVT_ID
309 309
 	 * @return    string
310 310
 	 */
311
-	public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) {
312
-		$datetime = EEH_Event_View::get_latest_date_obj( $EVT_ID );
313
-		$format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt;
314
-		return $datetime instanceof EE_Datetime ?  $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : '';
311
+	public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) {
312
+		$datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
313
+		$format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt;
314
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
315 315
 	}
316 316
 
317 317
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 	 * @param int $EVT_ID
324 324
 	 * @return    string
325 325
 	 */
326
-	public static function event_date_as_calendar_page( $EVT_ID = 0 ) {
327
-		$datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID );
328
-		if ( $datetime instanceof EE_Datetime ) {
326
+	public static function event_date_as_calendar_page($EVT_ID = 0) {
327
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
328
+		if ($datetime instanceof EE_Datetime) {
329 329
 	?>
330 330
 		<div class="event-date-calendar-page-dv">
331
-			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div>
332
-			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div>
331
+			<div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div>
332
+			<div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div>
333 333
 		</div>
334 334
 	<?php
335 335
 		}
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
 	 * @param int $EVT_ID
345 345
 	 * @return    string
346 346
 	 */
347
-	public static function get_primary_date_obj( $EVT_ID = 0 ) {
348
-		$event = EEH_Event_View::get_event( $EVT_ID );
349
-		if ( $event instanceof EE_Event ) {
347
+	public static function get_primary_date_obj($EVT_ID = 0) {
348
+		$event = EEH_Event_View::get_event($EVT_ID);
349
+		if ($event instanceof EE_Event) {
350 350
 			$datetimes = $event->get_many_related(
351 351
 				'Datetime',
352 352
 				array(
353 353
 					'limit' => 1,
354
-					'order_by' => array( 'DTT_order' => 'ASC' )
354
+					'order_by' => array('DTT_order' => 'ASC')
355 355
 				)
356 356
 			);
357
-			return reset( $datetimes );
357
+			return reset($datetimes);
358 358
 		} else {
359 359
 			 return FALSE;
360 360
 		}
@@ -369,17 +369,17 @@  discard block
 block discarded – undo
369 369
 	 * @param int $EVT_ID
370 370
 	 * @return    string
371 371
 	 */
372
-	public static function get_last_date_obj( $EVT_ID = 0 ) {
373
-		$event = EEH_Event_View::get_event( $EVT_ID );
374
-		if ( $event instanceof EE_Event ) {
372
+	public static function get_last_date_obj($EVT_ID = 0) {
373
+		$event = EEH_Event_View::get_event($EVT_ID);
374
+		if ($event instanceof EE_Event) {
375 375
 			$datetimes = $event->get_many_related(
376 376
 				'Datetime',
377 377
 				array(
378 378
 					'limit' => 1,
379
-					'order_by' => array( 'DTT_order' => 'DESC' )
379
+					'order_by' => array('DTT_order' => 'DESC')
380 380
 				)
381 381
 			);
382
-			return end( $datetimes );
382
+			return end($datetimes);
383 383
 		} else {
384 384
 			return FALSE;
385 385
 		}
@@ -394,17 +394,17 @@  discard block
 block discarded – undo
394 394
 	 * @param int $EVT_ID
395 395
 	 * @return    string
396 396
 	 */
397
-	public static function get_earliest_date_obj( $EVT_ID = 0 ) {
398
-		$event = EEH_Event_View::get_event( $EVT_ID );
399
-		if ( $event instanceof EE_Event ) {
397
+	public static function get_earliest_date_obj($EVT_ID = 0) {
398
+		$event = EEH_Event_View::get_event($EVT_ID);
399
+		if ($event instanceof EE_Event) {
400 400
 			$datetimes = $event->get_many_related(
401 401
 				'Datetime',
402 402
 				array(
403 403
 					'limit' => 1,
404
-					'order_by' => array( 'DTT_EVT_start' => 'ASC' )
404
+					'order_by' => array('DTT_EVT_start' => 'ASC')
405 405
 				)
406 406
 			);
407
-			return reset( $datetimes );
407
+			return reset($datetimes);
408 408
 		} else {
409 409
 			 return FALSE;
410 410
 		}
@@ -419,17 +419,17 @@  discard block
 block discarded – undo
419 419
 	 * @param int $EVT_ID
420 420
 	 * @return    string
421 421
 	 */
422
-	public static function get_latest_date_obj( $EVT_ID = 0 ) {
423
-		$event = EEH_Event_View::get_event( $EVT_ID );
424
-		if ( $event instanceof EE_Event ) {
422
+	public static function get_latest_date_obj($EVT_ID = 0) {
423
+		$event = EEH_Event_View::get_event($EVT_ID);
424
+		if ($event instanceof EE_Event) {
425 425
 			$datetimes = $event->get_many_related(
426 426
 				'Datetime',
427 427
 				array(
428 428
 					'limit' => 1,
429
-					'order_by' => array( 'DTT_EVT_start' => 'DESC' )
429
+					'order_by' => array('DTT_EVT_start' => 'DESC')
430 430
 				)
431 431
 			);
432
-			return end( $datetimes );
432
+			return end($datetimes);
433 433
 		} else {
434 434
 			return FALSE;
435 435
 		}
@@ -447,17 +447,17 @@  discard block
 block discarded – undo
447 447
 	 * @param null $limit
448 448
 	 * @return EE_Datetime[]
449 449
 	 */
450
-	public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) {
451
-		$event = EEH_Event_View::get_event( $EVT_ID );
452
-		if($include_expired === null){
453
-			if($event instanceof EE_Event && $event->is_expired()){
450
+	public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) {
451
+		$event = EEH_Event_View::get_event($EVT_ID);
452
+		if ($include_expired === null) {
453
+			if ($event instanceof EE_Event && $event->is_expired()) {
454 454
 				$include_expired = true;
455
-			}else{
455
+			} else {
456 456
 				$include_expired = false;
457 457
 			}
458 458
 		}
459 459
 
460
-		if ( $event instanceof EE_Event ) {
460
+		if ($event instanceof EE_Event) {
461 461
 			return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
462 462
 		} else {
463 463
 			 return array();
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 	 * @param int $EVT_ID
474 474
 	 * @return    string
475 475
 	 */
476
-	public static function event_link_url( $EVT_ID = 0 ) {
477
-		$event = EEH_Event_View::get_event( $EVT_ID );
478
-		if ( $event instanceof EE_Event ) {
479
-			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() );
480
-			return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url;
476
+	public static function event_link_url($EVT_ID = 0) {
477
+		$event = EEH_Event_View::get_event($EVT_ID);
478
+		if ($event instanceof EE_Event) {
479
+			$url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID());
480
+			return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url;
481 481
 		}
482 482
 		return NULL;
483 483
 	}
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	 * @param int $EVT_ID
492 492
 	 * @return    string
493 493
 	 */
494
-	public static function event_phone( $EVT_ID = 0 ) {
495
-		$event = EEH_Event_View::get_event( $EVT_ID );
496
-		if ( $event instanceof EE_Event ) {
497
-			return EEH_Schema::telephone( $event->phone() );
494
+	public static function event_phone($EVT_ID = 0) {
495
+		$event = EEH_Event_View::get_event($EVT_ID);
496
+		if ($event instanceof EE_Event) {
497
+			return EEH_Schema::telephone($event->phone());
498 498
 		}
499 499
 		return NULL;
500 500
 	}
@@ -511,26 +511,26 @@  discard block
 block discarded – undo
511 511
 	 * @param string $after
512 512
 	 * @return    string
513 513
 	 */
514
-	public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) {
515
-		$event = EEH_Event_View::get_event( $EVT_ID );
516
-		if ( $event instanceof EE_Event ) {
514
+	public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') {
515
+		$event = EEH_Event_View::get_event($EVT_ID);
516
+		if ($event instanceof EE_Event) {
517 517
 			// can the user edit this post ?
518
-			if ( current_user_can( 'edit_post', $event->ID() )) {
518
+			if (current_user_can('edit_post', $event->ID())) {
519 519
 				// set link text
520
-				$link_text = ! empty( $link ) ? $link : __('edit this event');
520
+				$link_text = ! empty($link) ? $link : __('edit this event');
521 521
 				// generate nonce
522
-				$nonce = wp_create_nonce( 'edit_nonce' );
522
+				$nonce = wp_create_nonce('edit_nonce');
523 523
 				// generate url to event editor for this event
524
-				$url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() );
524
+				$url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url());
525 525
 				// get edit CPT text
526
-				$post_type_obj = get_post_type_object( 'espresso_events' );
526
+				$post_type_obj = get_post_type_object('espresso_events');
527 527
 				// build final link html
528
-				$link = '<a class="post-edit-link" href="' . $url . '" ';
529
-				$link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"';
528
+				$link = '<a class="post-edit-link" href="'.$url.'" ';
529
+				$link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"';
530 530
 				$link .= \EED_Events_Archive::link_target();
531
-				$link .='>' . $link_text . '</a>';
531
+				$link .= '>'.$link_text.'</a>';
532 532
 				// put it all together
533
-				return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after;
533
+				return $before.apply_filters('edit_post_link', $link, $event->ID()).$after;
534 534
 			}
535 535
 		}
536 536
 		return '';
Please login to merge, or discard this patch.