@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | //reset property so that the new event is cached. |
| 55 | 55 | EEH_Event_View::$_event = null; |
| 56 | - if (! $EVT_ID && $post instanceof EE_Event) { |
|
| 56 | + if ( ! $EVT_ID && $post instanceof EE_Event) { |
|
| 57 | 57 | EEH_Event_View::$_event = $post; |
| 58 | 58 | return EEH_Event_View::$_event; |
| 59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return EEH_Event_View::$_event; |
| 73 | 73 | } |
| 74 | 74 | //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
| 75 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 75 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 76 | 76 | EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
| 77 | 77 | } |
| 78 | 78 | return EEH_Event_View::$_event; |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * @param int $EVT_ID |
| 88 | 88 | * @return boolean |
| 89 | 89 | */ |
| 90 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
| 91 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 90 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
| 91 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 92 | 92 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | * @param int $EVT_ID |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - public static function event_status( $EVT_ID = 0 ) { |
|
| 105 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 106 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
| 104 | + public static function event_status($EVT_ID = 0) { |
|
| 105 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 106 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * @param int $EVT_ID |
| 116 | 116 | * @return string |
| 117 | 117 | */ |
| 118 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
| 119 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 118 | + public static function event_active_status($EVT_ID = 0) { |
|
| 119 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 120 | 120 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | * @param int $EVT_ID |
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
| 133 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 132 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
| 133 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 134 | 134 | $has_content_or_excerpt = FALSE; |
| 135 | - if ( $event instanceof EE_Event ) { |
|
| 136 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
| 135 | + if ($event instanceof EE_Event) { |
|
| 136 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
| 137 | 137 | } |
| 138 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
| 138 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
| 139 | 139 | $has_content_or_excerpt = FALSE; |
| 140 | 140 | } |
| 141 | 141 | return $has_content_or_excerpt; |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | * @param null $more |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
| 154 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
| 155 | 155 | global $post; |
| 156 | 156 | ob_start(); |
| 157 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
| 157 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
| 158 | 158 | // admin has chosen "full description" |
| 159 | 159 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 160 | 160 | the_content(); |
| 161 | - } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
|
| 162 | - if ( has_excerpt( $post->ID )) { |
|
| 161 | + } else if ((is_archive() && espresso_display_excerpt_in_event_list())) { |
|
| 162 | + if (has_excerpt($post->ID)) { |
|
| 163 | 163 | // admin has chosen "excerpt (short desc)" |
| 164 | 164 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 165 | 165 | // AND an excerpt actually exists |
@@ -168,20 +168,20 @@ discard block |
||
| 168 | 168 | // admin has chosen "excerpt (short desc)" |
| 169 | 169 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 170 | 170 | // but NO excerpt actually exists, so we need to create one |
| 171 | - if ( ! empty( $num_words )) { |
|
| 172 | - if ( empty( $more )) { |
|
| 173 | - $more_link_text = __( '(more…)' ); |
|
| 174 | - $more = ' <a href="' . get_permalink() . '"'; |
|
| 171 | + if ( ! empty($num_words)) { |
|
| 172 | + if (empty($more)) { |
|
| 173 | + $more_link_text = __('(more…)'); |
|
| 174 | + $more = ' <a href="'.get_permalink().'"'; |
|
| 175 | 175 | $more .= ' class="more-link"'; |
| 176 | 176 | $more .= \EED_Events_Archive::link_target(); |
| 177 | - $more .= '>' . $more_link_text . '</a>'; |
|
| 178 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
| 177 | + $more .= '>'.$more_link_text.'</a>'; |
|
| 178 | + $more = apply_filters('the_content_more_link', $more, $more_link_text); |
|
| 179 | 179 | } |
| 180 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
| 180 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
| 181 | 181 | |
| 182 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
| 182 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
| 183 | 183 | } else { |
| 184 | - $content = get_the_content(); |
|
| 184 | + $content = get_the_content(); |
|
| 185 | 185 | } |
| 186 | 186 | global $allowedtags; |
| 187 | 187 | // make sure links are allowed |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | // but get previous value so we can reset it |
| 196 | 196 | $prev_value = $allowedtags['a']['target']; |
| 197 | 197 | $allowedtags['a']['target'] = true; |
| 198 | - $content = wp_kses( $content, $allowedtags ); |
|
| 199 | - $content = strip_shortcodes( $content ); |
|
| 200 | - echo apply_filters( 'the_content', $content ); |
|
| 198 | + $content = wp_kses($content, $allowedtags); |
|
| 199 | + $content = strip_shortcodes($content); |
|
| 200 | + echo apply_filters('the_content', $content); |
|
| 201 | 201 | $allowedtags['a']['target'] = $prev_value; |
| 202 | 202 | } |
| 203 | 203 | } else { |
| 204 | 204 | // admin has chosen "none" |
| 205 | 205 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 206 | - echo apply_filters( 'the_content', '' ); |
|
| 206 | + echo apply_filters('the_content', ''); |
|
| 207 | 207 | } |
| 208 | 208 | return ob_get_clean(); |
| 209 | 209 | } |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | * @param int $EVT_ID |
| 218 | 218 | * @return EE_Ticket[] |
| 219 | 219 | */ |
| 220 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
| 221 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 220 | + public static function event_tickets_available($EVT_ID = 0) { |
|
| 221 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 222 | 222 | $tickets_available_for_purchase = array(); |
| 223 | - if( $event instanceof EE_Event ) { |
|
| 224 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
| 225 | - foreach( $datetimes as $datetime ) { |
|
| 226 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
| 223 | + if ($event instanceof EE_Event) { |
|
| 224 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
| 225 | + foreach ($datetimes as $datetime) { |
|
| 226 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | return $tickets_available_for_purchase; |
@@ -239,17 +239,17 @@ discard block |
||
| 239 | 239 | * @param bool $hide_uncategorized |
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
| 242 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
| 243 | 243 | $category_links = array(); |
| 244 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 245 | - if ( $event instanceof EE_Event ) { |
|
| 246 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
| 247 | - if ( $event_categories ) { |
|
| 244 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 245 | + if ($event instanceof EE_Event) { |
|
| 246 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
| 247 | + if ($event_categories) { |
|
| 248 | 248 | // loop thru terms and create links |
| 249 | - foreach ( $event_categories as $term ) { |
|
| 250 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
| 251 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
| 252 | - $category_links[] = '<a href="' . esc_url( $url ) |
|
| 249 | + foreach ($event_categories as $term) { |
|
| 250 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
| 251 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
| 252 | + $category_links[] = '<a href="'.esc_url($url) |
|
| 253 | 253 | . '" rel="tag"' |
| 254 | 254 | . \EED_Events_Archive::link_target() |
| 255 | 255 | .'>' |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | - return implode( ', ', $category_links ); |
|
| 262 | + return implode(', ', $category_links); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | * @param int $EVT_ID |
| 274 | 274 | * @return string |
| 275 | 275 | */ |
| 276 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 277 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 278 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 279 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
| 276 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 277 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 278 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 279 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | * @param int $EVT_ID |
| 291 | 291 | * @return string |
| 292 | 292 | */ |
| 293 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 294 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
| 295 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 296 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
| 293 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 294 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
| 295 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 296 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | * @param int $EVT_ID |
| 308 | 308 | * @return string |
| 309 | 309 | */ |
| 310 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 311 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
| 312 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 313 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
| 310 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 311 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
| 312 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 313 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | * @param int $EVT_ID |
| 325 | 325 | * @return string |
| 326 | 326 | */ |
| 327 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 328 | - $datetime = EEH_Event_View::get_latest_date_obj( $EVT_ID ); |
|
| 329 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 330 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
| 327 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 328 | + $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID); |
|
| 329 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 330 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | * @param int $EVT_ID |
| 340 | 340 | * @return string |
| 341 | 341 | */ |
| 342 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
| 343 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 344 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 342 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
| 343 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 344 | + if ($datetime instanceof EE_Datetime) { |
|
| 345 | 345 | ?> |
| 346 | 346 | <div class="event-date-calendar-page-dv"> |
| 347 | - <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div> |
|
| 348 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
| 347 | + <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div> |
|
| 348 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
| 349 | 349 | </div> |
| 350 | 350 | <?php |
| 351 | 351 | } |
@@ -360,17 +360,17 @@ discard block |
||
| 360 | 360 | * @param int $EVT_ID |
| 361 | 361 | * @return string |
| 362 | 362 | */ |
| 363 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
| 364 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 365 | - if ( $event instanceof EE_Event ) { |
|
| 363 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
| 364 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 365 | + if ($event instanceof EE_Event) { |
|
| 366 | 366 | $datetimes = $event->get_many_related( |
| 367 | 367 | 'Datetime', |
| 368 | 368 | array( |
| 369 | 369 | 'limit' => 1, |
| 370 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
| 370 | + 'order_by' => array('DTT_order' => 'ASC') |
|
| 371 | 371 | ) |
| 372 | 372 | ); |
| 373 | - return reset( $datetimes ); |
|
| 373 | + return reset($datetimes); |
|
| 374 | 374 | } else { |
| 375 | 375 | return FALSE; |
| 376 | 376 | } |
@@ -385,17 +385,17 @@ discard block |
||
| 385 | 385 | * @param int $EVT_ID |
| 386 | 386 | * @return string |
| 387 | 387 | */ |
| 388 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
| 389 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 390 | - if ( $event instanceof EE_Event ) { |
|
| 388 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
| 389 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 390 | + if ($event instanceof EE_Event) { |
|
| 391 | 391 | $datetimes = $event->get_many_related( |
| 392 | 392 | 'Datetime', |
| 393 | 393 | array( |
| 394 | 394 | 'limit' => 1, |
| 395 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
| 395 | + 'order_by' => array('DTT_order' => 'DESC') |
|
| 396 | 396 | ) |
| 397 | 397 | ); |
| 398 | - return end( $datetimes ); |
|
| 398 | + return end($datetimes); |
|
| 399 | 399 | } else { |
| 400 | 400 | return FALSE; |
| 401 | 401 | } |
@@ -410,17 +410,17 @@ discard block |
||
| 410 | 410 | * @param int $EVT_ID |
| 411 | 411 | * @return string |
| 412 | 412 | */ |
| 413 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
| 414 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 415 | - if ( $event instanceof EE_Event ) { |
|
| 413 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
| 414 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 415 | + if ($event instanceof EE_Event) { |
|
| 416 | 416 | $datetimes = $event->get_many_related( |
| 417 | 417 | 'Datetime', |
| 418 | 418 | array( |
| 419 | 419 | 'limit' => 1, |
| 420 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
| 420 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
| 421 | 421 | ) |
| 422 | 422 | ); |
| 423 | - return reset( $datetimes ); |
|
| 423 | + return reset($datetimes); |
|
| 424 | 424 | } else { |
| 425 | 425 | return FALSE; |
| 426 | 426 | } |
@@ -435,17 +435,17 @@ discard block |
||
| 435 | 435 | * @param int $EVT_ID |
| 436 | 436 | * @return string |
| 437 | 437 | */ |
| 438 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
| 439 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 440 | - if ( $event instanceof EE_Event ) { |
|
| 438 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
| 439 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 440 | + if ($event instanceof EE_Event) { |
|
| 441 | 441 | $datetimes = $event->get_many_related( |
| 442 | 442 | 'Datetime', |
| 443 | 443 | array( |
| 444 | 444 | 'limit' => 1, |
| 445 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
| 445 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
| 446 | 446 | ) |
| 447 | 447 | ); |
| 448 | - return end( $datetimes ); |
|
| 448 | + return end($datetimes); |
|
| 449 | 449 | } else { |
| 450 | 450 | return FALSE; |
| 451 | 451 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @param int $EVT_ID |
| 459 | 459 | * @return EE_Datetime|null |
| 460 | 460 | */ |
| 461 | - public static function get_next_upcoming_date_obj( $EVT_ID = 0 ) { |
|
| 461 | + public static function get_next_upcoming_date_obj($EVT_ID = 0) { |
|
| 462 | 462 | $datetime = EEM_Datetime::instance()->get_one( |
| 463 | 463 | array( |
| 464 | 464 | array( |
@@ -481,17 +481,17 @@ discard block |
||
| 481 | 481 | * @param null $limit |
| 482 | 482 | * @return EE_Datetime[] |
| 483 | 483 | */ |
| 484 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) { |
|
| 485 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 486 | - if($include_expired === null){ |
|
| 487 | - if($event instanceof EE_Event && $event->is_expired()){ |
|
| 484 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) { |
|
| 485 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 486 | + if ($include_expired === null) { |
|
| 487 | + if ($event instanceof EE_Event && $event->is_expired()) { |
|
| 488 | 488 | $include_expired = true; |
| 489 | - }else{ |
|
| 489 | + } else { |
|
| 490 | 490 | $include_expired = false; |
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - if ( $event instanceof EE_Event ) { |
|
| 494 | + if ($event instanceof EE_Event) { |
|
| 495 | 495 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
| 496 | 496 | } else { |
| 497 | 497 | return array(); |
@@ -507,11 +507,11 @@ discard block |
||
| 507 | 507 | * @param int $EVT_ID |
| 508 | 508 | * @return string |
| 509 | 509 | */ |
| 510 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
| 511 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 512 | - if ( $event instanceof EE_Event ) { |
|
| 513 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
| 514 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
| 510 | + public static function event_link_url($EVT_ID = 0) { |
|
| 511 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 512 | + if ($event instanceof EE_Event) { |
|
| 513 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
| 514 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
| 515 | 515 | } |
| 516 | 516 | return NULL; |
| 517 | 517 | } |
@@ -525,10 +525,10 @@ discard block |
||
| 525 | 525 | * @param int $EVT_ID |
| 526 | 526 | * @return string |
| 527 | 527 | */ |
| 528 | - public static function event_phone( $EVT_ID = 0 ) { |
|
| 529 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 530 | - if ( $event instanceof EE_Event ) { |
|
| 531 | - return EEH_Schema::telephone( $event->phone() ); |
|
| 528 | + public static function event_phone($EVT_ID = 0) { |
|
| 529 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 530 | + if ($event instanceof EE_Event) { |
|
| 531 | + return EEH_Schema::telephone($event->phone()); |
|
| 532 | 532 | } |
| 533 | 533 | return NULL; |
| 534 | 534 | } |
@@ -545,26 +545,26 @@ discard block |
||
| 545 | 545 | * @param string $after |
| 546 | 546 | * @return string |
| 547 | 547 | */ |
| 548 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
| 549 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 550 | - if ( $event instanceof EE_Event ) { |
|
| 548 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
| 549 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 550 | + if ($event instanceof EE_Event) { |
|
| 551 | 551 | // can the user edit this post ? |
| 552 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
| 552 | + if (current_user_can('edit_post', $event->ID())) { |
|
| 553 | 553 | // set link text |
| 554 | - $link_text = ! empty( $link ) ? $link : __('edit this event'); |
|
| 554 | + $link_text = ! empty($link) ? $link : __('edit this event'); |
|
| 555 | 555 | // generate nonce |
| 556 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
| 556 | + $nonce = wp_create_nonce('edit_nonce'); |
|
| 557 | 557 | // generate url to event editor for this event |
| 558 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
| 558 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
| 559 | 559 | // get edit CPT text |
| 560 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
| 560 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
| 561 | 561 | // build final link html |
| 562 | - $link = '<a class="post-edit-link" href="' . $url . '" '; |
|
| 563 | - $link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"'; |
|
| 562 | + $link = '<a class="post-edit-link" href="'.$url.'" '; |
|
| 563 | + $link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"'; |
|
| 564 | 564 | $link .= \EED_Events_Archive::link_target(); |
| 565 | - $link .='>' . $link_text . '</a>'; |
|
| 565 | + $link .= '>'.$link_text.'</a>'; |
|
| 566 | 566 | // put it all together |
| 567 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
| 567 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | return ''; |