<?php defined('ABSPATH') || exit;function ehbo_get_current_event(){if (! function_exists('em_get_event')){return null}$post_id=get_queried_object_id();if (! $post_id || 'event' !==get_post_type($post_id)){$loop_post_id=get_the_ID();if (! $loop_post_id || 'event' !==get_post_type($loop_post_id)){return null}$post_id=$loop_post_id}global $EM_Event;if (isset($EM_Event) && is_object($EM_Event) && is_a($EM_Event,'EM_Event') && ! empty($EM_Event->event_id) && (int) $EM_Event->post_id===(int) $post_id){$event=$EM_Event}else{$event=em_get_event($post_id,'post_id')}if (! $event || ! is_object($event) || empty($event->event_id)){return null}return $event}function ehbo_shortcode_event_datum(){$event=ehbo_get_current_event();return $event ? $event->output('#_EVENTDATES'):''}add_shortcode('ehbo_event_datum','ehbo_shortcode_event_datum');function ehbo_shortcode_event_begindatum($atts){$event=ehbo_get_current_event();if (! $event){return ''}$atts=shortcode_atts(array('format'=>'',),$atts,'ehbo_event_begindatum');if (''===$atts['format']){return $event->output('#_EVENTSTARTDATE')}return $event->output('#_{' . $atts['format'] . '}')}add_shortcode('ehbo_event_begindatum','ehbo_shortcode_event_begindatum');function ehbo_shortcode_event_einddatum($atts){$event=ehbo_get_current_event();if (! $event){return ''}$atts=shortcode_atts(array('format'=>'d-m-Y',),$atts,'ehbo_event_einddatum');return $event->output('#@_{' . $atts['format'] . '}')}add_shortcode('ehbo_event_einddatum','ehbo_shortcode_event_einddatum');function ehbo_shortcode_event_tijd(){$event=ehbo_get_current_event();return $event ? $event->output('#_EVENTTIMES'):''}add_shortcode('ehbo_event_tijd','ehbo_shortcode_event_tijd');function ehbo_shortcode_event_prijs(){$event=ehbo_get_current_event();return $event ? $event->output('#_EVENTPRICERANGE'):''}add_shortcode('ehbo_event_prijs','ehbo_shortcode_event_prijs');function ehbo_shortcode_event_inhoud(){$event=ehbo_get_current_event();return $event ? $event->output('#_EVENTNOTES'):''}add_shortcode('ehbo_event_inhoud','ehbo_shortcode_event_inhoud');function ehbo_shortcode_event_locatienaam(){$event=ehbo_get_current_event();if (! $event){return ''}return $event->output('{has_location_venue}#_LOCATIONNAME{/has_location_venue}')}add_shortcode('ehbo_event_locatienaam','ehbo_shortcode_event_locatienaam');function ehbo_shortcode_event_adres(){$event=ehbo_get_current_event();if (! $event){return ''}return $event->output('{has_location_venue}#_LOCATIONADDRESS{/has_location_venue}')}add_shortcode('ehbo_event_adres','ehbo_shortcode_event_adres');function ehbo_shortcode_event_postcode_plaats(){$event=ehbo_get_current_event();if (! $event){return ''}return $event->output('{has_location_venue}#_LOCATIONPOSTCODE #_LOCATIONTOWN{/has_location_venue}')}add_shortcode('ehbo_event_postcode_plaats','ehbo_shortcode_event_postcode_plaats');function ehbo_shortcode_event_status(){$event=ehbo_get_current_event();if (! $event){return ''}$format='{has_bookings}' . '{bookings_open}<span class="ehbo-status ehbo-status-open">Inschrijving open</span>{/bookings_open}' . '{bookings_closed}<span class="ehbo-status ehbo-status-closed">Inschrijving gesloten</span>{/bookings_closed}' . '{/has_bookings}';return $event->output($format)}add_shortcode('ehbo_event_status','ehbo_shortcode_event_status');function ehbo_shortcode_event_type(){$event=ehbo_get_current_event();if (! $event){return ''}return $event->output('{has_taxonomy}#_CATEGORYNAME{/has_taxonomy}')}add_shortcode('ehbo_event_type','ehbo_shortcode_event_type');function ehbo_shortcode_event_categoriekleur(){$event=ehbo_get_current_event();if (! $event){return ''}return trim((string) $event->output('{has_taxonomy}#_CATEGORYCOLOR{/has_taxonomy}'))}add_shortcode('ehbo_event_categoriekleur','ehbo_shortcode_event_categoriekleur');function ehbo_shortcode_event_categoriekleur_stijl($atts){$event=ehbo_get_current_event();if (! $event){return ''}$kleur=trim((string) $event->output('{has_taxonomy}#_CATEGORYCOLOR{/has_taxonomy}'));if (''===$kleur){return ''}$atts=shortcode_atts(array('class'=>'ehbo-event-categoriebalk','eigenschap'=>'border-top-color',),$atts,'ehbo_event_categoriekleur_stijl');$toegestane_eigenschappen=array('border-top-color','border-color','background-color','color');if (! in_array($atts['eigenschap'],$toegestane_eigenschappen,true)){$atts['eigenschap']='border-top-color'}return sprintf('<style>.%1$s{%2$s:%3$s !important;}</style>',esc_attr($atts['class']),esc_attr($atts['eigenschap']),esc_attr($kleur))}add_shortcode('ehbo_event_categoriekleur_stijl','ehbo_shortcode_event_categoriekleur_stijl');function ehbo_shortcode_event_docent(){$event=ehbo_get_current_event();if (! $event){return ''}$docent=isset($event->event_attributes['Docent']) ? trim((string) $event->event_attributes['Docent']) :'';if (''===$docent){return ''}return $event->output('#_ATT{Docent}')}add_shortcode('ehbo_event_docent','ehbo_shortcode_event_docent');function ehbo_shortcode_event_boekingsformulier(){$event=ehbo_get_current_event();if (! $event){return ''}return $event->output('{has_bookings}#_MYBOOKINGSTATUS #_BOOKINGFORM{/has_bookings}')}add_shortcode('ehbo_event_boekingsformulier','ehbo_shortcode_event_boekingsformulier');