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>&ndash;</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>&ndash;</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>&ndash;<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 mc_list_groups()
{
    global $wpdb;
    $mcdb = $wpdb;
    $sortby = isset($_GET['sort']) ? (int) $_GET['sort'] : get_option('mc_default_sort');
    if (isset($_GET['order'])) {
        $sortdir = isset($_GET['order']) && $_GET['order'] == 'ASC' ? 'ASC' : 'default';
    } else {
        $sortdir = 'default';
    }
    if (empty($sortby)) {
        $sortbyvalue = 'event_begin';
    } else {
        switch ($sortby) {
            case 1:
                $sortbyvalue = 'event_ID';
                break;
            case 2:
                $sortbyvalue = 'event_title';
                break;
            case 3:
                $sortbyvalue = 'event_desc';
                break;
            case 4:
                $sortbyvalue = 'event_begin';
                break;
            case 5:
                $sortbyvalue = 'event_author';
                break;
            case 6:
                $sortbyvalue = 'event_category';
                break;
            case 7:
                $sortbyvalue = 'event_label';
                break;
            case 8:
                $sortbyvalue = 'group_id';
                break;
            default:
                $sortbyvalue = 'event_begin';
        }
    }
    $sortbydirection = $sortdir == 'default' ? 'DESC' : $sortdir;
    $sorting = $sortbydirection == 'DESC' ? "&amp;order=ASC" : '';
    $current = empty($_GET['paged']) ? 1 : intval($_GET['paged']);
    $user = get_current_user_id();
    $screen = get_current_screen();
    $option = $screen->get_option('per_page', 'option');
    $items_per_page = get_user_meta($user, $option, true);
    if (empty($items_per_page) || $items_per_page < 1) {
        $items_per_page = $screen->get_option('per_page', 'default');
    }
    $limit = isset($_GET['limit']) ? $_GET['limit'] : 'all';
    switch ($limit) {
        case 'all':
            $limit = '';
            break;
        case 'grouped':
            $limit = 'WHERE event_group_id <> 0';
            break;
        case 'ungrouped':
            $limit = 'WHERE event_group_id = 0';
            break;
        default:
            $limit = '';
    }
    $events = $mcdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM " . my_calendar_table() . " {$limit} ORDER BY {$sortbyvalue} {$sortbydirection} LIMIT " . ($current - 1) * $items_per_page . ", " . $items_per_page);
    $found_rows = $wpdb->get_col("SELECT FOUND_ROWS();");
    $items = $found_rows[0];
    ?>
	<div class='inside'><?php 
    if (get_option('mc_event_approve') == 'true') {
        ?>
		<ul class="links">
			<li>
				<a <?php 
        echo isset($_GET['limit']) && $_GET['limit'] == 'groupeed' ? ' class="active-link"' : '';
        ?>
					href="<?php 
        echo admin_url('admin.php?page=my-calendar-groups&amp;limit=grouped#my-calendar-admin-table');
        ?>
"><?php 
        _e('Grouped Events', 'my-calendar');
        ?>
</a>
			</li>
			<li>
				<a <?php 
        echo isset($_GET['limit']) && $_GET['limit'] == 'ungrouped' ? ' class="active-link"' : '';
        ?>
					href="<?php 
        echo admin_url('admin.php?page=my-calendar-groups&amp;limit=ungrouped#my-calendar-admin-table');
        ?>
"><?php 
        _e('Ungrouped Events', 'my-calendar');
        ?>
</a>
			</li>
			<li>
				<a <?php 
        echo isset($_GET['limit']) && $_GET['limit'] == 'all' || !isset($_GET['limit']) ? ' class="active-link"' : '';
        ?>
					href="<?php 
        echo admin_url('admin.php?page=my-calendar-groups#my-calendar-admin-table');
        ?>
"><?php 
        _e('All', 'my-calendar');
        ?>
</a>
			</li>
		</ul>
	<?php 
    }
    ?>
	<p><?php 
    _e('Check a set of events to group them for mass editing.', 'my-calendar');
    ?>
</p><?php 
    $num_pages = ceil($items / $items_per_page);
    if ($num_pages > 1) {
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar'), 'next_text' => __('Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar'), 'total' => $num_pages, 'current' => $current, 'mid_size' => 1));
        printf("<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links);
    }
    if (!empty($events)) {
        ?>
		<form action="<?php 
        echo admin_url("admin.php?page=my-calendar-groups");
        ?>
" method="post">
			<div>
				<input type="hidden" name="_wpnonce" value="<?php 
        echo wp_create_nonce('my-calendar-nonce');
        ?>
"/>
				<input type="hidden" name="event_action" value="group"/>
			</div>
			<p style="position:relative;display:inline-block;">
				<input type="submit" class="button-primary group"
				       value="<?php 
        _e('Group checked events for mass editing', 'my-calendar');
        ?>
"/>
			</p>
	</div>
	<table class="widefat wp-list-table" id="my-calendar-admin-table">
		<thead>
		<tr>
			<th scope="col" style="width: 50px;"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=1{$sorting}");
        ?>
"><?php 
        _e('ID', 'my-calendar');
        ?>
</a>
			</th>
			<th scope="col"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=8{$sorting}");
        ?>
"><?php 
        _e('Group', 'my-calendar');
        ?>
</a>
			</th>
			<th scope="col"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=2{$sorting}");
        ?>
"><?php 
        _e('Title', 'my-calendar');
        ?>
</a>
			</th>
			<th scope="col"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=7{$sorting}");
        ?>
"><?php 
        _e('Where', 'my-calendar');
        ?>
</a>
			</th>
			<th scope="col"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=4{$sorting}");
        ?>
"><?php 
        _e('Starts', 'my-calendar');
        ?>
</a>
			</th>
			<th scope="col"><?php 
        _e('Recurs', 'my-calendar');
        ?>
</th>
			<th scope="col"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=5{$sorting}");
        ?>
"><?php 
        _e('Author', 'my-calendar');
        ?>
</a>
			</th>
			<th scope="col"><a
					href="<?php 
        echo admin_url("admin.php?page=my-calendar-groups&amp;sort=6{$sorting}");
        ?>
"><?php 
        _e('Category', 'my-calendar');
        ?>
</a>
			</th>
		</tr>
		</thead>
		<?php 
        $class = '';
        $sql = "SELECT * FROM " . my_calendar_categories_table();
        $categories = $mcdb->get_results($sql);
        foreach ($events as $event) {
            $class = $class == 'alternate' ? '' : 'alternate';
            $spam = $event->event_flagged == 1 ? ' spam' : '';
            $spam_label = $event->event_flagged == 1 ? '<strong>Possible spam:</strong> ' : '';
            $author = $event->event_author != 0 ? get_userdata($event->event_author) : 'Public Submitter';
            if ($event->event_link != '') {
                $title = "<a href='" . esc_attr($event->event_link) . "'>{$event->event_title}</a>";
            } else {
                $title = $event->event_title;
            }
            ?>
		<tr class="<?php 
            echo $class;
            echo $spam;
            ?>
" id="event<?php 
            echo $event->event_id;
            ?>
">
			<th scope="row"><input type="checkbox" value="<?php 
            echo $event->event_id;
            ?>
" name="group[]"
			                       id="mc<?php 
            echo $event->event_id;
            ?>
" <?php 
            echo mc_event_is_grouped($event->event_group_id) ? ' disabled="disabled"' : '';
            ?>
 />
				<label for="mc<?php 
            echo $event->event_id;
            ?>
"><?php 
            echo $event->event_id;
            ?>
</label></th>
			<th scope="row"><?php 
            echo $event->event_group_id == 0 ? '-' : $event->event_group_id;
            ?>
</th>
			<td title="<?php 
            echo esc_attr(substr(strip_tags(stripslashes($event->event_desc)), 0, 240));
            ?>
">
				<strong><?php 
            if (mc_can_edit_event($event->event_author)) {
                ?>
					<a href="<?php 
                echo admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id={$event->event_id}");
                ?>
"
					   class='edit'>
						<?php 
            }
            echo $spam_label;
            echo stripslashes($title);
            ?>
					<?php 
            if (mc_can_edit_event($event->event_author)) {
                echo "</a>";
            }
            ?>
</strong>

				<div class='row-actions' style="visibility:visible;">
					<?php 
            if (mc_can_edit_event($event->event_author)) {
                ?>
						<a href="<?php 
                echo admin_url("admin.php?page=my-calendar&amp;mode=edit&amp;event_id={$event->event_id}");
                ?>
"
						   class='edit'><?php 
                _e('Edit Event', 'my-calendar');
                ?>
</a> |
						<?php 
                if (mc_event_is_grouped($event->event_group_id)) {
                    ?>
							<a href="<?php 
                    echo admin_url("admin.php?page=my-calendar-groups&amp;mode=edit&amp;event_id={$event->event_id}&amp;group_id={$event->event_group_id}");
                    ?>
"
							   class='edit group'><?php 
                    _e('Edit Group', 'my-calendar');
                    ?>
</a>
						<?php 
                } else {
                    ?>
							<em><?php 
                    _e('Ungrouped', 'my-calendar');
                    ?>
</em>
						<?php 
                }
            } else {
                _e("Not editable.", 'my-calendar');
            }
            ?>
				</div>
			</td>
			<td><?php 
            echo stripslashes($event->event_label);
            ?>
</td>
			<?php 
            if ($event->event_time != "00:00:00") {
                $eventTime = date_i18n(get_option('mc_time_format'), strtotime($event->event_time));
            } else {
                $eventTime = mc_notime_label($event);
            }
            ?>
			<td><?php 
            echo "{$event->event_begin}<br />{$eventTime}";
            ?>
</td>
			<td>
				<?php 
            $recurs = str_split($event->event_recur, 1);
            $recur = $recurs[0];
            // Interpret the DB values into something human readable
            if ($recur == 'S') {
                _e('Never', 'my-calendar');
            } else {
                if ($recur == 'D') {
                    _e('Daily', 'my-calendar');
                } else {
                    if ($recur == 'E') {
                        _e('Weekdays', 'my-calendar');
                    } else {
                        if ($recur == 'W') {
                            _e('Weekly', 'my-calendar');
                        } else {
                            if ($recur == 'B') {
                                _e('Bi-Weekly', 'my-calendar');
                            } else {
                                if ($recur == 'M') {
                                    _e('Monthly (by date)', 'my-calendar');
                                } else {
                                    if ($recur == 'U') {
                                        _e('Monthly (by day)', 'my-calendar');
                                    } else {
                                        if ($recur == 'Y') {
                                            _e('Yearly', 'my-calendar');
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ?>
&ndash;<?php 
            if ($recur == 'S') {
                _e('N/A', 'my-calendar');
            } else {
                if (mc_event_repeats_forever($recur, $event->event_repeats)) {
                    _e('Forever', 'my-calendar');
                } else {
                    if ($event->event_repeats > 0) {
                        printf(__('%d Times', 'my-calendar'), $event->event_repeats);
                    }
                }
            }
            ?>
			</td>
			<td><?php 
            echo is_object($author) ? $author->display_name : $author;
            ?>
</td>
			<?php 
            $this_category = $event->event_category;
            foreach ($categories as $key => $value) {
                if ($value->category_id == $this_category) {
                    $this_cat = $categories[$key];
                }
            }
            ?>
			<td>
				<div class="category-color"
				     style="background-color:<?php 
            echo strpos($this_cat->category_color, '#') !== 0 ? '#' : '';
            echo $this_cat->category_color;
            ?>
;"></div> <?php 
            echo stripslashes($this_cat->category_name);
            ?>
			</td>
			<?php 
            unset($this_cat);
            ?>
			</tr><?php 
        }
        ?>
	</table>
		<div class="inside">
			<p>
				<input type="submit" class="button-secondary group"
				       value="<?php 
        _e('Group checked events for mass editing', 'my-calendar');
        ?>
"/>
			</p>
		</div>
		</form><?php 
    } else {
        ?>
		<div class="inside"><p><?php 
        _e("There are no events in the database!", 'my-calendar');
        ?>
</p></div><?php 
    }
}
function mc_standard_datetime_input($form, $has_data, $data, $instance, $context = 'admin')
{
    if ($has_data) {
        $event_begin = esc_attr($data->event_begin);
        $event_end = esc_attr($data->event_end);
        if (isset($_GET['date'])) {
            $event = mc_get_event((int) $_GET['date']);
            $event_begin = date('Y-m-d', strtotime($event->occur_begin));
            $event_end = date('Y-m-d', strtotime($event->occur_end));
            if ($event_begin == $event_end) {
                $event_end = '';
            }
        }
        $starttime = mc_is_all_day($data) ? '' : date("h:i A", strtotime($data->event_time));
        $endtime = mc_is_all_day($data) ? '' : date("h:i A", strtotime($data->event_endtime));
    } else {
        $event_begin = date("Y-m-d");
        $event_end = $starttime = $endtime = '';
    }
    $allday = $hide = '';
    if ($has_data && mc_is_all_day($data)) {
        $allday = " checked=\"checked\"";
    }
    if ($has_data && $data->event_hide_end == '1') {
        $hide = " checked=\"checked\"";
    }
    if ($has_data) {
        $allday_label = mc_notime_label($data);
    } else {
        $allday_label = get_option('mc_notime_text');
    }
    $form .= '<p>
		<label for="e_begin" id="eblabel">' . __('Date (YYYY-MM-DD)', 'my-calendar') . '</label> <input type="text" id="e_begin" class="mc-datepicker" name="event_begin[]" size="10" value="" data-value="' . esc_attr($event_begin) . '" />
		<label for="e_time">' . __('From', 'my-calendar') . '</label> 
		<input type="text" id="e_time" class="mc-timepicker" name="event_time[]" size="8" value="' . esc_attr($starttime) . '" />	
		<label for="e_endtime">' . __('To', 'my-calendar') . '</label> 
		<input type="text" id="e_endtime" class="mc-timepicker" name="event_endtime[]" size="8" value="' . esc_attr($endtime) . '" />
	</p>
	<ul>
		<li><input type="checkbox" value="1" id="e_allday" name="event_allday"' . $allday . ' /> <label for="e_allday">' . __('All day event', 'my-calendar') . '</label> <span class="event_time_label"><label for="e_time_label">' . __('Time label:', 'my-calendar') . '</label> <input type="text" name="event_time_label" id="e_time_label" value="' . esc_attr($allday_label) . '" /> </li>
		<li><input type="checkbox" value="1" id="e_hide_end" name="event_hide_end"' . $hide . ' /> <label for="e_hide_end">' . __('Hide end time', 'my-calendar') . '</label></li>
	</ul>
	<p>
		<label for="e_end" id="eelabel"><em>' . __('End Date (YYYY-MM-DD, optional)', 'my-calendar') . '</em></label> <input type="text" name="event_end[]" id="e_end" class="mc-datepicker" size="10" value="" data-value="' . esc_attr($event_end) . '" /> 
	</p>';
    return $form;
}
function mc_time_html($event, $type, $current_date)
{
    $id_start = date('Y-m-d', strtotime($event->occur_begin));
    $id_end = date('Y-m-d', strtotime($event->occur_end));
    $cur_date = $type == 'list' ? '' : "<span class='mc-event-date'>{$current_date}</span>";
    $time = "<div class='time-block'>";
    $time .= "<p>{$cur_date} ";
    if ($event->event_time != "00:00:00" && $event->event_time != '') {
        $time .= "\n\r\n\t\t<span class='event-time dtstart'>\r\n\t\t\t<time class='value-title' datetime='" . $id_start . 'T' . $event->event_time . "' title='" . $id_start . 'T' . $event->event_time . "'>" . date_i18n(get_option('mc_time_format'), strtotime($event->event_time)) . '</time>
		</span>';
        if ($event->event_hide_end == 0) {
            if ($event->event_endtime != '' && $event->event_endtime != $event->event_time) {
                $time .= "\r\n\t\t\t\t\t<span class='time-separator'> &ndash; </span>\r\n\t\t\t\t\t<span class='end-time dtend'>\r\n\t\t\t\t\t\t<time class='value-title' datetime='" . $id_end . 'T' . $event->event_endtime . "' title='" . $id_end . 'T' . $event->event_endtime . "'>" . date_i18n(get_option('mc_time_format'), strtotime($event->event_endtime)) . "</time>\r\n\t\t\t\t\t</span>";
            }
        }
    } else {
        $time .= "<span class='event-time'>";
        $notime = mc_notime_label($event);
        if ($notime == "N/A") {
            $time .= "<abbr title='" . __('Not Applicable', 'my-calendar') . "'>" . __('N/A', 'my-calendar') . "</abbr>\n";
        } else {
            $time .= $notime;
        }
        $time .= "</span></p>";
    }
    $time .= apply_filters('mcs_end_time_block', '', $event);
    $time .= "\r\n\t</div>";
    return apply_filters('mcs_time_block', $time, $event);
}