function mc_create_tags($event, $context = 'filters') { $event = mc_clean_location($event, 'event'); $e = array(); $e['post'] = $event->event_post; $date_format = get_option('mc_date_format') != '' ? get_option('mc_date_format') : get_option('date_format'); $e = apply_filters('mc_insert_author_data', $e, $event); $e = apply_filters('mc_filter_image_data', $e, $event); $map = mc_maplink($event); $map_url = mc_maplink($event, 'url'); $sitelink_html = "<div class='url link'><a href='{$event->event_url}' class='location-link external'>" . sprintf(__('Visit web site<span class="screen-reader-text">: %s</span>', 'my-calendar'), $event->event_label) . "</a></div>"; $e['sitelink_html'] = $sitelink_html; $e['sitelink'] = $event->event_url; $e['access'] = mc_expand(get_post_meta($event->event_post, '_mc_event_access', true)); // date & time fields $real_end_date = $event->occur_end; $dtstart = mc_format_timestamp(strtotime($event->occur_begin)); $dtend = mc_format_timestamp(strtotime($real_end_date)); $e['date_utc'] = date_i18n(apply_filters('mc_date_format', $date_format, 'template_begin_ts'), $event->ts_occur_begin); $e['date_end_utc'] = date_i18n(apply_filters('mc_date_format', $date_format, 'template_end_ts'), $event->ts_occur_end); $notime = mc_notime_label($event); $e['time'] = date('H:i:s', strtotime($event->occur_begin)) == '00:00:00' ? $notime : date(get_option('mc_time_format'), strtotime($event->occur_begin)); $e['time24'] = date('G:i', strtotime($event->occur_begin)) == '00:00:00' ? $notime : date(get_option('mc_time_format'), strtotime($event->occur_begin)); $endtime = $event->event_end == '23:59:59' ? '00:00:00' : date('H:i:s', strtotime($real_end_date)); $e['endtime'] = $real_end_date == $event->occur_begin || $event->event_hide_end == 1 || date('H:i:s', strtotime($real_end_date)) == '23:59:59' ? '' : date_i18n(get_option('mc_time_format'), strtotime($endtime)); $e['runtime'] = mc_runtime($event->ts_occur_begin, $event->ts_occur_end, $event); $e['dtstart'] = date('Y-m-d\\TH:i:s', strtotime($event->occur_begin)); // hcal formatted $e['dtend'] = date('Y-m-d\\TH:i:s', strtotime($real_end_date)); //hcal formatted end $e['rssdate'] = date('D, d M Y H:i:s +0000', strtotime($event->event_added)); $date = date_i18n(apply_filters('mc_date_format', $date_format, 'template_begin'), strtotime($event->occur_begin)); $date_end = date_i18n(apply_filters('mc_date_format', $date_format, 'template_end'), strtotime($real_end_date)); $date_arr = array('occur_begin' => $event->occur_begin, 'occur_end' => $real_end_date); $date_obj = (object) $date_arr; if ($event->event_span == 1) { $dates = mc_event_date_span($event->event_group_id, $event->event_span, array(0 => $date_obj)); } else { $dates = array(); } $e['date'] = $event->event_span != 1 ? $date : mc_format_date_span($dates, 'simple', $date); $e['enddate'] = $date_end; $e['daterange'] = $date == $date_end ? $date : "<span class='mc_db'>{$date}</span> <span>–</span> <span class='mc_de'>{$date_end}</span>"; $e['timerange'] = $e['time'] == $e['endtime'] || $event->event_hide_end == 1 || date('H:i:s', strtotime($real_end_date)) == '23:59:59' ? $e['time'] : "<span class='mc_tb'>" . $e['time'] . "</span> <span>–</span> <span class='mc_te'>" . $e['endtime'] . "</span>"; $e['datespan'] = $event->event_span == 1 || $e['date'] != $e['enddate'] ? mc_format_date_span($dates) : $date; $e['multidate'] = mc_format_date_span($dates, 'complex', "<span class='fallback-date'>{$date}</span><span class='separator'>,</span> <span class='fallback-time'>{$e['time']}</span>–<span class='fallback-endtime'>{$e['endtime']}</span>"); $e['began'] = $event->event_begin; // returns date of first occurrence of an event. $e['recurs'] = mc_event_recur_string($event); $e['repeats'] = $event->event_repeats; // category fields $e['cat_id'] = $event->event_category; $e['category'] = stripslashes($event->category_name); $e['icon'] = mc_category_icon($event, 'img'); $e['icon_html'] = "<img src='{$e['icon']}' class='mc-category-icon' alt='" . __('Category', 'my-calendar') . ": " . esc_attr($event->category_name) . "' />"; $e['color'] = $event->category_color; $e['color_css'] = "<span style='background-color: {$event->category_color}'>"; // this is because widgets now strip out style attributes. $e['close_color_css'] = "</span>"; // special $e['skip_holiday'] = $event->event_holiday == 0 ? 'false' : 'true'; $e['event_status'] = $event->event_approved == 1 ? __('Published', 'my-calendar') : __('Reserved', 'my-calendar'); // general text fields $e['title'] = stripslashes($event->event_title); $e['description'] = wpautop(stripslashes($event->event_desc)); $e['description_raw'] = stripslashes($event->event_desc); $e['description_stripped'] = strip_tags(stripslashes($event->event_desc)); $e['shortdesc'] = wpautop(stripslashes($event->event_short)); $e['shortdesc_raw'] = stripslashes($event->event_short); $e['shortdesc_stripped'] = strip_tags(stripslashes($event->event_short)); // registration fields $e['event_open'] = mc_event_open($event); $e['event_tickets'] = $event->event_tickets; $e['event_registration'] = stripslashes(wp_kses_data($event->event_registration)); // links $templates = get_option('mc_templates'); $e_template = !empty($templates['label']) ? stripcslashes($templates['label']) : __('Details about', 'my-calendar') . ' {title}'; $tags = array("{title}", "{location}", "{color}", "{icon}", "{date}", "{time}"); $replacements = array(stripslashes($event->event_title), stripslashes($event->event_label), $event->category_color, $event->category_icon, $e['date'], $e['time']); $e_label = str_replace($tags, $replacements, $e_template); //$e_label = mc_get_details_label( $event, $e ); // recursive...hmmmm. $e_link = mc_get_details_link($event); $e['link'] = mc_event_link($event); if ($e['link']) { $e['link_image'] = str_replace("alt=''", "alt='" . esc_attr($e['title']) . "'", "<a href='" . $e['link'] . "'>" . $e['image'] . "</a>"); $e['link_title'] = "<a href='" . $event->event_link . "'>" . $e['title'] . "</a>"; } else { $e['link_image'] = $e['image']; $e['link_title'] = $e['title']; } $e['details_link'] = get_option('mc_uri') != '' && !is_numeric(get_option('mc_uri')) ? $e_link : ''; $e['details'] = get_option('mc_uri') != '' && !is_numeric(get_option('mc_uri')) ? "<a href='{$e_link}' class='mc-details'>{$e_label}</a>" : ''; $e['linking'] = $e['link'] != '' ? $event->event_link : $e_link; $e['linking_title'] = $e['linking'] != '' ? "<a href='" . $e['linking'] . "'>" . $e['title'] . "</a>" : $e['title']; // location fields $strip_desc = mc_newline_replace(strip_tags($event->event_desc)); $e['location'] = stripslashes($event->event_label); $e['street'] = stripslashes($event->event_street); $e['street2'] = stripslashes($event->event_street2); $e['phone'] = apply_filters('mc_phone_format', stripslashes($event->event_phone)); $e['phone2'] = apply_filters('mc_phone_format', stripslashes($event->event_phone2)); $e['city'] = stripslashes($event->event_city); $e['state'] = stripslashes($event->event_state); $e['postcode'] = stripslashes($event->event_postcode); $e['country'] = stripslashes($event->event_country); $e['hcard'] = stripslashes(mc_hcard($event)); $e['link_map'] = $map; $e['map_url'] = $map_url; $e['map'] = mc_generate_map($event); $url = get_option('mc_uri') != '' && !is_numeric(get_option('mc_uri')) ? $e_link : $event->event_url; $e['gcal'] = mc_google_cal($dtstart, $dtend, $url, stripcslashes($event->event_title), mc_maplink($event, 'gcal'), $strip_desc); $e['gcal_link'] = "<a href='" . mc_google_cal($dtstart, $dtend, $url, stripcslashes($event->event_title), mc_maplink($event, 'gcal'), $strip_desc) . "' class='gcal external'>" . sprintf(__('Send <span class="screen-reader-text">%1$s </span>to Google Calendar', 'my-calendar'), stripcslashes($event->event_title)) . "</a>"; $e['location_access'] = mc_expand(unserialize(mc_location_data('location_access', $event->event_location))); $e['location_source'] = $event->event_location; // IDs $e['dateid'] = $event->occur_id; // unique ID for this date of this event $e['id'] = $event->event_id; $e['group'] = $event->event_group_id; $e['event_span'] = $event->event_span; // RSS guid $e['region'] = $event->event_region; $e['guid'] = get_option('mc_uri') != '' && !is_numeric(get_option('mc_uri')) ? "<guid isPermaLink='true'>{$e_link}</guid>" : "<guid isPermalink='false'>{$e_link}</guid>"; // iCAL $e['ical_location'] = $event->event_label . ' ' . $event->event_street . ' ' . $event->event_street2 . ' ' . $event->event_city . ' ' . $event->event_state . ' ' . $event->event_postcode; $e['ical_description'] = str_replace("\r", "=0D=0A=", $event->event_desc); $e['ical_desc'] = $strip_desc; $e['ical_start'] = $dtstart; $e['ical_end'] = $dtend; $ical_link = mc_build_url(array('vcal' => $event->occur_id), array('month', 'dy', 'yr', 'ltype', 'loc', 'mcat', 'format'), get_option('mc_uri')); $e['ical'] = $ical_link; $e['ical_html'] = "<a class='ical' rel='nofollow' href='{$ical_link}'>" . __('iCal', 'my-calendar') . "</a>"; $e = apply_filters('mc_filter_shortcodes', $e, $event); return $e; }
function my_calendar_draw_event($event, $type = "calendar", $process_date, $time, $template = '') { // if event is not approved, return without processing if (get_option('mc_event_approve') == 'true' && (int) $event->event_approved !== 1) { return; } // if event ends at midnight today (e.g., very first thing of the day), exit without re-drawing if ($event->event_endtime == '00:00:00' && date('Y-m-d', strtotime($event->occur_end)) == $process_date && date('Y-m-d', strtotime($event->occur_begin)) != $process_date) { return; } global $wpdb; $url = plugin_dir_url(__FILE__); $mcdb = $wpdb; if (get_option('mc_remote') == 'true' && function_exists('mc_remote_db')) { $mcdb = mc_remote_db(); } if ($event->category_private == 1 && !is_user_logged_in()) { return; } // assign empty values to template sections $header = $address = $more = $author = $list_title = $title = $output = $container = $short = $description = $link = $vcal = $gcal = ''; $date_format = get_option('mc_date_format') != '' ? get_option('mc_date_format') : get_option('date_format'); $data = mc_create_tags($event); $details = apply_filters('mc_custom_template', false, $data, $event, $type, $process_date, $time, $template); $templates = get_option('mc_templates'); if ($details === false) { if ($template != '' && mc_file_exists(sanitize_file_name($template))) { $template = @file_get_contents(mc_get_file(sanitize_file_name($template))); $details = jd_draw_template($data, $template); } else { switch ($type) { case 'mini': $template = $templates['mini']; if (get_option('mc_use_mini_template') == 1) { $details = jd_draw_template($data, $template); } break; case 'list': $template = $templates['list']; if (get_option('mc_use_list_template') == 1) { $details = jd_draw_template($data, $template); } break; case 'single': $template = $templates['details']; if (get_option('mc_use_details_template') == 1) { $details = jd_draw_template($data, $template); } break; case 'calendar': default: $template = $templates['grid']; if (get_option('mc_use_grid_template') == 1) { $details = jd_draw_template($data, $template); } } } } $mc_display_author = get_option('mc_display_author'); $display_map = get_option('mc_show_map'); $display_address = get_option('mc_show_address'); $display_details = get_option('mc_details'); $uid = 'mc_' . $event->occur_id; $day_id = date('d', strtotime($process_date)); $mc_id = $event->occur_id; $this_category = $event->event_category; $image = mc_category_icon($event); $header .= "<div id='{$uid}-{$day_id}-{$type}' class='{$type}-event " . "mc_" . sanitize_title($event->category_name) . " vevent'>\n"; $title_template = $templates['title'] == '' ? '{title}' : $templates['title']; $event_title = jd_draw_template($data, $title_template); $event_title = $event_title == '' ? jd_draw_template($data, '{title}') : $event_title; //prevent empty titles if (strpos($event_title, 'http') === false && $type != 'mini' && $type != 'list') { if (get_option('mc_open_uri') == 'true') { $details_link = mc_get_details_link($event); $wrap = "<a href='{$details_link}'>"; $balance = "</a>"; } else { $wrap = "<a href='#{$uid}-{$day_id}-{$type}-details'>"; $balance = "</a>"; } } else { $wrap = $balance = ''; } $current_date = date_i18n(apply_filters('mc_date_format', $date_format, 'details'), strtotime($process_date)); $group_class = $event->event_span == 1 ? ' multidate group' . $event->event_group_id : ''; $heading_level = apply_filters('mc_heading_level_table', 'h3', $type, $time, $template); $header .= $type != 'single' && $type != 'list' ? "<{$heading_level} class='event-title summary{$group_class}'>{$wrap}{$image}{$event_title}{$balance}</{$heading_level}>\n" : ''; $event_title = $type == 'single' ? apply_filters('mc_single_event_title', $event_title, $event) : $event_title; $title = $type == 'single' && !is_singular('mc-events') ? "<h2 class='event-title summary'>{$image} {$event_title}</h2>\n" : ''; $title = apply_filters('mc_event_title', $title, $event, $event_title, $image); $header .= $title; if ($details === false) { $custom = false; // put together address information as vcard if ($display_address == 'true' || $display_map == 'true') { $address = mc_hcard($event, $display_address, $display_map); } // end vcard $close = $type == 'calendar' || $type == 'mini' ? "<a href=\"#{$uid}-{$day_id}-{$type}\" class='mc-toggle mc-close close'><img src=\"" . plugin_dir_url(__FILE__) . "images/event-close.png\" alt='" . __('Close', 'my-calendar') . "' /></a>" : ''; $time = mc_time_html($event, $type, $current_date); if ($type == "list") { $heading_level = apply_filters('mc_heading_level_list', 'h3', $type, $time, $template); $list_title = "<{$heading_level} class='event-title summary'>{$image}" . $event_title . "</{$heading_level}>\n"; } if ($mc_display_author == 'true') { if ($event->event_author != 0) { $e = get_userdata($event->event_author); $author = '<p class="event-author">' . __('Posted by', 'my-calendar') . ' <span class="author-name">' . $e->display_name . "</span></p>\n"; } } if ($display_details == 'true' && !isset($_GET['mc_id'])) { $details_label = mc_get_details_label($event, $data); $details_link = mc_get_details_link($event); $more = get_option('mc_uri') != '' ? "<p class='mc_details'><a href='{$details_link}'>{$details_label}</a></p>\n" : ''; } // handle link expiration $event_link = mc_event_link($event); if (function_exists('mc_google_cal') && get_option('mc_show_gcal') == 'true') { $gcal_link = "<p class='gcal'>" . jd_draw_template($data, '{gcal_link}') . "</p>"; $gcal = $gcal_link; } if (function_exists('my_calendar_generate_vcal') && get_option('mc_show_event_vcal') == 'true') { $nonce = wp_create_nonce('my-calendar-nonce'); $vcal_link = "<p class='ical'><a rel='nofollow' href='" . home_url() . "?vcal={$uid}" . "'>" . __('iCal', 'my-calendar') . "</a></p>\n"; $vcal = $vcal_link; } $default_size = apply_filters('mc_default_image_size', 'medium'); if (is_numeric($event->event_post) && $event->event_post != 0 && (isset($data[$default_size]) && $data[$default_size] != '')) { $atts = apply_filters('mc_post_thumbnail_atts', array('class' => 'mc-image')); $image = get_the_post_thumbnail($event->event_post, $default_size, $atts); } else { $image = $event->event_image != '' ? "<img src='{$event->event_image}' alt='' class='mc-image' />" : ''; } if (get_option('mc_desc') == 'true' || $type == 'single') { $description = get_option('mc_process_shortcodes') == 'true' ? apply_filters('the_content', stripcslashes($event->event_desc)) : wpautop(stripcslashes($event->event_desc), 1); $description = "<div class='longdesc'>{$description}</div>"; } if (get_option('mc_short') == 'true' && $type != 'single') { $short = get_option('mc_process_shortcodes') == 'true' ? apply_filters('the_content', stripcslashes($event->event_short)) : wpautop(stripcslashes($event->event_short), 1); $short = "<div class='shortdesc'>{$short}</div>"; } if (get_option('mc_event_registration') == 'true') { switch ($event->event_open) { case '0': $status = get_option('mc_event_closed'); break; case '1': $status = get_option('mc_event_open'); break; case '2': $status = ''; break; default: $status = ''; } } else { $status = ''; } // JCD TODO - this is really wonky. What was I thinking? // if the event is a member of a group of events, but not the first, note that. if ($event->event_group == 1) { $info = array(); $info[] = $event->event_id; update_option('mc_event_groups', $info); } if (is_array(get_option('mc_event_groups'))) { if (in_array($event->event_id, get_option('mc_event_groups'))) { if ($process_date != $event->event_begin) { $status = __("This event is in a series. Register for the first event in this series to attend.", 'my-calendar'); } } } $status = $status != '' ? "<p>{$status}</p>" : ''; $status = apply_filters('mc_registration_state', $status, $event); $return = $type == 'single' ? "<p><a href='" . get_option('mc_uri') . "'>" . __('View full calendar', 'my-calendar') . "</a></p>" : ''; if ($type == 'calendar' && get_option('mc_open_uri') == 'true' && $time != 'day') { $description = $short = $status = ''; } if (get_option('mc_gmap') == 'true') { $map = is_singular('mc-event') || $type == 'single' ? mc_generate_map($event) : ''; } else { $map = ''; } if ($event_link != '' && get_option('mc_event_link') != 'false') { $is_external = mc_external_link($event_link); $external_class = $is_external ? "class='{$type}-link external'" : "class='{$type}-link'"; $link_template = isset($templates['link']) ? $templates['link'] : '{title}'; $link_text = jd_draw_template($data, $link_template); $link = "<p><a href='{$event_link}' {$is_external}>" . $link_text . "</a></p>"; } $details = "\n" . $close . $time . $list_title . $image . "<div class='location'>" . $map . $address . "</div>" . $description . $short . $link . $status . $author . "<div class='sharing'>" . $vcal . $gcal . $more . "</div>" . $return; } else { $custom = true; // if a custom template is in use $toggle = $type == 'calendar' || $type == 'mini' ? "<a href=\"#{$uid}-{$day_id}-{$type}\" class='mc-toggle mc-close close'><img src=\"" . plugin_dir_url(__FILE__) . "images/event-close.png\" alt='" . __('Close', 'my-calendar') . "' /></a>" : ''; $details = $toggle . $details . "\n"; } $container = "<div id='{$uid}-{$day_id}-{$type}-details' class='details'>\n"; $container = apply_filters('mc_before_event', $container, $event, $type, $time); $details = $header . $container . $details; $details .= apply_filters('mc_after_event', '', $event, $type, $time); $details .= "</div><!--ends .details--></div>"; $details = apply_filters('mc_event_content', $details, $event, $type, $time); return $details; }
function mc_get_details_link($event) { if (is_numeric($event)) { $event = mc_get_event($event); } // if available, and not querying remotely, use permalink. $permalinks = apply_filters('mc_use_permalinks', get_option('mc_use_permalinks')); $permalinks = $permalinks === 1 || $permalinks === true || $permalinks === 'true' ? true : false; $details_link = mc_event_link($event); if ($event->event_post != 0 && get_option('mc_remote') != 'true' && $permalinks) { $details_link = add_query_arg('mc_id', $event->occur_id, get_permalink($event->event_post)); } else { if (get_option('mc_uri') != '' && _mc_is_url(get_option('mc_uri'))) { $details_link = mc_build_url(array('mc_id' => $event->occur_id), array('month', 'dy', 'yr', 'ltype', 'loc', 'mcat', 'format', 'feed', 'page_id', 'p', 'mcs', 'time', 'page'), get_option('mc_uri')); } } return apply_filters('mc_customize_details_link', $details_link, $event); }
function mc_twitter($e, $event) { $e['twitter'] = "<a href='https://twitter.com/intent/tweet?text='" . urlencode($event->event_title . ' ' . mc_event_link($event)) . "'>Tweet this event</a>"; return $e; }
function my_calendar_draw_event($event, $type = "calendar", $process_date, $time, $template = '') { // if event is not approved, return without processing if (get_option('mc_event_approve') == 'true' && (int) $event->event_approved !== 1) { return ''; } // if event ends at midnight today (e.g., very first thing of the day), exit without re-drawing // or if event started yesterday & has event_hide_end checked. $ends_at_midnight = $event->event_endtime == '00:00:00' && date('Y-m-d', strtotime($event->occur_end)) == $process_date && date('Y-m-d', strtotime($event->occur_begin)) != $process_date ? true : false; // hides events if hiding end time & not first day. $hide_day_two = apply_filters('mc_hide_additional_days', false, $event) && date('Y-m-d', strtotime($event->occur_begin)) != date('Y-m-d', strtotime($process_date)) ? true : false; if ($ends_at_midnight || $hide_day_two) { return ''; } if ($event->category_private == 1 && !is_user_logged_in()) { return ''; } // assign empty values to template sections $header = $address = $more = $author = $list_title = $title = $output = $container = $short = $description = $link = $vcal = $gcal = ''; $date_format = get_option('mc_date_format') != '' ? get_option('mc_date_format') : get_option('date_format'); $data = mc_create_tags($event); $details = ''; if (mc_show_details($time, $type)) { $details = apply_filters('mc_custom_template', false, $data, $event, $type, $process_date, $time, $template); $template = apply_filters('mc_use_custom_template', $template, $data, $event, $type, $process_date, $time); if ($details === false) { if ($template != '' && mc_file_exists(sanitize_file_name($template))) { $template = @file_get_contents(mc_get_file(sanitize_file_name($template))); $details = jd_draw_template($data, $template); } else { if ($template != '' && mc_key_exists($template)) { $template = mc_get_custom_template($template); $details = jd_draw_template($data, $template); } else { switch ($type) { case 'mini': $template = mc_get_template('mini'); if (get_option('mc_use_mini_template') == 1) { $details = jd_draw_template($data, $template); } break; case 'list': $template = mc_get_template('list'); if (get_option('mc_use_list_template') == 1) { $details = jd_draw_template($data, $template); } break; case 'single': $template = mc_get_template('details'); if (get_option('mc_use_details_template') == 1) { $details = jd_draw_template($data, $template); } break; case 'calendar': default: $template = mc_get_template('grid'); if (get_option('mc_use_grid_template') == 1) { $details = jd_draw_template($data, $template); } } } } } } $mc_display_author = get_option('mc_display_author'); $display_map = get_option('mc_show_map'); $display_address = get_option('mc_show_address'); $mc_display_more = get_option('mc_display_more'); $uid = 'mc_' . $event->occur_id; $day_id = date('d', strtotime($process_date)); $image = mc_category_icon($event); $has_image = $image != '' ? ' has-image' : ''; $event_classes = mc_event_classes($event, $day_id, $type); $header .= "<div id='{$uid}-{$day_id}-{$type}' class='{$event_classes}'>\n"; switch ($type) { case 'calendar': $title_template = mc_get_template('title') == '' ? '{title}' : mc_get_template('title'); break; case 'list': $title_template = mc_get_template('title_list') == '' ? '{title}' : mc_get_template('title_list'); break; case 'single': $title_template = mc_get_template('title_solo') == '' ? '{title}' : mc_get_template('title_solo'); break; default: $title_template = mc_get_template('title') == '' ? '{title}' : mc_get_template('title'); } $event_title = jd_draw_template($data, $title_template); $event_title = $event_title == '' ? jd_draw_template($data, '{title}') : mc_kses_post($event_title); //prevent empty titles if (strpos($event_title, 'href') === false && $type != 'mini' && $type != 'list') { if (get_option('mc_open_uri') == 'true') { $details_link = esc_url(mc_get_details_link($event)); $wrap = "<a href='{$details_link}' class='url summary{$has_image}'>"; $balance = "</a>"; } else { $wrap = "<a href='#{$uid}-{$day_id}-{$type}-details' class='url summary{$has_image}'>"; $balance = "</a>"; } } else { $wrap = $balance = ''; } $current_date = date_i18n(apply_filters('mc_date_format', $date_format, 'details'), strtotime($process_date)); $group_class = $event->event_span == 1 ? ' multidate group' . $event->event_group_id : ''; $heading_level = apply_filters('mc_heading_level_table', 'h3', $type, $time, $template); $inner_heading = apply_filters('mc_heading_inner_title', $wrap . $image . trim($event_title) . $balance, $event_title, $event); $header .= $type != 'single' && $type != 'list' ? "<{$heading_level} class='event-title summary{$group_class}' id='{$uid}-{$day_id}-{$type}-title'>{$inner_heading}</{$heading_level}>\n" : ''; $event_title = $type == 'single' ? apply_filters('mc_single_event_title', $event_title, $event) : $event_title; $title = $type == 'single' && !is_singular('mc-events') ? "<h2 class='event-title summary'>{$image} {$event_title}</h2>\n" : '<span class="summary screen-reader-text">' . $event_title . '</span>'; $title = apply_filters('mc_event_title', $title, $event, $event_title, $image); $header .= '<span class="summary">' . $title . '</span>'; $close_image = apply_filters('mc_close_button', "<img src=\"" . plugin_dir_url(__FILE__) . "images/event-close.png\" alt='" . __('Close', 'my-calendar') . "' />"); $close_button = "<button type='button' aria-controls='{$uid}-{$day_id}-{$type}-details' class='mc-toggle close'>{$close_image}</button>"; if (mc_show_details($time, $type)) { $close = $type == 'calendar' || $type == 'mini' ? $close_button : ''; if ($details === false) { // put together address information as vcard if ($display_address == 'true' || $display_map == 'true') { $address = mc_hcard($event, $display_address, $display_map); } // end vcard $time_html = mc_time_html($event, $type, $current_date); if ($type == "list") { $heading_level = apply_filters('mc_heading_level_list', 'h3', $type, $time, $template); $list_title = "<{$heading_level} class='event-title summary' id='{$uid}-{$day_id}-{$type}-title'>{$image}" . $event_title . "</{$heading_level}>\n"; } if ($mc_display_author == 'true') { if ($event->event_author != 0) { $e = get_userdata($event->event_author); $author = '<p class="event-author">' . __('Posted by', 'my-calendar') . ' <span class="author-name">' . $e->display_name . "</span></p>\n"; } } if ($mc_display_more != 'false' && !isset($_GET['mc_id'])) { $details_label = mc_get_details_label($event, $data); $details_link = mc_get_details_link($event); if (_mc_is_url($details_link)) { $more = "<p class='mc_details'><a href='" . esc_url($details_link) . "'>{$details_label}</a></p>\n"; } else { $more = ''; } } $more = apply_filters('mc_details_grid_link', $more, $event); // handle link expiration $event_link = mc_event_link($event); if (function_exists('mc_google_cal') && get_option('mc_show_gcal') == 'true') { $gcal_link = "<p class='gcal'>" . jd_draw_template($data, '{gcal_link}') . "</p>"; $gcal = $gcal_link; } if (function_exists('my_calendar_generate_vcal') && get_option('mc_show_event_vcal') == 'true') { $url = add_query_arg('vcal', $uid, home_url()); $vcal_link = "<p class='ical'><a rel='nofollow' href='" . esc_url($url) . "'>" . __('iCal', 'my-calendar') . "</a></p>\n"; $vcal = $vcal_link; } $sizes = get_intermediate_image_sizes(); if (in_array('medium', $sizes)) { $default_size = 'medium'; } else { $default_size = 'thumbnail'; } $default_size = apply_filters('mc_default_image_size', $default_size); if (is_numeric($event->event_post) && $event->event_post != 0 && (isset($data[$default_size]) && $data[$default_size] != '')) { $atts = apply_filters('mc_post_thumbnail_atts', array('class' => 'mc-image photo')); $image = get_the_post_thumbnail($event->event_post, $default_size, $atts); } else { $image = $event->event_image != '' ? "<img src='{$event->event_image}' alt='' class='mc-image photo' />" : ''; } if (get_option('mc_desc') == 'true' || $type == 'single') { $description = wpautop(stripcslashes(mc_kses_post($event->event_desc)), 1); $description = "<div class='longdesc description'>{$description}</div>"; } if (get_option('mc_short') == 'true' && $type != 'single') { $short = wpautop(stripcslashes(mc_kses_post($event->event_short)), 1); $short = "<div class='shortdesc'>{$short}</div>"; } if (get_option('mc_event_registration') == 'true') { switch ($event->event_open) { case '0': $status = mc_kses_post(get_option('mc_event_closed')); break; case '1': $status = mc_kses_post(get_option('mc_event_open')); break; case '2': $status = ''; break; default: $status = ''; } } else { $status = ''; } $status = $status != '' ? "<p>{$status}</p>" : ''; $status = apply_filters('mc_registration_state', $status, $event); $return_url = apply_filters('mc_return_uri', get_option('mc_uri')); $return = $type == 'single' ? "<p class='view-full'><a href='{$return_url}'>" . __('View full calendar', 'my-calendar') . "</a></p>" : ''; if (!mc_show_details($time, $type)) { $description = $short = $status = ''; } if (get_option('mc_gmap') == 'true') { $map = is_singular('mc-events') || $type == 'single' ? mc_generate_map($event) : ''; } else { $map = ''; } if ($event_link != '' && get_option('mc_event_link') != 'false') { $is_external = mc_external_link($event_link); $external_class = $is_external ? "class='{$type}-link external url'" : "class='{$type}-link url'"; $link_template = mc_get_template('link') != '' ? mc_get_template('link') : '{title}'; $link_text = jd_draw_template($data, $link_template); $link = "<p><a href='" . esc_url($event_link) . "' {$external_class}>" . $link_text . "</a></p>"; } $details = "\n" . $close . $time_html . $list_title . $image . "<div class='location'>" . $map . $address . "</div>" . $description . $short . $link . $status . $author . "<div class='sharing'>" . $vcal . $gcal . $more . "</div>" . $return; } else { // if a custom template is in use $toggle = $type == 'calendar' || $type == 'mini' ? $close_button : ''; $details = $toggle . $details . "\n"; } $img_class = $image != '' ? ' has-image' : ' no-image'; $container = "<div id='{$uid}-{$day_id}-{$type}-details' class='details{$img_class}' role='alert' aria-labelledby='{$uid}-{$day_id}-{$type}-title'>\n"; $container = apply_filters('mc_before_event', $container, $event, $type, $time); $details = $header . $container . apply_filters('mc_inner_content', $details, $event, $type, $time); $details .= apply_filters('mc_after_event', '', $event, $type, $time); $details .= $close; // second close button $details .= "</div><!--ends .details--></div>"; $details = apply_filters('mc_event_content', $details, $event, $type, $time); } else { $details = apply_filters('mc_before_event_no_details', $container, $event, $type, $time) . $header . apply_filters('mc_after_event_no_details', '', $event, $type, $time) . "</div>"; } return $details; }