Modify by an amount of days.
protected modifyDays ( integer $amount, boolean $invert = false ) : ExpressiveDate | ||
$amount | integer | |
$invert | boolean | |
Результат | ExpressiveDate |
function eme_get_events_list($limit, $scope = "future", $order = "ASC", $format = '', $format_header = '', $format_footer = '', $echo = 1, $category = '', $showperiod = '', $long_events = 0, $author = '', $contact_person = '', $paging = 0, $location_id = "", $user_registered_only = 0, $show_ongoing = 1, $link_showperiod = 0, $notcategory = '', $show_recurrent_events_once = 0, $template_id = 0, $template_id_header = 0, $template_id_footer = 0, $no_events_message = "", $show_single_event = 0) { global $post, $eme_timezone; if ($limit === "") { $limit = get_option('eme_event_list_number_items'); } if (strpos($limit, "=")) { // allows the use of arguments without breaking the legacy code $eme_event_list_number_events = get_option('eme_event_list_number_items'); $defaults = array('limit' => $eme_event_list_number_events, 'scope' => 'future', 'order' => 'ASC', 'format' => '', 'echo' => 1, 'category' => '', 'showperiod' => '', $author => '', $contact_person => '', 'paging' => 0, 'long_events' => 0, 'location_id' => 0, 'show_ongoing' => 1, 'link_showperiod' => 0, 'notcategory' => '', 'show_recurrent_events_once' => 0, 'template_id' => 0, 'template_id_header' => 0, 'template_id_footer' => 0, 'no_events_message' => ''); $r = wp_parse_args($limit, $defaults); extract($r); // for AND categories: the user enters "+" and this gets translated to " " by wp_parse_args // so we fix it again $category = preg_replace("/ /", "+", $category); $notcategory = preg_replace("/ /", "+", $notcategory); } $echo = $echo === "true" || $echo === "1" ? true : $echo; $long_events = $long_events === "true" || $long_events === "1" ? true : $long_events; $paging = $paging === "true" || $paging === "1" ? true : $paging; $show_ongoing = $show_ongoing === "true" || $show_ongoing === "1" ? true : $show_ongoing; $echo = $echo === "false" || $echo === "0" ? false : $echo; $long_events = $long_events === "false" || $long_events === "0" ? false : $long_events; $paging = $paging === "false" || $paging === "0" ? false : $paging; $show_ongoing = $show_ongoing === "false" || $show_ongoing === "0" ? false : $show_ongoing; if ($scope == "") { $scope = "future"; } if ($order != "DESC") { $order = "ASC"; } if ($template_id) { $format = eme_get_template_format($template_id); } if ($template_id_header) { $format_header = eme_get_template_format($template_id_header); } if ($template_id_footer) { $format_footer = eme_get_template_format($template_id_footer); } if (empty($format)) { $format = get_option('eme_event_list_item_format'); if (empty($format_header)) { $format_header = get_option('eme_event_list_item_format_header'); if (empty($format_header)) { $format_header = DEFAULT_EVENT_LIST_HEADER_FORMAT; } } if (empty($format_footer)) { $format_footer = get_option('eme_event_list_item_format_footer'); if (empty($format_footer)) { $format_footer = DEFAULT_EVENT_LIST_FOOTER_FORMAT; } } } // for registered users: we'll add a list of event_id's for that user only $extra_conditions = ""; if ($user_registered_only == 1 && is_user_logged_in()) { $current_userid = get_current_user_id(); $person_id = eme_get_person_id_by_wp_id($current_userid); $list_of_event_ids = join(",", eme_get_event_ids_by_booker_id($person_id)); if (!empty($list_of_event_ids)) { $extra_conditions = " (event_id in ({$list_of_event_ids}))"; } else { // user has no registered events, then make sure none are shown $extra_conditions = " (event_id = 0)"; } } $prev_text = ""; $next_text = ""; $limit_start = 0; $limit_end = 0; // for browsing: if limit=0,paging=1 and only for this_week,this_month or today if ($limit > 0 && $paging == 1 && isset($_GET['eme_offset'])) { $limit_offset = intval($_GET['eme_offset']); } else { $limit_offset = 0; } // if extra scope_filter is found (from the eme_filter shortcode), then no paging // since it won't work anyway if (isset($_REQUEST["eme_scope_filter"])) { $paging = 0; } if ($paging == 1 && $limit == 0) { $eme_date_obj = new ExpressiveDate(null, $eme_timezone); $scope_offset = 0; $scope_text = ""; if (isset($_GET['eme_offset'])) { $scope_offset = $_GET['eme_offset']; } $prev_offset = $scope_offset - 1; $next_offset = $scope_offset + 1; if ($scope == "this_week") { $start_of_week = get_option('start_of_week'); $eme_date_obj->setWeekStartDay($start_of_week); $eme_date_obj->modifyWeeks($scope_offset); $limit_start = $eme_date_obj->startOfWeek()->format('Y-m-d'); $limit_end = $eme_date_obj->endOfWeek()->format('Y-m-d'); $scope = "{$limit_start}--{$limit_end}"; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone) . " -- " . eme_localised_date($limit_end . " " . $eme_timezone); $prev_text = __('Previous week', 'eme'); $next_text = __('Next week', 'eme'); } elseif ($scope == "this_month") { $eme_date_obj->modifyMonths($scope_offset); $limit_start = $eme_date_obj->startOfMonth()->format('Y-m-d'); $limit_end = $eme_date_obj->endOfMonth()->format('Y-m-d'); $scope = "{$limit_start}--{$limit_end}"; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone, get_option('eme_show_period_monthly_dateformat')); $prev_text = __('Previous month', 'eme'); $next_text = __('Next month', 'eme'); } elseif ($scope == "this_year") { $eme_date_obj->modifyYears($scope_offset); $year = $eme_date_obj->getYear(); $limit_start = "{$year}-01-01"; $limit_end = "{$year}-12-31"; $scope = "{$limit_start}--{$limit_end}"; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone, get_option('eme_show_period_yearly_dateformat')); $prev_text = __('Previous year', 'eme'); $next_text = __('Next year', 'eme'); } elseif ($scope == "today") { $scope = $eme_date_obj->modifyDays($scope_offset)->format('Y-m-d'); $limit_start = $scope; $limit_end = $scope; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone); $prev_text = __('Previous day', 'eme'); $next_text = __('Next day', 'eme'); } elseif ($scope == "tomorrow") { $scope_offset++; $scope = $eme_date_obj->modifyDays($scope_offset)->format('Y-m-d'); $limit_start = $scope; $limit_end = $scope; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone); $prev_text = __('Previous day', 'eme'); $next_text = __('Next day', 'eme'); } } // We request $limit+1 events, so we know if we need to show the pagination link or not. if ($limit == 0) { $events = eme_get_events(0, $scope, $order, $limit_offset, $location_id, $category, $author, $contact_person, $show_ongoing, $notcategory, $show_recurrent_events_once, $extra_conditions); } else { $events = eme_get_events($limit + 1, $scope, $order, $limit_offset, $location_id, $category, $author, $contact_person, $show_ongoing, $notcategory, $show_recurrent_events_once, $extra_conditions); } $events_count = count($events); if ($events_count == 1 && $show_single_event) { $event = $events[0]; $output = eme_display_single_event($event['event_id']); return $output; } // get the paging output ready $pagination_top = "<div id='events-pagination-top'> "; $nav_hidden_class = "style='visibility:hidden;'"; if ($paging == 1 && $limit > 0) { // for normal paging and there're no events, we go back to offset=0 and try again if ($events_count == 0) { $limit_offset = 0; $events = eme_get_events($limit + 1, $scope, $order, $limit_offset, $location_id, $category, $author, $contact_person, $show_ongoing, $notcategory, $show_recurrent_events_once, $extra_conditions); $events_count = count($events); } $prev_text = __('Previous page', 'eme'); $next_text = __('Next page', 'eme'); $page_number = floor($limit_offset / $limit) + 1; $this_page_url = get_permalink($post->ID); //$this_page_url=$_SERVER['REQUEST_URI']; // remove the offset info $this_page_url = remove_query_arg('eme_offset', $this_page_url); // we add possible fields from the filter section $eme_filters["eme_eventAction"] = 1; $eme_filters["eme_cat_filter"] = 1; $eme_filters["eme_loc_filter"] = 1; $eme_filters["eme_town_filter"] = 1; $eme_filters["eme_scope_filter"] = 1; foreach ($_REQUEST as $key => $item) { if (isset($eme_filters[$key])) { # if you selected multiple items, $item is an array, but rawurlencode needs a string if (is_array($item)) { $item = join(',', eme_sanitize_request($item)); } $this_page_url = add_query_arg(array($key => $item), $this_page_url); } } // we always provide the text, so everything stays in place (but we just hide it if needed, and change the link to empty // to prevent going on indefinitely and thus allowing search bots to go on for ever if ($events_count > $limit) { $forward = $limit_offset + $limit; $backward = $limit_offset - $limit; if ($backward < 0) { $pagination_top .= "<a class='eme_nav_left' {$nav_hidden_class} href='#'><< {$prev_text}</a>"; } else { $pagination_top .= "<a class='eme_nav_left' href='" . add_query_arg(array('eme_offset' => $backward), $this_page_url) . "'><< {$prev_text}</a>"; } $pagination_top .= "<a class='eme_nav_right' href='" . add_query_arg(array('eme_offset' => $forward), $this_page_url) . "'>{$next_text} >></a>"; $pagination_top .= "<span class='eme_nav_center'>" . __('Page ', 'eme') . $page_number . "</span>"; } if ($events_count <= $limit && $limit_offset > 0) { $forward = 0; $backward = $limit_offset - $limit; if ($backward < 0) { $pagination_top .= "<a class='eme_nav_left' {$nav_hidden_class} href='#'><< {$prev_text}</a>"; } else { $pagination_top .= "<a class='eme_nav_left' href='" . add_query_arg(array('eme_offset' => $backward), $this_page_url) . "'><< {$prev_text}</a>"; } $pagination_top .= "<a class='eme_nav_right' {$nav_hidden_class} href='#'>{$next_text} >></a>"; $pagination_top .= "<span class='eme_nav_center'>" . __('Page ', 'eme') . $page_number . "</span>"; } } if ($paging == 1 && $limit == 0) { $this_page_url = $_SERVER['REQUEST_URI']; // remove the offset info $this_page_url = remove_query_arg('eme_offset', $this_page_url); // we add possible fields from the filter section $eme_filters["eme_eventAction"] = 1; $eme_filters["eme_cat_filter"] = 1; $eme_filters["eme_loc_filter"] = 1; $eme_filters["eme_town_filter"] = 1; $eme_filters["eme_scope_filter"] = 1; foreach ($_REQUEST as $key => $item) { if (isset($eme_filters[$key])) { # if you selected multiple items, $item is an array, but rawurlencode needs a string if (is_array($item)) { $item = join(',', eme_sanitize_request($item)); } $this_page_url = add_query_arg(array($key => $item), $this_page_url); } } // to prevent going on indefinitely and thus allowing search bots to go on for ever, // we stop providing links if there are no more events left $older_events = eme_get_events(1, "--" . $limit_start, $order, 0, $location_id, $category, $author, $contact_person, $show_ongoing, $notcategory, $show_recurrent_events_once, $extra_conditions); $newer_events = eme_get_events(1, "++" . $limit_end, $order, 0, $location_id, $category, $author, $contact_person, $show_ongoing, $notcategory, $show_recurrent_events_once, $extra_conditions); if (count($older_events) > 0) { $pagination_top .= "<a class='eme_nav_left' href='" . add_query_arg(array('eme_offset' => $prev_offset), $this_page_url) . "'><< {$prev_text}</a>"; } else { $pagination_top .= "<a class='eme_nav_left' {$nav_hidden_class} href='#'><< {$prev_text}</a>"; } if (count($newer_events) > 0) { $pagination_top .= "<a class='eme_nav_right' href='" . add_query_arg(array('eme_offset' => $next_offset), $this_page_url) . "'>{$next_text} >></a>"; } else { $pagination_top .= "<a class='eme_nav_right' {$nav_hidden_class} href='#'>{$next_text} >></a>"; } $pagination_top .= "<span class='eme_nav_center'>{$scope_text}</span>"; } $pagination_top .= "</div>"; $pagination_bottom = str_replace("events-pagination-top", "events-pagination-bottom", $pagination_top); $output = ""; if ($events_count > 0) { # if we want to show events per period, we first need to determine on which days events occur # this code is identical to that in eme_calendar.php for "long events" if (!empty($showperiod)) { $eventful_days = array(); $i = 1; foreach ($events as $event) { // we requested $limit+1 events, so we need to break at the $limit, if reached if ($limit > 0 && $i > $limit) { break; } $eme_date_obj_tmp = new ExpressiveDate($event['event_start_date'] . " " . $event['event_start_time'], $eme_timezone); $eme_date_obj_end = new ExpressiveDate($event['event_end_date'] . " " . $event['event_end_time'], $eme_timezone); if ($eme_date_obj_end->lessThan($eme_date_obj_tmp)) { $eme_date_obj_end = $eme_date_obj_tmp->copy(); } if ($long_events) { //Show events on every day that they are still going on while ($eme_date_obj_tmp->lessOrEqualTo($eme_date_obj_end)) { $event_eventful_date = $eme_date_obj_tmp->getDate(); if (isset($eventful_days[$event_eventful_date]) && is_array($eventful_days[$event_eventful_date])) { $eventful_days[$event_eventful_date][] = $event; } else { $eventful_days[$event_eventful_date] = array($event); } $eme_date_obj_tmp->addOneDay(); } } else { //Only show events on the day that they start if (isset($eventful_days[$event['event_start_date']]) && is_array($eventful_days[$event['event_start_date']])) { $eventful_days[$event['event_start_date']][] = $event; } else { $eventful_days[$event['event_start_date']] = array($event); } } $i++; } # now that we now the days on which events occur, loop through them $curyear = ""; $curmonth = ""; $curday = ""; foreach ($eventful_days as $day_key => $day_events) { $eme_date_obj = new ExpressiveDate($day_key, $eme_timezone); list($theyear, $themonth, $theday) = explode('-', $eme_date_obj->getDate()); if ($showperiod == "yearly" && $theyear != $curyear) { $output .= "<li class='eme_period'>" . eme_localised_date($day_key . " " . $eme_timezone, get_option('eme_show_period_yearly_dateformat')) . "</li>"; } elseif ($showperiod == "monthly" && "{$theyear}{$themonth}" != "{$curyear}{$curmonth}") { $output .= "<li class='eme_period'>" . eme_localised_date($day_key . " " . $eme_timezone, get_option('eme_show_period_monthly_dateformat')) . "</li>"; } elseif ($showperiod == "daily" && "{$theyear}{$themonth}{$theday}" != "{$curyear}{$curmonth}{$curday}") { $output .= "<li class='eme_period'>"; if ($link_showperiod) { $eme_link = eme_calendar_day_url($theyear . "-" . $themonth . "-" . $theday); $output .= "<a href=\"{$eme_link}\">" . eme_localised_date($day_key . " " . $eme_timezone) . "</a>"; } else { $output .= eme_localised_date($day_key . " " . $eme_timezone); } $output .= "</li>"; } $curyear = $theyear; $curmonth = $themonth; $curday = $theday; foreach ($day_events as $event) { $output .= eme_replace_placeholders($format, $event); } } } else { $i = 1; foreach ($events as $event) { // we requested $limit+1 events, so we need to break at the $limit, if reached if ($limit > 0 && $i > $limit) { break; } $output .= eme_replace_placeholders($format, $event); $i++; } } // end if (! empty ( $showperiod )) { //Add headers and footers to output $empty_event = eme_new_event(); $output = eme_replace_placeholders($format_header, $empty_event) . $output . eme_replace_placeholders($format_footer, $empty_event); } else { if (empty($no_events_message)) { $no_events_message = get_option('eme_no_events_message'); } $output = "<div id='events-no-events'>" . $no_events_message . "</div>"; } // add the pagination if needed if ($paging == 1 && $events_count > 0) { $output = $pagination_top . $output . $pagination_bottom; } // see how to return the output if ($echo) { echo $output; } else { return $output; } }
function eme_cancel_confirm_form($payment_randomid) { global $eme_timezone; $destination = eme_get_events_page(true, false); $payment = eme_get_payment(0, $payment_randomid); $booking_ids = eme_get_payment_booking_ids($payment['id']); if ($booking_ids) { $format = "#_STARTDATE #_STARTTIME: #_EVENTNAME (#_RESPSPACES places) <br />"; $eme_format_header = get_option('eme_bookings_list_header_format'); $eme_format_footer = get_option('eme_bookings_list_footer_format'); $res = __("You're about to cancel the following bookings:", "eme") . $eme_format_header; $eme_date_obj_now = new ExpressiveDate(null, $eme_timezone); foreach ($booking_ids as $booking_id) { // don't let eme_replace_placeholders replace other shortcodes yet, let eme_replace_booking_placeholders finish and that will do it $booking = eme_get_booking($booking_id); $event = eme_get_event($booking['event_id']); $cancel_cutofftime = new ExpressiveDate($event['event_start_date'] . " " . $event['event_start_time'], $eme_timezone); $eme_cancel_rsvp_days = -1 * get_option('eme_cancel_rsvp_days'); $cancel_cutofftime->modifyDays($eme_cancel_rsvp_days); if ($cancel_cutofftime->lessThan($eme_date_obj_now)) { $res = "<p class='eme_no_booking'>" . __("You're no longer allowed to cancel this booking", "eme") . "</p>"; return $res; } $tmp_format = eme_replace_placeholders($format, $event, "html", 0); $res .= eme_replace_booking_placeholders($tmp_format, $event, $booking); } $res .= $eme_format_footer; $res .= "<form id='booking-cancel-form' name='booking-cancel-form' method='post' action='{$destination}'>\n <input type='hidden' name='eme_confirm_cancel_booking' value='1' />\n <input type='hidden' name='eme_pmt_rndid' value='{$payment_randomid}' />"; $res .= wp_nonce_field("cancel booking {$payment_randomid}", 'eme_rsvp_nonce', false, false); $res .= "<input name='eme_submit_button' type='submit' value='Cancel the booking' />"; $res .= "</form>"; } else { $res = "<p class='eme_no_booking'>" . __('No such booking found!', 'eme') . "</p>"; } return $res; }
function eme_global_map($atts) { global $eme_need_gmap_js, $eme_timezone; if (get_option('eme_gmap_is_active') == '1') { // the locations shortcode has been deteced, so we indicate // that we want the javascript in the footer as well $eme_need_gmap_js = 1; extract(shortcode_atts(array('show_locations' => true, 'show_events' => false, 'eventful' => false, 'scope' => 'all', 'paging' => 0, 'category' => '', 'width' => 450, 'height' => 300, 'list_location' => 'after'), $atts)); $eventful = $eventful === "true" || $eventful === "1" ? true : $eventful; $show_events = $show_events === "true" || $show_events === "1" ? true : $show_events; $show_locations = $show_locations === "true" || $show_locations === "1" ? true : $show_locations; $eventful = $eventful === "false" || $eventful === "0" ? false : $eventful; $show_events = $show_events === "false" || $show_events === "0" ? false : $show_events; $show_locations = $show_locations === "false" || $show_locations === "0" ? false : $show_locations; $events_page_link = eme_get_events_page(true, false); $prev_text = ""; $next_text = ""; $scope_offset = 0; // for browsing: if paging=1 and only for this_week,this_month or today if ($eventful && $paging == 1) { $eme_date_obj = new ExpressiveDate(null, $eme_timezone); if (isset($_GET['eme_offset'])) { $scope_offset = $_GET['eme_offset']; } $prev_offset = $scope_offset - 1; $next_offset = $scope_offset + 1; if ($scope == "this_week") { $start_of_week = get_option('start_of_week'); $eme_date_obj->setWeekStartDay($start_of_week); $eme_date_obj->modifyWeeks($scope_offset); $limit_start = $eme_date_obj->startOfWeek()->format('Y-m-d'); $limit_end = $eme_date_obj->endOfWeek()->format('Y-m-d'); $scope = "{$limit_start}--{$limit_end}"; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone) . " -- " . eme_localised_date($limit_end . " " . $eme_timezone); $prev_text = __('Previous week', 'eme'); $next_text = __('Next week', 'eme'); } elseif ($scope == "this_month") { $eme_date_obj->modifyMonths($scope_offset); $limit_start = $eme_date_obj->startOfMonth()->format('Y-m-d'); $limit_end = $eme_date_obj->endOfMonth()->format('Y-m-d'); $scope = "{$limit_start}--{$limit_end}"; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone, get_option('eme_show_period_monthly_dateformat')); $prev_text = __('Previous month', 'eme'); $next_text = __('Next month', 'eme'); } elseif ($scope == "this_year") { $eme_date_obj->modifyYears($scope_offset); $year = $eme_date_obj->getYear(); $limit_start = "{$year}-01-01"; $limit_end = "{$year}-12-31"; $scope = "{$limit_start}--{$limit_end}"; $scope = "{$limit_start}--{$limit_end}"; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone, get_option('eme_show_period_yearly_dateformat')); $prev_text = __('Previous year', 'eme'); $next_text = __('Next year', 'eme'); } elseif ($scope == "today") { $scope = $eme_date_obj->modifyDays($scope_offset)->format('Y-m-d'); $limit_start = $scope; $limit_end = $scope; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone); $prev_text = __('Previous day', 'eme'); $next_text = __('Next day', 'eme'); } elseif ($scope == "tomorrow") { $scope_offset++; $scope = $eme_date_obj->modifyDays($scope_offset)->format('Y-m-d'); $limit_start = $scope; $limit_end = $scope; $scope_text = eme_localised_date($limit_start . " " . $eme_timezone); $prev_text = __('Previous day', 'eme'); $next_text = __('Next day', 'eme'); } // to prevent going on indefinitely and thus allowing search bots to go on for ever, // we stop providing links if there are no more events left $older_events = eme_get_events(1, "--" . $limit_start, "ASC", 0, $location['location_id'], $category); $newer_events = eme_get_events(1, "++" . $limit_end, "ASC", 0, $location['location_id'], $category); if (count($older_events) == 0) { $prev_text = ""; } if (count($newer_events) == 0) { $next_text = ""; } } $id_base = preg_replace("/\\D/", "_", microtime(1)); $id_base = rand() . "_" . $id_base; if (!preg_match('/\\%$|px$/', $width)) { $width = $width . "px"; } if (!preg_match('/\\%$|px$/', $height)) { $height = $height . "px"; } $result = "<div id='eme_global_map_{$id_base}' class='eme_global_map' style='width: {$width}; height: {$height}'>map</div>"; // get the paging output ready if ($paging == 1) { $pagination_top = "<div id='locations-pagination-top'> "; $this_page_url = $_SERVER['REQUEST_URI']; // remove the offset info $this_page_url = remove_query_arg('eme_offset', $this_page_url); if ($prev_text != "") { $pagination_top .= "<a class='eme_nav_left' href='" . add_query_arg(array('eme_offset' => $prev_offset), $this_page_url) . "'><< {$prev_text}</a>"; } if ($next_text != "") { $pagination_top .= "<a class='eme_nav_right' href='" . add_query_arg(array('eme_offset' => $next_offset), $this_page_url) . "'>{$next_text} >></a>"; } $pagination_top .= "<span class='eme_nav_center'>{$scope_text}</span>"; $pagination_top .= "</div>"; $pagination_bottom = str_replace("locations-pagination-top", "locations-pagination-bottom", $pagination_top); $result = $pagination_top . $result . $pagination_bottom; } $eventful_string = "eventful_" . $id_base; $scope_string = "scope_" . $id_base; $category_string = "category_" . $id_base; $result .= "<script type='text/javascript'>\n <!--// \n {$eventful_string} = '{$eventful}';\n {$scope_string} = '{$scope}';\n {$category_string} = '{$category}';\n events_page_link = '{$events_page_link}';\n //-->\n </script>"; // we add the list if wanted (only for "before" or "after") $locations = eme_get_locations((bool) $eventful, $scope, $category, $scope_offset); $loc_list = "<div id='eme_div_locations_list_{$id_base}' class='eme_div_locations_list'><ol id='eme_locations_list_{$id_base}' class='eme_locations_list'>"; $firstletter = "A"; foreach ($locations as $location) { if ($show_locations) { $loc_list .= "<li id='location-" . $location['location_id'] . "_{$id_base}" . "' style='list-style-type: upper-alpha'><a>" . eme_trans_sanitize_html($location['location_name']) . "</a></li>"; } if ($show_events) { $events = eme_get_events(0, $scope, "ASC", $scope_offset, $location['location_id'], $category); $loc_list .= "<ol id='eme_events_list'>"; foreach ($events as $event) { if ($show_locations) { $loc_list .= "<li id='location-" . $location['location_id'] . "_{$id_base}" . "' style='list-style-type: none'>- <a>" . eme_trans_sanitize_html($event['event_name']) . "</a></li>"; } else { $loc_list .= "<li id='location-" . $location['location_id'] . "_{$id_base}" . "' style='list-style-type: none'>{$firstletter}. <a>" . eme_trans_sanitize_html($event['event_name']) . "</a></li>"; } } $loc_list .= "</ol>"; } // cool: we can increment strings in php, so we can mimic the CSS "style='list-style-type: upper-alpha'" thingie // usefull when we show events (more than one event per location) $firstletter++; } $loc_list .= "</ol></div>"; if ($list_location == "before") { $result = $loc_list . $result; } elseif ($list_location == "after") { $result .= $loc_list; } } else { $result = ""; } return $result; }