Version Description
- changed EM_Tickets, EM_Bookings and EM_Ticket so event object is stored as referece so get_event() all reference the same parent object,
- changed em_bookings_ticket_exists hook for when tickets don't exist, $EM_Ticket is pssed as a blank EM_Ticket with the requested $ticket_id
- removed erroneous em_boking_save action in em-actions.php before anything is actually saved
- changed the booking_resend_email action to allow AJAX requests
- changed PHP use of get_class() checks in if statements to instanceof so that extended classes pass,
- added $event_ids array passed to em_bookings_deleted and em_bookings_delete actions/filters in EM_Bookings::delete() mass deletion,
- added $force_refresh option to EM_Bookings->get_available_spaces()
- added $ignore_spaces parameter to EM_Ticket->is_available()
- added EM_Ticket->is_available_to() function
- fixed availability issue for unavailable tickets when overriding as an admin
- added extra action hooks to booking admin area
- added reserved 'waitlist' booking status numbers 6-8 (if you use custom status numbers, we advise using above 100 for sake of avoiding core collision)
- fixed some instances where EM_Booking::$disable_restrictions doesn't fully disable every restriction
- added em_event_load_postdata_other_attributes filter allowing for custom event attributes/meta to be loaded with less code
- [template change] moved booking form status notices from template into action-based output, default output of these now reside in the classes/em-event.php file
- fixed some rare instances where EM_Ticket->get_event() doesn't work as intended
- tweaked em_ticket_is_available to fire even with EM_Bookings::$disable_restrictions enabled
- added conditionial custom placeholder recursion support for EM_Ticket_Booking objects
- added JS support for general AJAX forms without need for specific JS code to work using vanilla JS
- added JS EM_Alert function for generating alerts via modal
- added $status and $EM_Booking vars to em_booking_button class
- added code editor features to formats admin section for larger text boxes
- added em-notice alert box css
- added cancellation policy allowing cancellation up to x hours before events begin
- added event_attribute filters allowing for quicker/easier adding/saving custom attributes
- fixed split booking by ticket exports not working since EM 6.1
- fixed single ticket mode booking form not displaying as per settings
- added retroactive fix of calendar templates using old HTML structure (lack of ID in em-calendar enclosing element)
- enabled text input for datepickers
- moved loading of selectize CSS and JS directly into events-manager files instead of separate loading
- fixed has_location_venue conditional displaying for non-physical events
- fixed critical error if registration data is duplicated in error in bookings_meta table
- added fix for add to calendar button when used on themes forcing line breaks within content
- tweaked normalize.css to prevent themes forcing select boxes to display:block (causing flatpickr year select to disappear out of view)
- fixed issues with serialization/wakeup in sessions for booking objects using new atomic tickets structure (fixes issues with Pro Multiple Booking checkouts)
- fixed upgrade failures due to emoji data in bookings,
- fixed issues with older PHP code looping EM_Bookings_Tickets and getting pricing resulting in single-ticket pricing rather than grouped when calling get_price_with_taxes()
- fixed taxonomy event list pagination issues as well as forced AJAX on non-ajax pagination
- fixed formatting typo displaying PHP code rather than translated output
- fixed modal y-axis overflow for advanced search,
- tweaked modal hidden mode to prevent click/touch blocking
- fixed duplicate rows output in CSV split by ticket type
- fixed templates/forms/event-editor.php to show notices within container so styling is inherited
- added duplicate data removal script for updates that somehow duplicated data within the wp_em_bookings table
- fixed PHP warning when no events in grouped listing - changed em_events_output_grouped so first argument returns all events from EM_Events::get(), use em_events_output_grouped_events_dates for split-by-dates array
- fixed login form redirect issues in MultiSite where site_url is different from home_url
- fixed timezone UTC offsets with minutes not saving properly
- fixed incorrect label id for single ticket mode spaces select
- fixed booking data duplication issues when saving personal data in booking admin
- added backwards-compatible measure to support PHP 8.1 and return type requirements in DateTime and DateTimeZone by including duplicate file with return types which are loaded only with 8.1 and greater
- added update retrigger if previous update is detected to not have gone through fully
- fixed login text still showing even if disable login form option set to yes in settings
- added option to use double-date datepicker for event dates
- tweaked event date range so that ticket start/end datepickers are linked
- fixed issue where dates for new event form default to 1970 before creation
- fixed mobile responsive issues with taxonmy and location lists
- fixed location placeholders not working when location and event not published yet
- fixed/removed errant closing p tag in single location default HTML
Download this release
Release Info
Developer | netweblogic |
Plugin | Events Manager |
Version | 6.1.2 |
Comparing to | |
See all releases |
Code changes from version 6.1.2.1 to 6.1.2
- events-manager.php +2 -2
- includes/js/events-manager.js +15 -22
- includes/js/events-manager.min.js +1 -1
- readme.txt +1 -4
- trunk/admin/bookings/em-cancelled.php +137 -0
- trunk/admin/bookings/em-confirmed.php +144 -0
- trunk/admin/bookings/em-events.php +153 -0
- trunk/admin/bookings/em-pending.php +159 -0
- trunk/admin/bookings/em-person.php +152 -0
- trunk/admin/bookings/em-rejected.php +137 -0
- trunk/admin/em-admin.php +305 -0
- trunk/admin/em-bookings.php +646 -0
- trunk/admin/em-data-privacy.php +531 -0
- trunk/admin/em-docs.php +464 -0
- trunk/admin/em-help.php +72 -0
- trunk/admin/em-ms-locations.php +52 -0
- trunk/admin/em-ms-options.php +247 -0
- trunk/admin/em-options.php +1056 -0
- trunk/admin/settings/tabs/bookings.php +181 -0
- trunk/admin/settings/tabs/emails.php +183 -0
- trunk/admin/settings/tabs/formats.php +722 -0
- trunk/admin/settings/tabs/general.php +388 -0
- trunk/admin/settings/tabs/pages.php +724 -0
- trunk/admin/settings/updates/timezone-backcompat.php +112 -0
- trunk/admin/settings/wpfc-admin.php +48 -0
- trunk/buddypress/bp-em-activity.php +221 -0
- trunk/buddypress/bp-em-core.php +352 -0
- trunk/buddypress/bp-em-groups.php +119 -0
events-manager.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Events Manager
|
4 |
-
Version: 6.1.2
|
5 |
Plugin URI: http://wp-events-plugin.com
|
6 |
Description: Event registration and booking management for WordPress. Recurring events, locations, webinars, google maps, rss, ical, booking registration and more!
|
7 |
Author: Marcus Sykes
|
@@ -69,8 +69,8 @@ include('classes/em-exception.php');
|
|
69 |
include('classes/em-options.php');
|
70 |
include('classes/em-object.php');
|
71 |
if( version_compare(PHP_VERSION, '8.1', '>=') ) {
|
72 |
-
include('classes/em-datetimezone.8.1.php');
|
73 |
include('classes/em-datetime.8.1.php');
|
|
|
74 |
}else{
|
75 |
include('classes/em-datetime.php');
|
76 |
include('classes/em-datetimezone.php');
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Events Manager
|
4 |
+
Version: 6.1.2
|
5 |
Plugin URI: http://wp-events-plugin.com
|
6 |
Description: Event registration and booking management for WordPress. Recurring events, locations, webinars, google maps, rss, ical, booking registration and more!
|
7 |
Author: Marcus Sykes
|
69 |
include('classes/em-options.php');
|
70 |
include('classes/em-object.php');
|
71 |
if( version_compare(PHP_VERSION, '8.1', '>=') ) {
|
|
|
72 |
include('classes/em-datetime.8.1.php');
|
73 |
+
include('classes/em-datetimezone.8.1.php');
|
74 |
}else{
|
75 |
include('classes/em-datetime.php');
|
76 |
include('classes/em-datetimezone.php');
|
includes/js/events-manager.js
CHANGED
@@ -1056,31 +1056,24 @@ function em_setup_datepicker(wrap){
|
|
1056 |
if( selectedDates.length === 0 ){
|
1057 |
inputs.attr('value', '');
|
1058 |
}else{
|
|
|
1059 |
if( instance.config.mode === 'range' && selectedDates[1] !== undefined ) {
|
1060 |
// deal with end date
|
1061 |
-
inputs[0].setAttribute('value', dateFormat(selectedDates[0]));
|
1062 |
inputs[1].setAttribute('value', dateFormat(selectedDates[1]));
|
1063 |
-
}else if( instance.config.mode === 'single' && wrapper.hasClass('em-datepicker-until') ){
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
let
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
}else {
|
1072 |
-
fp = wrapper.find('.em-date-input-end')[0]._flatpickr;
|
1073 |
-
}
|
1074 |
-
if( fp.selectedDates[0] !== undefined && fp.selectedDates[0] < selectedDates[0] ){
|
1075 |
-
fp.setDate(selectedDates[0], false);
|
1076 |
-
inputs[1].setAttribute('value', dateFormat(fp.selectedDates[0]));
|
1077 |
-
}
|
1078 |
-
fp.set('minDate', selectedDates[0]);
|
1079 |
-
}else{
|
1080 |
-
inputs[1].setAttribute('value', dateFormat(selectedDates[0]));
|
1081 |
}
|
1082 |
-
|
1083 |
-
|
|
|
|
|
|
|
1084 |
}
|
1085 |
}
|
1086 |
inputs.trigger('change');
|
@@ -1114,7 +1107,7 @@ function em_setup_datepicker(wrap){
|
|
1114 |
if( isRange && 'onClose' in options ){
|
1115 |
options.onClose = function( selectedDates, dateStr, instance ){
|
1116 |
if(selectedDates.length === 1){ // deal with single date choice and clicking out
|
1117 |
-
instance.setDate([selectedDates[0],selectedDates[0]]
|
1118 |
}
|
1119 |
}
|
1120 |
}
|
1056 |
if( selectedDates.length === 0 ){
|
1057 |
inputs.attr('value', '');
|
1058 |
}else{
|
1059 |
+
inputs[0].setAttribute('value', dateFormat(selectedDates[0]));
|
1060 |
if( instance.config.mode === 'range' && selectedDates[1] !== undefined ) {
|
1061 |
// deal with end date
|
|
|
1062 |
inputs[1].setAttribute('value', dateFormat(selectedDates[1]));
|
1063 |
+
}else if( instance.config.mode === 'single' && instance.input.classList.contains('em-date-input-start') && wrapper.hasClass('em-datepicker-until') ){
|
1064 |
+
// set min-date of other datepicker
|
1065 |
+
let fp;
|
1066 |
+
if( wrapper.attr('data-until-id') ){
|
1067 |
+
let fp_input = jQuery('#' + wrapper.attr('data-until-id') + ' .em-date-input-end');
|
1068 |
+
fp = fp_input[0]._flatpickr;
|
1069 |
+
}else {
|
1070 |
+
fp = wrapper.find('.em-date-input-end')[0]._flatpickr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
}
|
1072 |
+
if( fp.selectedDates[0] !== undefined || fp.selectedDates[0] < selectedDates[0] ){
|
1073 |
+
fp.setDate(selectedDates[0]);
|
1074 |
+
inputs[0].setAttribute('value', dateFormat(fp.selectedDates[0]));
|
1075 |
+
}
|
1076 |
+
fp.set('minDate', selectedDates[0]);
|
1077 |
}
|
1078 |
}
|
1079 |
inputs.trigger('change');
|
1107 |
if( isRange && 'onClose' in options ){
|
1108 |
options.onClose = function( selectedDates, dateStr, instance ){
|
1109 |
if(selectedDates.length === 1){ // deal with single date choice and clicking out
|
1110 |
+
instance.setDate([selectedDates[0],selectedDates[0]]);
|
1111 |
}
|
1112 |
}
|
1113 |
}
|
includes/js/events-manager.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function($){var load_ui_css=false;$("#start-time").each(function(i,el){$(el).addClass("em-time-input em-time-start").next("#end-time").addClass("em-time-input em-time-end").parent().addClass("em-time-range")});if($(".em-time-input").length>0){em_setup_timepicker("body")}$(".events-table").on("click",".em-event-delete",function(){if(!confirm("Are you sure you want to delete?")){return false}window.location.href=this.href});$("#event-form #event-image-delete, #location-form #location-image-delete").on("click",function(){var el=$(this);if(el.is(":checked")){el.closest(".event-form-image, .location-form-image").find("#event-image-img, #location-image-img").hide()}else{el.closest(".event-form-image, .location-form-image").find("#event-image-img, #location-image-img").show()}});$(".event-form-with-recurrence").each(function(){let recurring_form=$(this);recurring_form.on("change",".em-recurrence-checkbox",function(){if(this.checked){recurring_form.find(".em-recurring-text").each(function(){this.style.removeProperty("display")});recurring_form.find(".em-event-text").each(function(){this.style.setProperty("display","none","important")})}else{recurring_form.find(".em-recurring-text").each(function(){this.style.setProperty("display","none","important")});recurring_form.find(".em-event-text").each(function(){this.style.removeProperty("display")})}})});$(".event-form-with-recurrence .em-recurrence-checkbox").trigger("change");$("#event-form.em-event-admin-recurring").on("submit",function(event){var form=$(this);if(form.find('input[name="event_reschedule"]').first().val()==1){var warning_text=EM.event_reschedule_warning}else if(form.find('input[name="event_recreate_tickets"]').first().val()==1){var warning_text=EM.event_recurrence_bookings}else{var warning_text=EM.event_recurrence_overwrite}confirmation=confirm(warning_text);if(confirmation==false){event.preventDefault()}});$(".em-reschedule-trigger").on("click",function(e){e.preventDefault();var trigger=$(this);trigger.closest(".em-recurrence-reschedule").find(trigger.data("target")).removeClass("reschedule-hidden");trigger.siblings(".em-reschedule-value").val(1);trigger.addClass("reschedule-hidden").siblings("a").removeClass("reschedule-hidden")});$(".em-reschedule-cancel").on("click",function(e){e.preventDefault();var trigger=$(this);trigger.closest(".em-recurrence-reschedule").find(trigger.data("target")).addClass("reschedule-hidden");trigger.siblings(".em-reschedule-value").val(0);trigger.addClass("reschedule-hidden").siblings("a").removeClass("reschedule-hidden")});if($("#em-tickets-form").length>0){$("#event-rsvp").on("click",function(event){if(!this.checked){confirmation=confirm(EM.disable_bookings_warning);if(confirmation==false){event.preventDefault()}else{$("#event-rsvp-options").hide()}}else{$("#event-rsvp-options").fadeIn()}});if($("input#event-rsvp").is(":checked")){$("div#rsvp-data").fadeIn()}else{$("div#rsvp-data").hide()}var reset_ticket_forms=function(){$("#em-tickets-form table tbody tr.em-tickets-row").show();$("#em-tickets-form table tbody tr.em-tickets-row-form").hide()};if($("#em-recurrence-checkbox").length>0){$("#em-recurrence-checkbox").on("change",function(){if($("#em-recurrence-checkbox").is(":checked")){$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring").show();$("#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal, #em-tickets-form .hidden").hide()}else{$("#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal").show();$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring, #em-tickets-form .hidden").hide()}}).trigger("change")}else if($("#em-form-recurrence").length>0){$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring").show();$("#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal, #em-tickets-form .hidden").hide()}else{$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring, #em-tickets-form .hidden").hide()}$("#em-tickets-add").on("click",function(e){e.preventDefault();reset_ticket_forms();var tickets=$("#em-tickets-form table tbody");tickets.first(".em-ticket-template").find("input.em-date-input.flatpickr-input").each(function(){if("_flatpickr"in this){this._flatpickr.destroy()}});var rowNo=tickets.length+1;var slot=tickets.first(".em-ticket-template").clone(true).attr("id","em-ticket-"+rowNo).removeClass("em-ticket-template").addClass("em-ticket").appendTo($("#em-tickets-form table"));slot.find("*[name]").each(function(index,el){el=$(el);el.attr("name",el.attr("name").replace("em_tickets[0]","em_tickets["+rowNo+"]"))});let start_datepicker=slot.find(".ticket-dates-from-normal").first();if(start_datepicker.attr("data-until-id")){let until_id=start_datepicker.attr("data-until-id").replace("-0","-"+rowNo);start_datepicker.attr("data-until-id",until_id);slot.find(".ticket-dates-to-normal").attr("id",start_datepicker.attr("data-until-id"))}slot.show().find(".ticket-actions-edit").trigger("click");slot.find(".em-time-input").off().each(function(index,el){if(typeof this.em_timepickerObj=="object"){this.em_timepicker("remove")}});em_setup_datepicker(slot);em_setup_timepicker(slot);$("html, body").animate({scrollTop:slot.offset().top-30});check_ticket_sortability()});$(document).on("click",".ticket-actions-edit",function(e){e.preventDefault();reset_ticket_forms();var tbody=$(this).closest("tbody");tbody.find("tr.em-tickets-row").hide();tbody.find("tr.em-tickets-row-form").fadeIn();return false});$(document).on("click",".ticket-actions-edited",function(e){e.preventDefault();var tbody=$(this).closest("tbody");var rowNo=tbody.attr("id").replace("em-ticket-","");tbody.find(".em-tickets-row").fadeIn();tbody.find(".em-tickets-row-form").hide();tbody.find("*[name]").each(function(index,el){el=$(el);if(el.attr("name")=="ticket_start_pub"){tbody.find("span.ticket_start").text(el.val())}else if(el.attr("name")=="ticket_end_pub"){tbody.find("span.ticket_end").text(el.val())}else if(el.attr("name")=="em_tickets["+rowNo+"][ticket_type]"){if(el.find(":selected").val()=="members"){tbody.find("span.ticket_name").prepend("* ")}}else if(el.attr("name")=="em_tickets["+rowNo+"][ticket_start_recurring_days]"){var text=tbody.find("select.ticket-dates-from-recurring-when").val()=="before"?"-"+el.val():el.val();if(el.val()!=""){tbody.find("span.ticket_start_recurring_days").text(text);tbody.find("span.ticket_start_recurring_days_text, span.ticket_start_time").removeClass("hidden").show()}else{tbody.find("span.ticket_start_recurring_days").text(" - ");tbody.find("span.ticket_start_recurring_days_text, span.ticket_start_time").removeClass("hidden").hide()}}else if(el.attr("name")=="em_tickets["+rowNo+"][ticket_end_recurring_days]"){var text=tbody.find("select.ticket-dates-to-recurring-when").val()=="before"?"-"+el.val():el.val();if(el.val()!=""){tbody.find("span.ticket_end_recurring_days").text(text);tbody.find("span.ticket_end_recurring_days_text, span.ticket_end_time").removeClass("hidden").show()}else{tbody.find("span.ticket_end_recurring_days").text(" - ");tbody.find("span.ticket_end_recurring_days_text, span.ticket_end_time").removeClass("hidden").hide()}}else{var classname=el.attr("name").replace("em_tickets["+rowNo+"][","").replace("]","").replace("[]","");tbody.find(".em-tickets-row ."+classname).text(el.val())}});$(document).triggerHandler("em_maps_tickets_edit",[tbody,rowNo,true]);$("html, body").animate({scrollTop:tbody.parent().offset().top-30});return false});$(document).on("change",".em-ticket-form select.ticket_type",function(e){var el=$(this);if(el.find("option:selected").val()=="members"){el.closest(".em-ticket-form").find(".ticket-roles").fadeIn()}else{el.closest(".em-ticket-form").find(".ticket-roles").hide()}});$(document).on("click",".em-ticket-form .ticket-options-advanced",function(e){e.preventDefault();var el=$(this);if(el.hasClass("show")){el.closest(".em-ticket-form").find(".em-ticket-form-advanced").fadeIn();el.find(".show,.show-advanced").hide();el.find(".hide,.hide-advanced").show()}else{el.closest(".em-ticket-form").find(".em-ticket-form-advanced").hide();el.find(".show,.show-advanced").show();el.find(".hide,.hide-advanced").hide()}el.toggleClass("show")});$(".em-ticket-form").each(function(){var show_advanced=false;var el=$(this);el.find('.em-ticket-form-advanced input[type="text"]').each(function(){if(this.value!="")show_advanced=true});if(el.find('.em-ticket-form-advanced input[type="checkbox"]:checked').length>0){show_advanced=true}el.find(".em-ticket-form-advanced option:selected").each(function(){if(this.value!="")show_advanced=true});if(show_advanced)el.find(".ticket-options-advanced").trigger("click")});$(document).on("click",".ticket-actions-delete",function(e){e.preventDefault();var el=$(this);var tbody=el.closest("tbody");if(tbody.find("input.ticket_id").val()>0){el.text("Deleting...");$.getJSON($(this).attr("href"),{em_ajax_action:"delete_ticket",id:tbody.find("input.ticket_id").val()},function(data){if(data.result){tbody.remove()}else{el.text("Delete");alert(data.error)}})}else{tbody.remove()}check_ticket_sortability();return false});$("#em-tickets-form.em-tickets-sortable table").sortable({items:"> tbody",placeholder:"em-ticket-sortable-placeholder",handle:".ticket-status",helper:function(event,el){var helper=$(el).clone().addClass("em-ticket-sortable-helper");var tds=helper.find(".em-tickets-row td").length;helper.children().remove();helper.append('<tr class="em-tickets-row"><td colspan="'+tds+'" style="text-align:left; padding-left:15px;"><span class="dashicons dashicons-tickets-alt"></span></td></tr>');return helper}});var check_ticket_sortability=function(){var em_tickets=$("#em-tickets-form table tbody.em-ticket");if(em_tickets.length==1){em_tickets.find(".ticket-status").addClass("single");$("#em-tickets-form.em-tickets-sortable table").sortable("option","disabled",true)}else{em_tickets.find(".ticket-status").removeClass("single");$("#em-tickets-form.em-tickets-sortable table").sortable("option","disabled",false)}};check_ticket_sortability()}if($("#em-bookings-table").length>0){$(document).on("click","#em-bookings-table .tablenav-pages a",function(){var el=$(this);var form=el.parents("#em-bookings-table form.bookings-filter");var match=el.attr("href").match(/#[0-9]+/);if(match!=null&&match.length>0){var pno=match[0].replace("#","");form.find("input[name=pno]").val(pno)}else{form.find("input[name=pno]").val(1)}form.trigger("submit");return false});var em_bookings_settings_dialog={modal:true,autoOpen:false,minWidth:500,height:"auto",buttons:[{text:EM.bookings_settings_save,click:function(e){e.preventDefault();var match=$("#em-bookings-table form.bookings-filter [name=cols]").val("");var booking_form_cols=$("form#em-bookings-table-settings-form input.em-bookings-col-item");$.each(booking_form_cols,function(i,item_match){if(item_match.value==1){if(match.val()!=""){match.val(match.val()+","+item_match.name)}else{match.val(item_match.name)}}});$("#em-bookings-table-settings").trigger("submitted");$("#em-bookings-table form.bookings-filter").trigger("submit");$(this).dialog("close")}}],appendTo:"#em-dialog-wrapper"};var em_bookings_export_dialog={modal:true,autoOpen:false,minWidth:500,height:"auto",buttons:[{text:EM.bookings_export_save,click:function(e){$(this).children("form").trigger("submit");$(this).dialog("close")}}],appendTo:"#em-dialog-wrapper"};if($("#em-bookings-table-settings").length>0){$('<div id="em-dialog-wrapper" class="em"></div>').appendTo("body");$("#em-bookings-table-settings").dialog(em_bookings_settings_dialog);$(document).on("click","#em-bookings-table-settings-trigger",function(e){e.preventDefault();$("#em-bookings-table-settings").dialog("open")});$("#em-bookings-table-export").dialog(em_bookings_export_dialog);$(document).on("click","#em-bookings-table-export-trigger",function(e){e.preventDefault();$("#em-bookings-table-export").dialog("open")});var export_overlay_show_tickets=function(){if($("#em-bookings-table-export-form input[name=show_tickets]").is(":checked")){$("#em-bookings-table-export-form .em-bookings-col-item-ticket").show();$("#em-bookings-table-export-form #em-bookings-export-cols-active .em-bookings-col-item-ticket input").val(1)}else{$("#em-bookings-table-export-form .em-bookings-col-item-ticket").hide().find("input").val(0)}};$("#em-bookings-table form select").each(function(i,el){$(el).on("change",function(e){var select_el=$(this);var input_par=$("#em-bookings-table-export-form input[name="+select_el.attr("name")+"]");var input_par_selected=select_el.find("option:selected");input_par.val(input_par_selected.val())})});export_overlay_show_tickets();$("#em-bookings-table-export-form input[name=show_tickets]").on("click",export_overlay_show_tickets);$(".em-bookings-cols-sortable").sortable({connectWith:".em-bookings-cols-sortable",update:function(event,ui){if(ui.item.parents("ul#em-bookings-cols-active, ul#em-bookings-export-cols-active").length>0){ui.item.addClass("ui-state-highlight").removeClass("ui-state-default").children("input").val(1)}else{ui.item.addClass("ui-state-default").removeClass("ui-state-highlight").children("input").val(0)}}}).disableSelection();load_ui_css=true}$(document).on("submit","#em-bookings-table form.bookings-filter",function(e){var el=$(this);el.parents("#em-bookings-table").find(".table-wrap").first().append('<div id="em-loading" />');$.post(EM.ajaxurl,el.serializeArray(),function(data){var root=el.parents("#em-bookings-table").first();root.replaceWith(data);$("#em-bookings-table-export input[name=scope]").val(root.find("select[name=scope]").val());$("#em-bookings-table-export input[name=status]").val(root.find("select[name=status]").val());jQuery(document).triggerHandler("em_bookings_filtered",[data,root,el])});return false});$(document).on("click",".em-bookings-approve,.em-bookings-reject,.em-bookings-unapprove,.em-bookings-delete,.em-bookings-ajax-action",function(){var el=$(this);if(el.hasClass("em-bookings-delete")){if(!confirm(EM.booking_delete)){return false}}var url=em_ajaxify(el.attr("href"));var td=el.parents("td").first();td.html(EM.txt_loading);td.load(url);return false})}if($(".em_bookings_events_table").length>0){$(document).on("submit",".em_bookings_events_table form",function(e){var el=$(this);var url=em_ajaxify(el.attr("action"));el.parents(".em_bookings_events_table").find(".table-wrap").first().append('<div id="em-loading" />');$.get(url,el.serializeArray(),function(data){el.parents(".em_bookings_events_table").first().replaceWith(data)});return false});$(document).on("click",".em_bookings_events_table .tablenav-pages a",function(){var el=$(this);var url=em_ajaxify(el.attr("href"));el.parents(".em_bookings_events_table").find(".table-wrap").first().append('<div id="em-loading" />');$.get(url,function(data){el.parents(".em_bookings_events_table").first().replaceWith(data)});return false})}$(document).on("click","a.em-booking-button",function(e){e.preventDefault();var button=$(this);if(button.text()!=EM.bb_booked&&$(this).text()!=EM.bb_booking){button.text(EM.bb_booking);var button_data=button.attr("id").split("_");$.ajax({url:EM.ajaxurl,dataType:"jsonp",data:{event_id:button_data[1],_wpnonce:button_data[2],action:"booking_add_one"},success:function(response,statusText,xhr,$form){if(response.result){button.text(EM.bb_booked);button.addClass("disabled")}else{button.text(EM.bb_error)}if(response.message!="")alert(response.message);$(document).triggerHandler("em_booking_button_response",[response,button])},error:function(){button.text(EM.bb_error)}})}return false});$(document).on("click","a.em-cancel-button",function(e){e.preventDefault();var button=$(this);if(button.text()!=EM.bb_cancelled&&button.text()!=EM.bb_canceling){button.text(EM.bb_canceling);var button_data=button.attr("id").split("_");$.ajax({url:EM.ajaxurl,dataType:"jsonp",data:{booking_id:button_data[1],_wpnonce:button_data[2],action:"booking_cancel"},success:function(response,statusText,xhr,$form){if(response.result){button.text(EM.bb_cancelled);button.addClass("disabled")}else{button.text(EM.bb_cancel_error)}},error:function(){button.text(EM.bb_cancel_error)}})}return false});$(document).on("click","a.em-booking-button-action",function(e){e.preventDefault();var button=$(this);var button_data={_wpnonce:button.attr("data-nonce"),action:button.attr("data-action")};if(button.attr("data-event-id"))button_data.event_id=button.attr("data-event-id");if(button.attr("data-booking-id"))button_data.booking_id=button.attr("data-booking-id");if(button.text()!=EM.bb_booked&&$(this).text()!=EM.bb_booking){if(button.attr("data-loading")){button.text(button.attr("data-loading"))}else{button.text(EM.bb_booking)}$.ajax({url:EM.ajaxurl,dataType:"jsonp",data:button_data,success:function(response,statusText,xhr,$form){if(response.result){if(button.attr("data-success")){button.text(button.attr("data-success"))}else{button.text(EM.bb_booked)}button.addClass("disabled")}else{if(button.attr("data-error")){button.text(button.attr("data-error"))}else{button.text(EM.bb_error)}}if(response.message!="")alert(response.message);$(document).triggerHandler("em_booking_button_action_response",[response,button])},error:function(){if(button.attr("data-error")){button.text(button.attr("data-error"))}else{button.text(EM.bb_error)}}})}return false});if($(".em-date-single, .em-date-range, #em-date-start").length>0){load_ui_css=true;em_setup_datepicker("body")}if(load_ui_css)em_load_jquery_css();if($(".em-datepicker").length>0){em_setup_datepicker("body")}$("#em-wrapper input.select-all").on("change",function(){if($(this).is(":checked")){$("input.row-selector").prop("checked",true);$("input.select-all").prop("checked",true)}else{$("input.row-selector").prop("checked",false);$("input.select-all").prop("checked",false)}});function updateIntervalDescriptor(){$(".interval-desc").hide();var number="-plural";if($("input.em-recurrence-interval").val()==1||$("input.em-recurrence-interval").val()=="")number="-singular";var descriptor="span.interval-desc.interval-"+$("select.em-recurrence-frequency").val()+number;$(descriptor).show()}function updateIntervalSelectors(){$(".alternate-selector").hide();$(".em-"+$("select.em-recurrence-frequency").val()+"-selector").show()}updateIntervalDescriptor();updateIntervalSelectors();$("input.em-recurrence-interval").on("keyup",updateIntervalDescriptor);$("select.em-recurrence-frequency").on("change",updateIntervalDescriptor);$("select.em-recurrence-frequency").on("change",updateIntervalSelectors);if($(".em-location-map").length>0||$(".em-locations-map").length>0||$("#em-map").length>0||$(".em-search-geo").length>0){em_maps_load()}$(".em-location-types .em-location-types-select").on("change",function(){let el=$(this);if(el.val()==0){$(".em-location-type").hide()}else{let location_type=el.find("option:selected").data("display-class");$(".em-location-type").hide();$(".em-location-type."+location_type).show();if(location_type!="em-location-type-place"){jQuery("#em-location-reset a").trigger("click")}}if(el.data("active")!==""&&el.val()!==el.data("active")){$(".em-location-type-delete-active-alert").hide();$(".em-location-type-delete-active-alert").show()}else{$(".em-location-type-delete-active-alert").hide()}}).trigger("change");if(jQuery("div.em-location-data input#location-name").length>0){$("div.em-location-data input#location-name").selectize({plugins:["restore_on_backspace"],valueField:"id",labelField:"label",searchField:"label",create:true,createOnBlur:true,maxItems:1,persist:false,addPrecedence:true,selectOnTab:true,diacritics:true,render:{item:function(item,escape){return"<div>"+item.label+"</div>"},option:function(item,escape){let meta="";if(typeof item.address!=="undefined"){if(item.address!==""&&item.town!==""){meta=escape(item.address)+", "+escape(item.town)}else if(item.address!==""){meta=escape(item.address)}else if(item.town!==""){meta=escape(item.town)}}return'<div class="em-locations-autocomplete-item">'+'<div class="em-locations-autocomplete-label">'+escape(item.label)+"</div>"+'<div style="font-size:11px; text-decoration:italic;">'+meta+"</div>"+"</div>"}},load:function(query,callback){if(!query.length)return callback();$.ajax({url:EM.locationajaxurl,data:{q:query,method:"selectize"},dataType:"json",type:"POST",error:function(){callback()},success:function(data){callback(data)}})},onItemAdd:function(value,data){this.clearCache();var option=this.options[value];if(value===option.label){jQuery("input#location-address").focus();return}jQuery("input#location-name").val(option.value);jQuery("input#location-address").val(option.address);jQuery("input#location-town").val(option.town);jQuery("input#location-state").val(option.state);jQuery("input#location-region").val(option.region);jQuery("input#location-postcode").val(option.postcode);jQuery("input#location-latitude").val(option.latitude);jQuery("input#location-longitude").val(option.longitude);if(typeof option.country==="undefined"||option.country===""){jQuery("select#location-country option:selected").removeAttr("selected")}else{jQuery('select#location-country option[value="'+option.country+'"]').attr("selected","selected")}jQuery("input#location-id").val(option.id).trigger("change");jQuery("div.em-location-data input, div.em-location-data select").prop("readonly",true).css("opacity","0.5");jQuery("#em-location-reset").show();jQuery("#em-location-search-tip").hide();this.disable();this.$control.blur();jQuery('div.em-location-data [class^="em-selectize"]').each(function(){this.selectize.disable()});jQuery(document).triggerHandler("em_locations_autocomplete_selected",[event,option])}});jQuery("#em-location-reset a").on("click",function(){jQuery("div.em-location-data input, div.em-location-data select").each(function(){this.style.removeProperty("opacity");this.readOnly=false;if(this.type=="text")this.value=""});jQuery("div.em-location-data option:selected").removeAttr("selected");jQuery("input#location-id").val("");jQuery("#em-location-reset").hide();jQuery("#em-location-search-tip").show();jQuery("#em-map").hide();jQuery("#em-map-404").show();if(typeof marker!=="undefined"){marker.setPosition(new google.maps.LatLng(0,0));infoWindow.close();marker.setDraggable(true)}let $selectize=$("div.em-location-data input#location-name")[0].selectize;$selectize.enable();$selectize.clear(true);$selectize.clearOptions();jQuery("div.em-location-data select.em-selectize").each(function(){if("selectize"in this){this.selectize.enable();this.selectize.clear(true)}});return false});if(jQuery("input#location-id").val()!="0"&&jQuery("input#location-id").val()!=""){jQuery("div.em-location-data input, div.em-location-data select").each(function(){this.style.setProperty("opacity","0.5","important");this.readOnly=true});jQuery("#em-location-reset").show();jQuery("#em-location-search-tip").hide();jQuery("div.em-location-data select.em-selectize, div.em-location-data input.em-selectize-autocomplete").each(function(){if("selectize"in this)this.selectize.disable()})}}$("select:not([multiple]).em-selectize, .em-selectize select:not([multiple])").selectize();$("select[multiple].em-selectize, .em-selectize select[multiple]").selectize({hideSelected:false,plugins:["remove_button","click2deselect"],diacritics:true,render:{item:function(item,escape){return'<div class="item">'+item.text.replace(/^\s+/i,"")+"</div>"},option:function(item,escape){let html='<div class="option">';if(this.$input.hasClass("checkboxes")){html+=item.text.replace(/^(\s+)?/i,"$1<span></span> ")}else{html+=item.text}html+="</div>";return html}}});$(".em-selectize.always-open").each(function(){if("selectize"in this){let s=this.selectize;s.open();s.advanceSelection=function(){};s.setActiveItem=function(){};this.selectize.$control.on("click",".remove",function(e){e.preventDefault();if(s.isLocked)return;var $item=$(e.currentTarget).parent();s.removeItem($item.attr("data-value"));s.refreshOptions();return false})}});$(document).triggerHandler("em_selectize_loaded");if(window.moment){var replace_specials=function(day,string){string=string.replace(/##T/g,Intl.DateTimeFormat().resolvedOptions().timeZone);string=string.replace(/#T/g,"GMT"+day.format("Z"));string=string.replace(/###t/g,day.utcOffset()*-60);string=string.replace(/##t/g,day.isDST());string=string.replace(/#t/g,day.daysInMonth());return string};$(".em-date-momentjs").each(function(){var el=$(this);var day_start=moment.unix(el.data("date-start"));var date_start_string=replace_specials(day_start,day_start.format(el.data("date-format")));if(el.data("date-start")!==el.data("date-end")){var day_end=moment.unix(el.data("date-end"));var day_end_string=replace_specials(day_start,day_end.format(el.data("date-format")));var date_string=date_start_string+el.data("date-separator")+day_end_string}else{var date_string=date_start_string}el.text(date_string)});var get_date_string=function(ts,format){let date=new Date(ts*1e3);let minutes=date.getMinutes();if(format==24){let hours=date.getHours();hours=hours<10?"0"+hours:hours;minutes=minutes<10?"0"+minutes:minutes;return hours+":"+minutes}else{let hours=date.getHours()%12;let ampm=hours>=12?"PM":"AM";if(hours===0)hours=12;minutes=minutes<10?"0"+minutes:minutes;return hours+":"+minutes+" "+ampm}};$(".em-time-localjs").each(function(){var el=$(this);var strTime=get_date_string(el.data("time"),el.data("time-format"));if(el.data("time-end")){var separator=el.data("time-separator")?el.data("time-separator"):" - ";strTime=strTime+separator+get_date_string(el.data("time-end"),el.data("time-format"))}el.text(strTime)})}var tooltip_vars={theme:"light-border",appendTo:"parent",content(reference){return reference.getAttribute("aria-label")}};$(document).trigger("em-tippy-vars",[tooltip_vars]);tippy(".em-tooltip",tooltip_vars);let tippy_ddm_options={theme:"light-border",arrow:false,allowHTML:true,interactive:true,trigger:"manual",placement:"bottom",zIndex:1e6};$(document).trigger("em-tippy-ddm-vars",[tippy_ddm_options]);$(".em-tooltip-ddm").each(function(){let ddm_content,ddm_content_sibling;if(this.getAttribute("data-content")){ddm_content=document.getElementById(this.getAttribute("data-content"));ddm_content_sibling=ddm_content.previousElementSibling}else{ddm_content=this.nextElementSibling;ddm_content_sibling=ddm_content.previousElementSibling}let tippy_content=document.createElement("div");let button_width=this.getAttribute("data-button-width");if(button_width){if(button_width=="match"){tippy_ddm_options.maxWidth=this.clientWidth}else{tippy_ddm_options.maxWidth=this.getAttribute("data-button-width")}}tippy_ddm_options.content=tippy_content;let tippy_ddm=tippy(this,tippy_ddm_options);tippy_ddm.props.distance=50;tippy_ddm.setProps({onShow(instance){if(instance.reference.getAttribute("data-tooltip-class")){instance.popper.classList.add(instance.reference.getAttribute("data-tooltip-class"))}instance.popper.classList.add("em-tooltip-ddm-display");tippy_content.append(ddm_content);ddm_content.classList.remove("em-tooltip-ddm-content")},onShown(instance){ddm_content.firstElementChild.focus()},onHidden(instance){if(ddm_content.previousElementSibling!==ddm_content_sibling){ddm_content_sibling.after(ddm_content);ddm_content.classList.add("em-tooltip-ddm-content")}}});let tippy_listener=function(e){if(e.type==="keydown"&&!(e.which===13||e.which===40))return false;e.preventDefault();e.stopPropagation();this._tippy.show()};this.addEventListener("click",tippy_listener);this.addEventListener("keydown",tippy_listener);tippy_content.addEventListener("blur",function(){tippy_content.hide()});tippy_content.addEventListener("mouseover",function(){ddm_content.firstElementChild.blur()})});jQuery(document).triggerHandler("em_javascript_loaded")});function em_load_jquery_css(wrapper=false){if(EM.ui_css&&jQuery("link#jquery-ui-em-css").length==0){var script=document.createElement("link");script.id="jquery-ui-em-css";script.rel="stylesheet";script.href=EM.ui_css;document.body.appendChild(script);if(wrapper){em_setup_jquery_ui_wrapper()}}}function em_setup_jquery_ui_wrapper(){if(jQuery("#em-jquery-ui").length===0){jQuery("body").append('<div id="em-jquery-ui" class="em">')}}function em_setup_datepicker(wrap){wrap=jQuery(wrap);let dateDivs=wrap.find(".em-date-single, .em-date-range");if(dateDivs.length>0){var datepicker_vals={dateFormat:"yy-mm-dd",changeMonth:true,changeYear:true,firstDay:EM.firstDay,yearRange:"c-100:c+15",beforeShow:function(el,inst){em_setup_jquery_ui_wrapper();inst.dpDiv.appendTo("#em-jquery-ui")}};if(EM.dateFormat)datepicker_vals.dateFormat=EM.dateFormat;if(EM.yearRange)datepicker_vals.yearRange=EM.yearRange;jQuery(document).triggerHandler("em_datepicker",datepicker_vals);dateDivs.find("input.em-date-input-loc").each(function(i,dateInput){var dateInput=jQuery(dateInput);var dateValue=dateInput.nextAll("input.em-date-input").first();var dateValue_value=dateValue.val();dateInput.datepicker(datepicker_vals);dateInput.datepicker("option","altField",dateValue);if(dateValue_value){var this_date_formatted=jQuery.datepicker.formatDate(EM.dateFormat,jQuery.datepicker.parseDate("yy-mm-dd",dateValue_value));dateInput.val(this_date_formatted);dateValue.val(dateValue_value)}dateInput.on("change",function(){if(jQuery(this).val()==""){jQuery(this).nextAll(".em-date-input").first().val("")}})});dateDivs.filter(".em-date-range").find('input.em-date-input-loc[type="text"]').each(function(i,dateInput){dateInput=jQuery(dateInput);if(dateInput.hasClass("em-date-start")){dateInput.datepicker("option","onSelect",function(selectedDate){var startDate=jQuery(this);var endDate=startDate.parents(".em-date-range").find(".em-date-end").first();var startValue=startDate.nextAll("input.em-date-input").first().val();var endValue=endDate.nextAll("input.em-date-input").first().val();startDate.trigger("em_datepicker_change");if(startValue>endValue&&endValue!=""){endDate.datepicker("setDate",selectedDate);endDate.trigger("change").trigger("em_datepicker_change")}endDate.datepicker("option","minDate",selectedDate)})}else if(dateInput.hasClass("em-date-end")){var startInput=dateInput.parents(".em-date-range").find(".em-date-start").first();if(startInput.val()!=""){dateInput.datepicker("option","minDate",startInput.val())}}})}let datePickerDivs=wrap.find(".em-datepicker, .em-datepicker-range");if(datePickerDivs.length>0){let datepicker_wrapper=jQuery("#em-flatpickr");if(datepicker_wrapper.length===0){datepicker_wrapper=jQuery('<div class="em pixelbones em-flatpickr" id="em-flatpickr"></div>').appendTo("body")}if("locale"in EM.datepicker){flatpickr.localize(flatpickr.l10ns[EM.datepicker.locale]);flatpickr.l10ns.default.firstDayOfWeek=EM.firstDay}let datepicker_options={appendTo:datepicker_wrapper[0],dateFormat:"Y-m-d",disableMoble:"true",allowInput:true,onChange:function(selectedDates,dateStr,instance){let wrapper=jQuery(instance.input).closest(".em-datepicker");let data_wrapper=wrapper.find(".em-datepicker-data");let inputs=data_wrapper.find("input");let dateFormat=function(d){let month=""+(d.getMonth()+1),day=""+d.getDate(),year=d.getFullYear();if(month.length<2)month="0"+month;if(day.length<2)day="0"+day;return[year,month,day].join("-")};if(selectedDates.length===0){inputs.attr("value","")}else{if(instance.config.mode==="range"&&selectedDates[1]!==undefined){inputs[0].setAttribute("value",dateFormat(selectedDates[0]));inputs[1].setAttribute("value",dateFormat(selectedDates[1]))}else if(instance.config.mode==="single"&&wrapper.hasClass("em-datepicker-until")){if(instance.input.classList.contains("em-date-input-start")){inputs[0].setAttribute("value",dateFormat(selectedDates[0]));let fp;if(wrapper.attr("data-until-id")){let fp_input=jQuery("#"+wrapper.attr("data-until-id")+" .em-date-input-end");fp=fp_input[0]._flatpickr}else{fp=wrapper.find(".em-date-input-end")[0]._flatpickr}if(fp.selectedDates[0]!==undefined&&fp.selectedDates[0]<selectedDates[0]){fp.setDate(selectedDates[0],false);inputs[1].setAttribute("value",dateFormat(fp.selectedDates[0]))}fp.set("minDate",selectedDates[0])}else{inputs[1].setAttribute("value",dateFormat(selectedDates[0]))}}else{inputs[0].setAttribute("value",dateFormat(selectedDates[0]))}}inputs.trigger("change");let current_date=data_wrapper.attr("date-value");data_wrapper.attr("data-value",dateStr);if(current_date===dateStr)data_wrapper.trigger("change")},onClose:function(selectedDates,dateStr,instance){if(instance.config.mode==="range"&&selectedDates[1]!==undefined){if(selectedDates.length===1){instance.setDate([selectedDates[0],selectedDates[0]],true)}}},locale:{}};if(EM.datepicker.format!==datepicker_options.dateFormat){datepicker_options.altFormat=EM.datepicker.format;datepicker_options.altInput=true}jQuery(document).triggerHandler("em_datepicker_options",datepicker_options);datePickerDivs.each(function(i,datePickerDiv){datePickerDiv=jQuery(datePickerDiv);datePickerDiv.find(".em-datepicker-data").addClass("hidden");let isRange=datePickerDiv.hasClass("em-datepicker-range");let options=Object.assign({},datepicker_options);options.mode=isRange?"range":"single";if(isRange&&"onClose"in options){options.onClose=function(selectedDates,dateStr,instance){if(selectedDates.length===1){instance.setDate([selectedDates[0],selectedDates[0]],true)}}}if(datePickerDiv.attr("data-separator"))options.locale.rangeSeparator=datePickerDiv.attr("data-separator");if(datePickerDiv.attr("data-format"))options.altFormat=datePickerDiv.attr("data-format");let FPs=datePickerDiv.find(".em-date-input");FPs.attr("type","text").flatpickr(options);let inputs=datePickerDiv.find(".em-datepicker-data input");inputs.attr("type","hidden");if(datePickerDiv.hasClass("em-datepicker-until")){let start_fp,end_fp;if(datePickerDiv.attr("data-until-id")){end_fp=jQuery("#"+datePickerDiv.attr("data-until-id")+" .em-date-input-end")[0]._flatpickr}else{end_fp=FPs.filter(".em-date-input-end")[0]._flatpickr;if(inputs[1]&&inputs[1].value){end_fp.setDate(inputs[1].value,false,"Y-m-d")}}if(inputs[0]&&inputs[0].value){start_fp=FPs.filter(".em-date-input-start")[0]._flatpickr;start_fp.setDate(inputs[0].value,false,"Y-m-d");end_fp.set("minDate",inputs[0].value)}}else{let dates=[];inputs.each(function(i,input){if(input.value){dates.push(input.value)}});FPs[0]._flatpickr.setDate(dates,false,"Y-m-d")}});jQuery(document).triggerHandler("em_flatpickr_loaded")}}function em_setup_timepicker(wrap){wrap=jQuery(wrap);var timepicker_options={step:15};timepicker_options.timeFormat=EM.show24hours==1?"G:i":"g:i A";jQuery(document).triggerHandler("em_timepicker_options",timepicker_options);wrap.find(".em-time-input").em_timepicker(timepicker_options);wrap.find(".em-time-range input.em-time-start").each(function(i,el){var time=jQuery(el);time.data("oldTime",time.em_timepicker("getSecondsFromMidnight"))}).on("change",function(){var start=jQuery(this);var end=start.nextAll(".em-time-end");if(end.val()){var oldTime=start.data("oldTime");var duration=(end.em_timepicker("getSecondsFromMidnight")-oldTime)*1e3;var time=start.em_timepicker("getSecondsFromMidnight");if(end.em_timepicker("getSecondsFromMidnight")>=oldTime){end.em_timepicker("setTime",new Date(start.em_timepicker("getTime").getTime()+duration))}start.data("oldTime",time)}});wrap.find(".event-form-when .em-time-range input.em-time-end").on("change",function(){var end=jQuery(this);var start=end.prevAll(".em-time-start");var wrapper=end.closest(".event-form-when");var start_date=wrapper.find(".em-date-end").val();var end_date=wrapper.find(".em-date-start").val();if(start.val()){if(start.em_timepicker("getTime")>end.em_timepicker("getTime")&&(end_date.length==0||start_date==end_date)){end.addClass("error")}else{end.removeClass("error")}}});wrap.find(".event-form-when .em-date-end").on("change",function(){jQuery(this).closest(".event-form-when").find(".em-time-end").trigger("change")});wrap.find(".em-time-range input.em-time-all-day").on("change",function(){var allday=jQuery(this);if(allday.is(":checked")){allday.closest(".em-time-range").find(".em-time-input").each(function(){this.style.setProperty("background-color","#ccc","important");this.readOnly=true})}else{allday.closest(".em-time-range").find(".em-time-input").each(function(){this.style.removeProperty("background-color");this.readOnly=false})}}).trigger("change")}var em_ajaxify=function(url){if(url.search("em_ajax=0")!=-1){url=url.replace("em_ajax=0","em_ajax=1")}else if(url.search(/\?/)!=-1){url=url+"&em_ajax=1"}else{url=url+"?em_ajax=1"}return url};var em_maps_loaded=false;var maps={};var maps_markers={};var infoWindow;function em_maps_load(){if(!em_maps_loaded){if(jQuery("script#google-maps").length==0&&(typeof google!=="object"||typeof google.maps!=="object")){var script=document.createElement("script");script.type="text/javascript";script.id="google-maps";var proto=EM.is_ssl?"https:":"http:";if(typeof EM.google_maps_api!=="undefined"){script.src=proto+"//maps.google.com/maps/api/js?v=quarterly&libraries=places&callback=em_maps&key="+EM.google_maps_api}else{script.src=proto+"//maps.google.com/maps/api/js?v=quarterly&libraries=places&callback=em_maps"}document.body.appendChild(script)}else if(typeof google==="object"&&typeof google.maps==="object"&&!em_maps_loaded){em_maps()}else if(jQuery("script#google-maps").length>0){jQuery(window).load(function(){if(!em_maps_loaded)em_maps()})}}}jQuery(document).on("em_view_loaded_map",function(e,view,form){if(!em_maps_loaded){em_maps_load()}else{let map=view.find(".em-locations-map");em_maps_load_locations(map)}});function em_maps_load_locations(el){var el=jQuery(el);var map_id=el.attr("id").replace("em-locations-map-","");var em_data=jQuery.parseJSON(el.nextAll(".em-locations-map-coords").first().text());if(em_data==null){var em_data=jQuery.parseJSON(jQuery("#em-locations-map-coords-"+map_id).text())}jQuery.getJSON(document.URL,em_data,function(data){if(data.length>0){var map_options={mapTypeId:google.maps.MapTypeId.ROADMAP};if(typeof EM.google_map_id_styles=="object"&&typeof EM.google_map_id_styles[map_id]!=="undefined"){console.log(EM.google_map_id_styles[map_id]);map_options.styles=EM.google_map_id_styles[map_id]}else if(typeof EM.google_maps_styles!=="undefined"){map_options.styles=EM.google_maps_styles}jQuery(document).triggerHandler("em_maps_locations_map_options",map_options);var marker_options={};jQuery(document).triggerHandler("em_maps_location_marker_options",marker_options);maps[map_id]=new google.maps.Map(el[0],map_options);maps_markers[map_id]=[];var bounds=new google.maps.LatLngBounds;jQuery.map(data,function(location,i){if(!(location.location_latitude==0&&location.location_longitude==0)){var latitude=parseFloat(location.location_latitude);var longitude=parseFloat(location.location_longitude);var location_position=new google.maps.LatLng(latitude,longitude);jQuery.extend(marker_options,{position:location_position,map:maps[map_id]});var marker=new google.maps.Marker(marker_options);maps_markers[map_id].push(marker);marker.setTitle(location.location_name);var myContent='<div class="em-map-balloon"><div id="em-map-balloon-'+map_id+'" class="em-map-balloon-content">'+location.location_balloon+"</div></div>";em_map_infobox(marker,myContent,maps[map_id]);bounds.extend(new google.maps.LatLng(latitude,longitude))}});maps[map_id].fitBounds(bounds);jQuery(document).triggerHandler("em_maps_locations_hook",[maps[map_id],data,map_id,maps_markers[map_id]])}else{el.children().first().html("No locations found");jQuery(document).triggerHandler("em_maps_locations_hook_not_found",[el])}})}function em_maps_load_location(el){el=jQuery(el);var map_id=el.attr("id").replace("em-location-map-","");em_LatLng=new google.maps.LatLng(jQuery("#em-location-map-coords-"+map_id+" .lat").text(),jQuery("#em-location-map-coords-"+map_id+" .lng").text());var map_options={zoom:14,center:em_LatLng,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false,gestureHandling:"cooperative"};if(typeof EM.google_map_id_styles=="object"&&typeof EM.google_map_id_styles[map_id]!=="undefined"){console.log(EM.google_map_id_styles[map_id]);map_options.styles=EM.google_map_id_styles[map_id]}else if(typeof EM.google_maps_styles!=="undefined"){map_options.styles=EM.google_maps_styles}jQuery(document).triggerHandler("em_maps_location_map_options",map_options);maps[map_id]=new google.maps.Map(document.getElementById("em-location-map-"+map_id),map_options);var marker_options={position:em_LatLng,map:maps[map_id]};jQuery(document).triggerHandler("em_maps_location_marker_options",marker_options);maps_markers[map_id]=new google.maps.Marker(marker_options);infoWindow=new google.maps.InfoWindow({content:jQuery("#em-location-map-info-"+map_id+" .em-map-balloon").get(0)});infoWindow.open(maps[map_id],maps_markers[map_id]);maps[map_id].panBy(40,-70);jQuery(document).triggerHandler("em_maps_location_hook",[maps[map_id],infoWindow,maps_markers[map_id],map_id]);jQuery(window).on("resize",function(e){google.maps.event.trigger(maps[map_id],"resize");maps[map_id].setCenter(maps_markers[map_id].getPosition());maps[map_id].panBy(40,-70)})}jQuery(document).on("em_search_ajax",function(e,vars,wrapper){if(em_maps_loaded){wrapper.find(".em-location-map").each(function(index,el){em_maps_load_location(el)});wrapper.find(".em-locations-map").each(function(index,el){em_maps_load_locations(el)})}});function em_maps(){jQuery(".em-location-map").each(function(index,el){em_maps_load_location(el)});jQuery(".em-locations-map").each(function(index,el){em_maps_load_locations(el)});if(jQuery("select#location-select-id, input#location-address").length>0){var map,marker;var refresh_map_location=function(){var location_latitude=jQuery("#location-latitude").val();var location_longitude=jQuery("#location-longitude").val();if(!(location_latitude==0&&location_longitude==0)){var position=new google.maps.LatLng(location_latitude,location_longitude);marker.setPosition(position);var mapTitle=jQuery("input#location-name").length>0?jQuery("input#location-name").val():jQuery("input#title").val();mapTitle=em_esc_attr(mapTitle);marker.setTitle(mapTitle);jQuery("#em-map").show();jQuery("#em-map-404").hide();google.maps.event.trigger(map,"resize");map.setCenter(position);map.panBy(40,-55);infoWindow.setContent('<div id="location-balloon-content"><strong>'+mapTitle+"</strong><br>"+em_esc_attr(jQuery("#location-address").val())+"<br>"+em_esc_attr(jQuery("#location-town").val())+"</div>");infoWindow.open(map,marker);jQuery(document).triggerHandler("em_maps_location_hook",[map,infoWindow,marker,0])}else{jQuery("#em-map").hide();jQuery("#em-map-404").show()}};var get_map_by_id=function(id){if(jQuery("#em-map").length>0){jQuery("#em-map-404 .em-loading-maps").show();jQuery.getJSON(document.URL,{em_ajax_action:"get_location",id:id},function(data){if(data.location_latitude!=0&&data.location_longitude!=0){loc_latlng=new google.maps.LatLng(data.location_latitude,data.location_longitude);marker.setPosition(loc_latlng);marker.setTitle(data.location_name);marker.setDraggable(false);jQuery("#em-map").show();jQuery("#em-map-404").hide();jQuery("#em-map-404 .em-loading-maps").hide();map.setCenter(loc_latlng);map.panBy(40,-55);infoWindow.setContent('<div id="location-balloon-content">'+data.location_balloon+"</div>");infoWindow.open(map,marker);google.maps.event.trigger(map,"resize");jQuery(document).triggerHandler("em_maps_location_hook",[map,infoWindow,marker,0])}else{jQuery("#em-map").hide();jQuery("#em-map-404").show();jQuery("#em-map-404 .em-loading-maps").hide()}})}};jQuery("#location-select-id, input#location-id").on("change",function(){get_map_by_id(jQuery(this).val())});jQuery("#location-name, #location-town, #location-address, #location-state, #location-postcode, #location-country").on("change",function(){if(jQuery(this).prop("readonly")===true)return;var addresses=[jQuery("#location-address").val(),jQuery("#location-town").val(),jQuery("#location-state").val(),jQuery("#location-postcode").val()];var address="";jQuery.each(addresses,function(i,val){if(val!=""){address=address==""?address+val:address+", "+val}});if(address==""){jQuery("#em-map").hide();jQuery("#em-map-404").show();return false}if(jQuery("#location-country option:selected").val()!=0){address=address==""?address+jQuery("#location-country option:selected").text():address+", "+jQuery("#location-country option:selected").text()}jQuery("#em-map-404 .em-loading-maps").show();if(address!=""&&jQuery("#em-map").length>0){geocoder.geocode({address:address},function(results,status){if(status==google.maps.GeocoderStatus.OK){jQuery("#location-latitude").val(results[0].geometry.location.lat());jQuery("#location-longitude").val(results[0].geometry.location.lng())}refresh_map_location()})}});if(jQuery("#em-map").length>0){var em_LatLng=new google.maps.LatLng(0,0);var map_options={zoom:14,center:em_LatLng,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false,gestureHandling:"cooperative"};if(typeof EM.google_maps_styles!=="undefined"){map_options.styles=EM.google_maps_styles}map=new google.maps.Map(document.getElementById("em-map"),map_options);var marker=new google.maps.Marker({position:em_LatLng,map:map,draggable:true});infoWindow=new google.maps.InfoWindow({content:""});var geocoder=new google.maps.Geocoder;google.maps.event.addListener(infoWindow,"domready",function(){document.getElementById("location-balloon-content").parentNode.style.overflow="";document.getElementById("location-balloon-content").parentNode.parentNode.style.overflow=""});google.maps.event.addListener(marker,"dragend",function(){var position=marker.getPosition();jQuery("#location-latitude").val(position.lat());jQuery("#location-longitude").val(position.lng());map.setCenter(position);map.panBy(40,-55)});if(jQuery("#location-select-id").length>0){jQuery("#location-select-id").trigger("change")}else{refresh_map_location()}jQuery(document).triggerHandler("em_map_loaded",[map,infoWindow,marker])}jQuery(window).on("resize",function(e){google.maps.event.trigger(map,"resize");map.setCenter(marker.getPosition());map.panBy(40,-55)})}em_maps_loaded=true;jQuery(document).triggerHandler("em_maps_loaded")}function em_map_infobox(marker,message,map){var iw=new google.maps.InfoWindow({content:message});google.maps.event.addListener(marker,"click",function(){if(infoWindow)infoWindow.close();infoWindow=iw;iw.open(map,marker)})}function em_esc_attr(str){if(typeof str!=="string")return"";return str.replace(/</gi,"<").replace(/>/gi,">")}let openModal=function(modal,onOpen=null){modal=jQuery(modal);modal.appendTo(document.body);setTimeout(function(){modal.addClass("active").find(".em-modal-popup").addClass("active");jQuery(document).triggerHandler("em_modal_open",[modal]);if(typeof onOpen==="function"){onOpen()}},100)};let closeModal=function(modal,onClose=null){modal.removeClass("active").find(".em-modal-popup").removeClass("active");setTimeout(function(){if(modal.attr("data-parent")){let wrapper=jQuery("#"+modal.attr("data-parent"));if(wrapper.length){modal.appendTo(wrapper)}}modal.triggerHandler("em_modal_close");if(typeof onClose==="function"){onClose()}},500)};jQuery(document).on("click",".em-modal .em-close-modal",function(e){let modal=jQuery(this).closest(".em-modal");if(!modal.attr("data-prevent-close")){closeModal(modal)}});jQuery(document).on("click",".em-modal",function(e){var target=jQuery(e.target);if(target.hasClass("em-modal")){let modal=jQuery(this);if(!modal.attr("data-prevent-close")){closeModal(modal)}}});jQuery(document).ready(function($){let views_ddm_options={theme:"light-border",allowHTML:true,interactive:true,trigger:"manual",placement:"bottom",zIndex:1e6};$(document).trigger("em-search-views-trigger-vars",[views_ddm_options]);let tooltip_vars={theme:"light-border",appendTo:"parent",touch:false};$(document).trigger("em-tippy-vars",[tooltip_vars]);let search_forms=$(".em-search");search_forms.each(function(){let search=$(this);let search_id=search.attr("id").replace("em-search-","");let search_form=search.find(".em-search-form").first();let search_advanced=search.find(".em-search-advanced");const update_input_count=function(input,qty=1){let el=jQuery(input);let total=qty>0?qty:null;el.attr("data-advanced-total-input",total);update_search_totals()};const update_search_totals=function(applied=false){search.find("span.total-count").remove();let total=0;search_advanced.find("[data-advanced-total-input]").each(function(){let total_input=this.getAttribute("data-advanced-total-input");total+=Math.abs(total_input)});search.attr("data-advanced-total",total);update_trigger_count(applied);search_advanced.find(".em-search-advanced-section").each(function(){let section=$(this);let section_total=0;section.attr("data-advanced-total",0);section.find("[data-advanced-total-input]").each(function(){let total_input=this.getAttribute("data-advanced-total-input");section_total+=Math.abs(total_input)});section.attr("data-advanced-total",section_total);update_section_count(section)});if(total>0||!search.attr("data-advanced-previous-total")||total!=search.attr("data-advanced-previous-total")){update_submit_buttons(true)}update_clear_button_count()};const update_trigger_count=function(applied=false){let triggers=jQuery('.em-search-advanced-trigger[data-search-advanced-id="em-search-advanced-'+search_id+'"]');triggers.find("span.total-count").remove();let total=search.attr("data-advanced-total");if(total>0){let trigger_count=jQuery('<span class="total-count">'+total+"</span>").appendTo(triggers);if(!applied){trigger_count.addClass("tentative")}}};const update_submit_buttons=function(disabled=false){let submit_button=search_advanced.find('button[type="submit"]');let main_submit_button=search.find('.em-search-main-bar button[type="submit"]');let submit_buttons=submit_button.add(main_submit_button);if(disabled){submit_buttons.removeClass("disabled").attr("aria-disabled","false")}else{submit_buttons.addClass("disabled").attr("aria-disabled","true")}};const update_section_count=function(section){let section_total=section.attr("data-advanced-total");section.find("header span.total-count").remove();if(section_total>0){$('<span class="total-count">'+section_total+"</span>").appendTo(section.find("header"))}};const update_clear_button_count=function(){let clear_link=search_advanced.find('button[type="reset"]');if(!clear_link.attr("data-placeholder")){clear_link.attr("data-placeholder",clear_link.text())}let total=search.attr("data-advanced-total");if(total>0){clear_link.text(clear_link.attr("data-placeholder")+" ("+total+")").prop("disabled",false);clear_link.removeClass("disabled").attr("aria-disabled","false")}else{clear_link.text(clear_link.attr("data-placeholder"));clear_link.addClass("disabled").attr("aria-disabled","true")}};search.find(".em-search-views-trigger").each(function(){tooltip_vars.content=this.parentElement.getAttribute("aria-label");let views_tooltip=tippy(this.parentElement,tooltip_vars);let views_content=this.parentElement.querySelector(".em-search-views-options");let views_content_parent=views_content.parentElement;let views_select=views_content.querySelector("select");let tippy_content=document.createElement("div");views_ddm_options.content=tippy_content;let views_ddm=tippy(this,views_ddm_options);views_ddm.setProps({onShow(instance){views_tooltip.disable();tippy_content.append(views_content)},onShown(instance){views_select.focus()},onHidden(instance){views_tooltip.enable();if(views_content.parentElement!==views_content_parent){views_content_parent.append(views_content)}}});let tippy_listener=function(e){if(e.type==="keydown"&&!(e.which===13||e.which===40))return false;e.preventDefault();e.stopPropagation();this._tippy.show();views_tooltip.hide()};this.addEventListener("click",tippy_listener);this.addEventListener("keydown",tippy_listener);this.firstElementChild.addEventListener("focus",function(e){views_tooltip.show()});this.firstElementChild.addEventListener("blur",function(){views_tooltip.hide()});views_select.addEventListener("blur",function(){views_ddm.hide()})});search.on("keydown click",".em-search-views select.em-search-views-options-list",function(e){if(e.type==="keydown"&&e.which!==13)return true;let select=$(this);if(select.val().length>1){select.val([select.val().shift()])}let option=select.find(":checked").first();let views_wrapper=select.closest(".em-search-views");let view_type=option.attr("value");let trigger=views_wrapper.children(".em-search-views-trigger");let trigger_option=trigger.children(".em-search-view-option");if(view_type!==trigger_option.attr("data-view")){trigger_option.attr("data-view",option.attr("value")).text(option.text());$("#em-view-"+search_id).find("#em-view-custom-data-search-"+search_id).remove();search_form.trigger("forcesubmit")}trigger[0]._tippy.hide()});search.on("click","button.em-search-advanced-trigger",function(){if(search.hasClass("advanced-mode-inline")){if(!search_advanced.hasClass("visible")){search_advanced.slideDown().addClass("visible")}else{search_advanced.slideUp().removeClass("visible")}}else{if(!search_advanced.hasClass("active")){let form_wrapper=$('<form action="" method="post" class="em-search-advanced-form" id="em-search-form-advanced-'+search_id+'"></form>');form_wrapper.appendTo(search_advanced);search_advanced.find(".em-modal-popup").appendTo(form_wrapper);this.blur();openModal(search_advanced,function(){search_advanced.find("input.em-search-text").focus()})}}});search_advanced.on("em_modal_close",function(){search_advanced.find(".em-modal-popup").appendTo(search_advanced);search_advanced.children("form").remove();let trigger=search.find("button.em-search-advanced-trigger").focus();if("_tippy"in trigger[0]){trigger[0]._tippy.hide()}});search_advanced.find(".em-search-advanced-section > header").on("click",function(){let header=$(this);let section=header.closest("section");let content=header.siblings(".em-search-section-content");if(section.hasClass("active")){content.slideUp();section.removeClass("active")}else{content.slideDown();section.addClass("active")}});let search_form_advanced_calculate_totals_inputs=function(input){let el=$(input);let qty=el.val()!==""?1:0;update_input_count(el,qty)};search.on("change input",".em-search-main-bar input.em-search-text",function(e){let advanced_search_input=search_advanced.find("input.em-search-text");advanced_search_input.val(this.value);search_form_advanced_calculate_totals_inputs(advanced_search_input[0])});search.on("change",".em-search-main-bar input.em-search-geo-coords",function(){let el=$(this);let advanced_geo=search_advanced.find("div.em-search-geo");let advanced_geo_coords=advanced_geo.find("input.em-search-geo-coords");advanced_geo_coords.val(el.val()).attr("class",el.attr("class"));let geo_text=el.siblings("input.em-search-geo").first();advanced_geo.find("input.em-search-geo").val(geo_text.val()).attr("class",geo_text.attr("class"));search_form_advanced_calculate_totals_inputs(advanced_geo_coords)});search.find(".em-search-main-bar .em-datepicker input.em-search-scope.flatpickr-input").each(function(){if(!("_flatpickr"in this))return;this._flatpickr.config.onClose.push(function(selectedDates,dateStr,instance){let advanced_datepicker=search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input");advanced_datepicker[0]._flatpickr.setDate(selectedDates,true);advanced_datepicker[0]._flatpickr.close()})});search_advanced.on("change input","input.em-search-text",function(e){if(e.type==="change"){search.find(".em-search-main input.em-search-text").val(this.value)}else{search_form_advanced_calculate_totals_inputs(this)}});search_advanced.on("change","input.em-search-geo-coords",function(e){search_form_advanced_calculate_totals_inputs(this);let el=$(this);let main=search.find(".em-search-main div.em-search-geo");if(main.length>0){main.find("input.em-search-geo-coords").val(el.val()).attr("class",el.attr("class"));let geo_text=el.siblings("input.em-search-geo");main.find("input.em-search-geo").val(geo_text.val()).attr("class",geo_text.attr("class"))}});search_advanced.on("change","input.em-search-eventful",function(e){let el=$(this);let qty=el.prop("checked")?1:0;update_input_count(el,qty)});search_advanced.on("calculate_totals",function(){$(this).find("input.em-search-text, input.em-search-geo-coords").each(function(){search_form_advanced_calculate_totals_inputs(this)});$(this).find("input.em-search-eventful").trigger("change")});search_advanced.on("clear_search",function(){$(this).find("input.em-search-geo").removeClass("off").removeClass("on").val("")});search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input").each(function(){if(!("_flatpickr"in this))return;this._flatpickr.config.onClose.push(function(selectedDates,dateStr,instance){let previous_value=instance.input.getAttribute("data-previous-value");if(previous_value!==dateStr){let qty=dateStr?1:0;update_input_count(instance.input,qty);let main_datepicker=search.find(".em-search-main-bar .em-datepicker input.em-search-scope.flatpickr-input");main_datepicker[0]._flatpickr.setDate(selectedDates,true);instance.input.setAttribute("data-previous-value",dateStr)}})});search_advanced.on("calculate_totals",function(){search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input").first().each(function(){let qty=this._flatpickr.selectedDates.length>0?1:0;update_input_count(this,qty)})});search_advanced.on("clear_search",function(){search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input").each(function(){this._flatpickr.clear();update_input_count(this,0)})});let scope_calendar_check=function(){search.find(".em-datepicker input.em-search-scope.flatpickr-input").each(function(){if(search.attr("data-view")=="calendar"){this.setAttribute("data-advanced-total-input",0);this._flatpickr.input.disabled=true}else{this._flatpickr.input.disabled=false;let qty=this._flatpickr.selectedDates.length>0?1:0;this.setAttribute("data-advanced-total-input",qty)}})};$(document).on("em_search_loaded",scope_calendar_check);scope_calendar_check();search_advanced.find("select.em-selectize").each(function(){this.selectize.on("change",function(){search_advanced_selectize_change(this)})});search_advanced.on("calculate_totals",function(){$(this).find("select.em-selectize").each(function(){search_advanced_selectize_change(this.selectize)})});search_advanced.on("clear_search",function(){search_advanced.find("select.em-selectize").each(function(){this.selectize.clear();this.selectize.refreshItems();this.selectize.refreshOptions();if(!this.classList.contains("always-open")){this.selectize.close();this.selectize.$dropdown.hide()}})});let search_advanced_selectize_change=function(selectize){let qty=selectize.items.length;if(qty==1&&!selectize.items[0]){qty=0}update_input_count(selectize.$input,qty)};let locations_selectize_load_complete=function(){if("selectize"in this){this.selectize.settings.placeholder=this.selectize.settings.original_placeholder;this.selectize.updatePlaceholder();let options=[];this.selectize.$input.find("option").each(function(){let value=this.value!==null?this.value:this.innerHTML;options.push({value:value,text:this.innerHTML})});this.selectize.addOption(options);this.selectize.refreshOptions(false)}};let locations_selectize_load_start=function(){if("selectize"in this){this.selectize.clearOptions();if(!("original_placeholder"in this.selectize.settings))this.selectize.settings.original_placeholder=this.selectize.settings.placeholder;this.selectize.settings.placeholder=EM.txt_loading;this.selectize.updatePlaceholder()}};$(".em-search-advanced select[name=country], .em-search select[name=country]").on("change",function(){var el=$(this);let wrapper=el.closest(".em-search-location");wrapper.find("select[name=state]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=region]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=town]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=state], select[name=region], select[name=town]").each(locations_selectize_load_start);if(el.val()!=""){wrapper.find(".em-search-location-meta").slideDown();var data={action:"search_states",country:el.val(),return_html:true};wrapper.find("select[name=state]").load(EM.ajaxurl,data,locations_selectize_load_complete);data.action="search_regions";wrapper.find("select[name=region]").load(EM.ajaxurl,data,locations_selectize_load_complete);data.action="search_towns";wrapper.find("select[name=town]").load(EM.ajaxurl,data,locations_selectize_load_complete)}else{wrapper.find(".em-search-location-meta").slideUp()}});$(".em-search-advanced select[name=region], .em-search select[name=region]").on("change",function(){var el=$(this);let wrapper=el.closest(".em-search-location");wrapper.find("select[name=state]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=town]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=state], select[name=town]").each(locations_selectize_load_start);var data={action:"search_states",region:el.val(),country:wrapper.find("select[name=country]").val(),return_html:true};wrapper.find("select[name=state]").load(EM.ajaxurl,data,locations_selectize_load_complete);data.action="search_towns";wrapper.find("select[name=town]").load(EM.ajaxurl,data,locations_selectize_load_complete)});$(".em-search-advanced select[name=state], .em-search select[name=state]").on("change",function(){var el=$(this);let wrapper=el.closest(".em-search-location");wrapper.find("select[name=town]").html('<option value="">'+EM.txt_loading+"</option>").each(locations_selectize_load_start);var data={action:"search_towns",state:el.val(),region:wrapper.find("select[name=region]").val(),country:wrapper.find("select[name=country]").val(),return_html:true};wrapper.find("select[name=town]").load(EM.ajaxurl,data,locations_selectize_load_complete)});search_advanced.on("click",'button[type="reset"]',function(){if(search.attr("data-advanced-total")==0)return;search_advanced.find("input.em-search-text, input.em-search-geo").val("").attr("data-advanced-total-input",null).trigger("change");search.trigger("clear_search");search_advanced.trigger("clear_search");update_search_totals(true);search_advanced.find(".em-search-advanced-section").removeClass("active").children(".em-search-section-content").slideUp();search_advanced.find('button[type="submit"]').trigger("forceclick");update_clear_button_count()}).each(function(){search_advanced.trigger("calculate_totals");update_search_totals(true)});const on_update_trigger_count=function(e,applied=true){update_trigger_count(applied)};search.on("update_trigger_count",on_update_trigger_count);search_advanced.on("update_trigger_count",on_update_trigger_count);search_advanced.on("click forceclick",'button[type="submit"]',function(e){e.preventDefault();if(this.classList.contains("disabled")&&e.type!=="forceclick")return false;closeModal(search_advanced,function(){search_form.submit()});return false});search.on("submit forcesubmit",".em-search-form",function(e){e.preventDefault();let form=$(this);let submit_buttons=form.find('button[type="submit"]');if(e.type!=="forcesubmit"&&submit_buttons.hasClass("disabled"))return false;let wrapper=form.closest(".em-search");if(wrapper.hasClass("em-search-legacy")){em_submit_legacy_search_form(form)}else{let view=$("#em-view-"+search_id);let view_type=form.find('[name="view"]').val();if(Array.isArray(view_type))view_type=view_type.shift();let custom_view_data=view.find("#em-view-custom-data-search-"+search_id).clone();let custom_view_data_container=$('<div class="em-view-custom-data"></div>');custom_view_data.children().appendTo(custom_view_data_container);custom_view_data.remove();custom_view_data_container.appendTo(form);view.append('<div class="em-loading"></div>');submit_buttons.each(function(){this.setAttribute("data-button-text",this.innerHTML);this.innerHTML=EM.txt_searching});var vars=form.serialize();$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){submit_buttons.each(function(){this.innerHTML=this.getAttribute("data-button-text")});view=EM_View_Updater(view,responseText);view.attr("data-view",view_type);search.attr("data-view",view_type);search_advanced.attr("data-view",view_type);jQuery(document).triggerHandler("em_view_loaded_"+view_type,[view,form,e]);jQuery(document).triggerHandler("em_search_loaded",[view,form,e]);jQuery(document).triggerHandler("em_search_result",[vars,view,e]);wrapper.find(".count.tentative").removeClass("tentative");submit_buttons.addClass("disabled").attr("aria-disabled","true");update_search_totals(true);search.attr("data-advanced-previous-total",search.attr("data-advanced-total"));update_submit_buttons(false);custom_view_data_container.remove()}})}return false});EM_ResizeObserver(EM.search.breakpoints,[search[0]])});$(document).on("click",".em-search-advanced-trigger[data-search-advanced-id]",function(){if(this.getAttribute("data-parent-trigger")){document.getElementById(this.getAttribute("data-parent-trigger")).click()}});$(document).on("click",".em-view-container .em-ajax.em-pagination a.page-numbers",function(e){var a=$(this);var data=a.closest(".em-pagination").attr("data-em-ajax");var view=a.closest(".em-view-container");var qvars=a.attr("href").split("?");var vars=qvars[1];if(data!=""){vars=vars!=""?vars+"&"+data:data}view.append('<div class="loading" id="em-loading"></div>');$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){view=EM_View_Updater(view,responseText);view.find(".em-pagination").each(function(){paginationObserver.observe(this)});jQuery(document).triggerHandler("em_page_loaded",[view])}});e.preventDefault();return false});const paginationObserver=new ResizeObserver(function(entries){for(let entry of entries){let el=entry.target;if(!el.classList.contains("observing")){el.classList.add("observing");let overflowing=false;el.classList.remove("overflowing");for(const item of el.querySelectorAll(".not-current")){if(item.scrollHeight>item.clientHeight||item.scrollWidth>item.clientWidth){overflowing=true;break}}if(overflowing){el.classList.add("overflowing")}el.classList.remove("observing")}}});$(".em-pagination").each(function(){paginationObserver.observe(this)});$(document).on("click change",".em-search-legacy .em-toggle",function(e){e.preventDefault();var el=$(this);var rel=el.attr("rel").split(":");if(el.hasClass("show-search")){if(rel.length>1){el.closest(rel[1]).find(rel[0]).slideUp()}else{$(rel[0]).slideUp()}el.find(".show, .show-advanced").show();el.find(".hide, .hide-advanced").hide();el.removeClass("show-search")}else{if(rel.length>1){el.closest(rel[1]).find(rel[0]).slideDown()}else{$(rel[0]).slideDown()}el.find(".show, .show-advanced").hide();el.find(".hide, .hide-advanced").show();el.addClass("show-search")}});let em_submit_legacy_search_form=function(form){if(this.em_search&&this.em_search.value==EM.txt_search){this.em_search.value=""}var results_wrapper=form.closest(".em-search-wrapper").find(".em-search-ajax");if(results_wrapper.length==0)results_wrapper=$(".em-search-ajax");if(results_wrapper.length>0){results_wrapper.append('<div class="loading" id="em-loading"></div>');var submitButton=form.find(".em-search-submit button");submitButton.attr("data-button-text",submitButton.val()).val(EM.txt_searching);var img=submitButton.children("img");if(img.length>0)img.attr("src",img.attr("src").replace("search-mag.png","search-loading.gif"));var vars=form.serialize();$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){submitButton.val(submitButton.attr("data-button-text"));if(img.length>0)img.attr("src",img.attr("src").replace("search-loading.gif","search-mag.png"));results_wrapper.replaceWith(responseText);if(form.find("input[name=em_search]").val()==""){form.find("input[name=em_search]").val(EM.txt_search)}results_wrapper=form.closest(".em-search-wrapper").find(".em-search-ajax");if(results_wrapper.length==0)results_wrapper=$(".em-search-ajax");jQuery(document).triggerHandler("em_search_ajax",[vars,results_wrapper,e])}});e.preventDefault();return false}};if($(".em-search-ajax").length>0){$(document).on("click",".em-search-ajax a.page-numbers",function(e){var a=$(this);var data=a.closest(".em-pagination").attr("data-em-ajax");var wrapper=a.closest(".em-search-ajax");var wrapper_parent=wrapper.parent();var qvars=a.attr("href").split("?");var vars=qvars[1];if(data!=""){vars=vars!=""?vars+"&"+data:data}vars+="&legacy=1";wrapper.append('<div class="loading" id="em-loading"></div>');$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){wrapper.replaceWith(responseText);wrapper=wrapper_parent.find(".em-search-ajax");jQuery(document).triggerHandler("em_search_ajax",[vars,wrapper,e])}});e.preventDefault();return false})}});jQuery(document).ready(function($){const em_calendar_init=function(calendar){calendar=$(calendar);if(!calendar.attr("id")||!calendar.attr("id").match(/^em-calendar-[0-9+]$/)){calendar.attr("id","em-calendar-"+Math.floor(Math.random()*1e4))}calendar.find("a").off("click");calendar.on("click","a.em-calnav, a.em-calnav-today",function(e){e.preventDefault();const el=$(this);if(el.data("disabled")==1||el.attr("href")==="")return;el.closest(".em-calendar").prepend('<div class="loading" id="em-loading"></div>');let url=em_ajaxify(el.attr("href"));const calendar_id=calendar.attr("id").replace("em-calendar-","");const custom_data=$("form#em-view-custom-data-calendar-"+calendar_id);let form_data=[];if(custom_data.length>0){form_data=new FormData(custom_data[0]);let url_params=new URL(url,window.location.origin).searchParams;for(const[key,value]of url_params.entries()){form_data.set(key,value)}}$.ajax({url:url,data:form_data,processData:false,contentType:false,method:"POST",success:function(data){let view=EM_View_Updater(calendar,data);if(view.hasClass("em-view-container")){calendar=view.find(".em-calendar")}else{calendar=view}calendar.trigger("em_calendar_load")},dataType:"html"})});let calendar_trigger_ajax=function(calendar,year,month){let link=calendar.find(".em-calnav-next");let url=new URL(link.attr("href"),window.location.origin);url.searchParams.set("mo",month);url.searchParams.set("yr",year);link.attr("href",url.toString()).trigger("click")};let calendar_resize_monthpicker=function(instance,text){let span=$('<span class="marker">'+text+"</span>");span.insertAfter(instance);let width=span.width()+40;span.remove();instance.style.setProperty("width",width+"px","important")};let calendar_month_init=function(){let month_form=calendar.find(".month form");calendar.find(".event-style-pill .em-cal-event").on("click",function(e){e.preventDefault();if(!(calendar.hasClass("preview-tooltips")&&calendar.data("preview-tooltips-trigger"))&&!calendar.hasClass("preview-modal")){let link=this.getAttribute("data-event-url");if(link!==null){}}});if(month_form.length>0){month_form.find('input[type="submit"]').hide();let select=$('<select style="display:none;visibility:hidden;"></select>').appendTo(month_form);let option=$("<option></option>").appendTo(select);let current_datetime=calendar.find('select[name="month"]').val()+calendar.find('select[name="year"]').val();let month=calendar.find('select[name="month"]');let year=calendar.find('select[name="year"]');let monthpicker=calendar.find(".em-month-picker");let month_value=monthpicker.data("month-value");monthpicker.prop("type","text").prop("value",month_value);calendar_resize_monthpicker(monthpicker[0],month_value);let monthpicker_wrapper=$("#em-flatpickr");if(monthpicker_wrapper.length===0){monthpicker_wrapper=$('<div class="em pixelbones" id="em-flatpickr"></div>').appendTo("body")}let minDate=null;if(calendar.data("scope")==="future"){minDate=new Date;minDate.setMonth(minDate.getMonth()-1)}monthpicker.flatpickr({appendTo:monthpicker_wrapper[0],dateFormat:"F Y",minDate:minDate,disableMobile:"true",plugins:[new monthSelectPlugin({shorthand:true,dateFormat:"F Y",altFormat:"F Y"})],onChange:function(selectedDates,dateStr,instance){calendar_resize_monthpicker(instance.input,dateStr);calendar_trigger_ajax(calendar,selectedDates[0].getFullYear(),selectedDates[0].getMonth()+1)}});monthpicker.addClass("select-toggle")}if(calendar.hasClass("preview-tooltips")){var tooltip_vars={theme:"light-border",allowHTML:true,interactive:true,trigger:"mouseenter focus click",content(reference){return document.createElement("div")},onShow(instance){const id=instance.reference.getAttribute("data-event-id");const template=calendar.find('section.em-cal-events-content .em-cal-event-content[data-event-id="'+id+'"]');instance.props.content.append(template.first().clone()[0])},onHide(instance){instance.props.content.innerHTML=""}};if(calendar.data("preview-tooltips-trigger")){tooltip_vars.trigger=calendar.data("preview-tooltips-trigger")}$(document).trigger("em-tippy-cal-event-vars",[tooltip_vars]);tippy(calendar.find(".em-cal-event").toArray(),tooltip_vars)}else if(calendar.hasClass("preview-modal")){calendar.find(".em-cal-event").on("click",function(){const id=this.getAttribute("data-event-id");const modal=calendar.find('section.em-cal-events-content .em-cal-event-content[data-event-id="'+id+'"]');modal.attr("data-calendar-id",calendar.attr("id"));openModal(modal)})}if(calendar.hasClass("responsive-dateclick-modal")){calendar.find(".eventful .em-cal-day-date, .eventful-post .em-cal-day-date, .eventful-pre .em-cal-day-date").on("click",function(e){e.preventDefault();const id=this.getAttribute("data-calendar-date");const modal=calendar.find('.em-cal-date-content[data-calendar-date="'+id+'"]');modal.attr("data-calendar-id",calendar.attr("id"));openModal(modal)})}if(!calendar.hasClass("size-fixed")){EM_ResizeObserver(EM.calendar.breakpoints,[calendar[0],calendar[0]])}calendar.find(".date-day-colors").each(function(){let colors=JSON.parse(this.getAttribute("data-colors"));let day=$(this).siblings(".em-cal-day-date.colored");let sides={1:{1:"--date-border-color",class:"one"},2:{1:"--date-border-color-top",2:"--date-border-color-bottom",class:"two"},3:{1:"--date-border-color-top",2:"--date-border-color-right",3:"--date-border-color-bottom",class:"three"},4:{1:"--date-border-color-top",2:"--date-border-color-right",3:"--date-border-color-bottom",4:"--date-border-color-left",class:"four"}};for(let i=0;i<colors.length;i+=4){const ring_colors=colors.slice(i,i+4);let outer_ring=day.children().first();let new_ring=$('<div class="ring"></div>').prependTo(day);outer_ring.appendTo(new_ring);new_ring.addClass(sides[ring_colors.length].class);for(let it=0;it<ring_colors.length;it++){new_ring.css(sides[ring_colors.length][it+1],ring_colors[it])}}});if(calendar.hasClass("with-advanced")){const trigger=calendar.find(".em-search-advanced-trigger");const search_advanced=$("#"+trigger.attr("data-search-advanced-id"));search_advanced.triggerHandler("update_trigger_count")}};calendar_month_init();$(document).triggerHandler("em_calendar_loaded",[calendar])};$(".em-calendar").each(function(){let calendar=$(this);em_calendar_init(calendar)});$(document).on("em_calendar_load",".em-calendar",function(){em_calendar_init(this)});$(document).on("em_view_loaded_calendar",function(e,view,form){let calendar;if(view.hasClass("em-calendar")){calendar=view}else{calendar=view.find(".em-calendar").first()}em_calendar_init(calendar)})});let EM_View_Updater=function(element,html){let content=jQuery(html);let view=element.hasClass("em-view-container")?element:element.parent(".em-view-container");if(view.length>0){if(content.hasClass("em-view-container")){view.replaceWith(content);view=content}else{view.empty().append(content)}}else{if(content.hasClass("em-view-container")){element.replaceWith(content);view=content}else if(content.attr("data-view-id")){let view=jQuery('<div class="em em-view-container"></div>');let view_id=content.attr("data-view-id");view.attr("data-view-id",view_id);view.attr("id","em-view-"+view_id);view.attr("data-view-type",content.attr("data-view-type"));view.append(content);element.replaceWith(view)}}return view};let EM_ResizeObserver=function(breakpoints,elements){const ro=new ResizeObserver(function(entries){for(let entry of entries){let el=entry.target;for(const[name,breakpoint]of Object.entries(breakpoints)){if(el.offsetWidth<=breakpoint||breakpoint===false){for(let breakpoint_name of Object.keys(breakpoints)){if(breakpoint_name!==name)el.classList.remove("size-"+breakpoint_name)}el.classList.add("size-"+name);break}}}});elements.forEach(function(el){if(typeof el!=="undefined"){ro.observe(el)}});return ro};jQuery(document).ready(function($){let breakpoints={small:600,large:false};const events_ro=EM_ResizeObserver(breakpoints,$(".em-list").toArray());$(document).on("em_page_loaded em_view_loaded",function(e,view){let new_elements=view.find(".em-list").each(function(){events_ro.observe(this)})});breakpoints={small:600,medium:900,large:false};const event_ro=EM_ResizeObserver(breakpoints,$(".em-event-single").toArray());$(document).on("em_view_loaded",function(e,view){let new_elements=view.find(".em-event-single").each(function(){event_ro.observe(this)})});$(document).on("click",".em-event-booking-form .em-login-trigger a",function(e){e.preventDefault();var parent=$(this).closest(".em-event-booking-form");parent.find(".em-login-trigger").hide();parent.find(".em-login-content").fadeIn();let login_form=parent.find(".em-login");login_form[0].scrollIntoView({behavior:"smooth"});login_form.first().find('input[name="log"]').focus()});$(document).on("click",".em-event-booking-form .em-login-cancel",function(e){e.preventDefault();let parent=$(this).closest(".em-event-booking-form");parent.find(".em-login-content").hide();parent.find(".em-login-trigger").show()});EM_ResizeObserver({small:500,large:false},$(".em-login").toArray())});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("form.em-ajax-form").forEach(function(el){el.addEventListener("submit",function(e){e.preventDefault();let form=e.currentTarget;let formData=new FormData(form);let button=form.querySelector('button[type="submit"]');let loader;if(form.classList.contains("no-overlay-spinner")){form.classList.add("loading")}else{let loader=document.createElement("div");loader.id="em-loading";form.append(loader)}var request=new XMLHttpRequest;if(form.getAttribute("data-api-url")){request.open("POST",form.getAttribute("data-api-url"),true);request.setRequestHeader("X-WP-Nonce",EM.api_nonce)}else{request.open("POST",EM.ajaxurl,true)}request.onload=function(){if(loader)loader.remove();if(this.status>=200&&this.status<400){try{let data=JSON.parse(this.response);let notice;if(!form.classList.contains("no-inline-notice")){notice=form.querySelector(".em-notice");if(!notice){notice=document.createElement("li");form.prepend(notice);if(formData.get("action")){form.dispatchEvent(new CustomEvent("em_ajax_form_success_"+formData.get("action"),{detail:{form:form,notice:notice,response:data}}))}}notice.innerHTML="";notice.setAttribute("class","em-notice")}if(data.result){if(!form.classList.contains("no-inline-notice")){notice.classList.add("em-notice-success");notice.innerHTML=data.message;form.replaceWith(notice)}else{form.classList.add("load-successful");form.classList.remove("loading");if(data.message){EM_Alert(data.message)}}}else{if(!form.classList.contains("no-inline-notice")){notice.classList.add("em-notice-error");notice.innerHTML=data.errors}else{EM_Alert(data.errors)}}}catch(e){alert("Error Encountered : "+e)}}else{alert("Error encountered... please see debug logs or contact support.")}form.classList.remove("loading")};request.onerror=function(){alert("Connection error encountered... please see debug logs or contact support.")};request.send(formData);return false})})});function EM_Alert(content){let modal=document.getElementById("em-alert-modal");if(modal===null){modal=document.createElement("div");modal.setAttribute("class","em pixelbones em-modal");modal.id="em-alert-modal";modal.innerHTML='<div class="em-modal-popup"><header><a class="em-close-modal"></a><div class="em-modal-title"> </div></header><div class="em-modal-content" id="em-alert-modal-content"></div></div>';document.body.append(modal)}document.getElementById("em-alert-modal-content").innerHTML=content;openModal(modal)}(function(){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj}}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}return target}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _createForOfIteratorHelper(o){if(typeof Symbol==="undefined"||o[Symbol.iterator]==null){if(Array.isArray(o)||(o=_unsupportedIterableToArray(o))){var i=0;var F=function(){};return{s:F,n:function(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var it,normalCompletion=true,didErr=false,err;return{s:function(){it=o[Symbol.iterator]()},n:function(){var step=it.next();normalCompletion=step.done;return step},e:function(e){didErr=true;err=e},f:function(){try{if(!normalCompletion&&it.return!=null)it.return()}finally{if(didErr)throw err}}}}var ONE_DAY=86400;var roundingFunction=function roundingFunction(seconds,settings){if(seconds===null){return null}else if(typeof settings.step!=="number"){return seconds}else{var offset=seconds%(settings.step*60);var start=settings.minTime||0;offset-=start%(settings.step*60);if(offset>=settings.step*30){seconds+=settings.step*60-offset}else{seconds-=offset}return _moduloSeconds(seconds,settings)}};function _moduloSeconds(seconds,settings){if(seconds==ONE_DAY&&settings.show2400){return seconds}return seconds%ONE_DAY}var DEFAULT_SETTINGS={appendTo:"body",className:null,closeOnWindowScroll:false,disableTextInput:false,disableTimeRanges:[],disableTouchKeyboard:false,durationTime:null,forceRoundTime:false,lang:{},listWidth:null,maxTime:null,minTime:null,noneOption:false,orientation:"l",roundingFunction:roundingFunction,scrollDefault:null,selectOnBlur:false,show2400:false,showDuration:false,showOn:["click","focus"],showOnFocus:true,step:30,stopScrollPropagation:false,timeFormat:"g:ia",typeaheadHighlight:true,useSelect:false,wrapHours:true};var DEFAULT_LANG={am:"am",pm:"pm",AM:"AM",PM:"PM",decimal:".",mins:"mins",hr:"hr",hrs:"hrs"};var Timepicker=function(){function Timepicker(targetEl){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Timepicker);this._handleFormatValue=this._handleFormatValue.bind(this);this._handleKeyUp=this._handleKeyUp.bind(this);this.targetEl=targetEl;var attrOptions=Timepicker.extractAttrOptions(targetEl,Object.keys(DEFAULT_SETTINGS));this.settings=this.parseSettings(_objectSpread2(_objectSpread2(_objectSpread2({},DEFAULT_SETTINGS),options),attrOptions))}_createClass(Timepicker,[{key:"hideMe",value:function hideMe(){if(this.settings.useSelect){this.targetEl.blur();return}if(!this.list||!Timepicker.isVisible(this.list)){return}if(this.settings.selectOnBlur){this._selectValue()}this.list.hide();var hideTimepickerEvent=new CustomEvent("hideTimepicker");this.targetEl.dispatchEvent(hideTimepickerEvent)}},{key:"_findRow",value:function _findRow(value){if(!value&&value!==0){return false}var out=false;var value=this.settings.roundingFunction(value,this.settings);if(!this.list){return false}this.list.find("li").each(function(i,obj){var parsed=Number.parseInt(obj.dataset.time);if(Number.isNaN(parsed)){return}if(parsed==value){out=obj;return false}});return out}},{key:"_hideKeyboard",value:function _hideKeyboard(){return(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.settings.disableTouchKeyboard}},{key:"_setTimeValue",value:function _setTimeValue(value,source){if(this.targetEl.nodeName==="INPUT"){if(value!==null||this.targetEl.value!=""){this.targetEl.value=value}var tp=this;var settings=tp.settings;if(settings.useSelect&&source!="select"&&tp.list){tp.list.val(tp._roundAndFormatTime(tp.time2int(value)))}}var selectTimeEvent=new Event("selectTime");if(this.selectedValue!=value){this.selectedValue=value;var changeTimeEvent=new Event("changeTime");var changeEvent=new CustomEvent("change",{detail:"em_timepicker"});if(source=="select"){this.targetEl.dispatchEvent(selectTimeEvent);this.targetEl.dispatchEvent(changeTimeEvent);this.targetEl.dispatchEvent(changeEvent)}else if(["error","initial"].indexOf(source)==-1){this.targetEl.dispatchEvent(changeTimeEvent)}return true}else{if(["error","initial"].indexOf(source)==-1){this.targetEl.dispatchEvent(selectTimeEvent)}return false}}},{key:"_getTimeValue",value:function _getTimeValue(){if(this.targetEl.nodeName==="INPUT"){return this.targetEl.value}else{return this.selectedValue}}},{key:"_selectValue",value:function _selectValue(){var tp=this;var settings=tp.settings;var list=tp.list;var cursor=list.find(".ui-em_timepicker-selected");if(cursor.hasClass("ui-em_timepicker-disabled")){return false}if(!cursor.length){return true}var timeValue=cursor.get(0).dataset.time;if(timeValue){var parsedTimeValue=Number.parseInt(timeValue);if(!Number.isNaN(parsedTimeValue)){timeValue=parsedTimeValue}}if(timeValue!==null){if(typeof timeValue!="string"){timeValue=tp._int2time(timeValue)}tp._setTimeValue(timeValue,"select")}return true}},{key:"time2int",value:function time2int(timeString){if(timeString===""||timeString===null||timeString===undefined)return null;if(timeString instanceof Date){return timeString.getHours()*3600+timeString.getMinutes()*60+timeString.getSeconds()}if(typeof timeString!="string"){return timeString}timeString=timeString.toLowerCase().replace(/[\s\.]/g,"");if(timeString.slice(-1)=="a"||timeString.slice(-1)=="p"){timeString+="m"}var pattern=/^(([^0-9]*))?([0-9]?[0-9])(([0-5][0-9]))?(([0-5][0-9]))?(([^0-9]*))$/;var hasDelimetersMatch=timeString.match(/\W/);if(hasDelimetersMatch){pattern=/^(([^0-9]*))?([0-9]?[0-9])(\W+([0-5][0-9]?))?(\W+([0-5][0-9]))?(([^0-9]*))$/}var time=timeString.match(pattern);if(!time){return null}var hour=parseInt(time[3]*1,10);var ampm=time[2]||time[9];var hours=hour;var minutes=time[5]*1||0;var seconds=time[7]*1||0;if(!ampm&&time[3].length==2&&time[3][0]=="0"){ampm="am"}if(hour<=12&&m){ampm=ampm.trim();var isPm=ampm==this.settings.lang.pm||ampm==this.settings.lang.PM;if(hour==12){hours=isPm?12:0}else{hours=hour+(isPm?12:0)}}else{var t=hour*3600+minutes*60+seconds;if(t>=ONE_DAY+(this.settings.show2400?1:0)){if(this.settings.wrapHours===false){return null}hours=hour%24}}var timeInt=hours*3600+minutes*60+seconds;if(hour<12&&!ampm&&this.settings._twelveHourTime&&this.settings.scrollDefault){var delta=timeInt-this.settings.scrollDefault();if(delta<0&&delta>=ONE_DAY/-2){timeInt=(timeInt+ONE_DAY/2)%ONE_DAY}}return timeInt}},{key:"parseSettings",value:function parseSettings(settings){var _this=this;settings.lang=_objectSpread2(_objectSpread2({},DEFAULT_LANG),settings.lang);this.settings=settings;if(settings.minTime){settings.minTime=this.time2int(settings.minTime)}if(settings.maxTime){settings.maxTime=this.time2int(settings.maxTime)}if(settings.listWidth){settings.listWidth=this.time2int(settings.listWidth)}if(settings.durationTime&&typeof settings.durationTime!=="function"){settings.durationTime=this.time2int(settings.durationTime)}if(settings.scrollDefault=="now"){settings.scrollDefault=function(){return settings.roundingFunction(_this.time2int(new Date),settings)}}else if(settings.scrollDefault&&typeof settings.scrollDefault!="function"){var val=settings.scrollDefault;settings.scrollDefault=function(){return settings.roundingFunction(_this.time2int(val),settings)}}else if(settings.minTime){settings.scrollDefault=function(){return settings.roundingFunction(settings.minTime,settings)}}if(typeof settings.timeFormat==="string"&&settings.timeFormat.match(/[gh]/)){settings._twelveHourTime=true}if(settings.showOnFocus===false&&settings.showOn.indexOf("focus")!=-1){settings.showOn.splice(settings.showOn.indexOf("focus"),1)}if(!settings.disableTimeRanges){settings.disableTimeRanges=[]}if(settings.disableTimeRanges.length>0){for(var i in settings.disableTimeRanges){settings.disableTimeRanges[i]=[this.time2int(settings.disableTimeRanges[i][0]),this.time2int(settings.disableTimeRanges[i][1])]}settings.disableTimeRanges=settings.disableTimeRanges.sort(function(a,b){return a[0]-b[0]});for(var i=settings.disableTimeRanges.length-1;i>0;i--){if(settings.disableTimeRanges[i][0]<=settings.disableTimeRanges[i-1][1]){settings.disableTimeRanges[i-1]=[Math.min(settings.disableTimeRanges[i][0],settings.disableTimeRanges[i-1][0]),Math.max(settings.disableTimeRanges[i][1],settings.disableTimeRanges[i-1][1])];settings.disableTimeRanges.splice(i,1)}}}return settings}},{key:"_disableTextInputHandler",value:function _disableTextInputHandler(e){switch(e.keyCode){case 13:case 9:return;default:e.preventDefault()}}},{key:"_int2duration",value:function _int2duration(seconds,step){seconds=Math.abs(seconds);var minutes=Math.round(seconds/60),duration=[],hours,mins;if(minutes<60){duration=[minutes,this.settings.lang.mins]}else{hours=Math.floor(minutes/60);mins=minutes%60;if(step==30&&mins==30){hours+=this.settings.lang.decimal+5}duration.push(hours);duration.push(hours==1?this.settings.lang.hr:this.settings.lang.hrs);if(step!=30&&mins){duration.push(mins);duration.push(this.settings.lang.mins)}}return duration.join(" ")}},{key:"_roundAndFormatTime",value:function _roundAndFormatTime(seconds){seconds=this.settings.roundingFunction(seconds,this.settings);if(seconds!==null){return this._int2time(seconds)}}},{key:"_int2time",value:function _int2time(timeInt){if(typeof timeInt!="number"){return null}var seconds=parseInt(timeInt%60),minutes=parseInt(timeInt/60%60),hours=parseInt(timeInt/(60*60)%24);var time=new Date(1970,0,2,hours,minutes,seconds,0);if(isNaN(time.getTime())){return null}if(typeof this.settings.timeFormat==="function"){return this.settings.timeFormat(time)}var output="";var hour,code;for(var i=0;i<this.settings.timeFormat.length;i++){code=this.settings.timeFormat.charAt(i);switch(code){case"a":output+=time.getHours()>11?this.settings.lang.pm:this.settings.lang.am;break;case"A":output+=time.getHours()>11?this.settings.lang.PM:this.settings.lang.AM;break;case"g":hour=time.getHours()%12;output+=hour===0?"12":hour;break;case"G":hour=time.getHours();if(timeInt===ONE_DAY)hour=this.settings.show2400?24:0;output+=hour;break;case"h":hour=time.getHours()%12;if(hour!==0&&hour<10){hour="0"+hour}output+=hour===0?"12":hour;break;case"H":hour=time.getHours();if(timeInt===ONE_DAY)hour=this.settings.show2400?24:0;output+=hour>9?hour:"0"+hour;break;case"i":var minutes=time.getMinutes();output+=minutes>9?minutes:"0"+minutes;break;case"s":seconds=time.getSeconds();output+=seconds>9?seconds:"0"+seconds;break;case"\\":i++;output+=this.settings.timeFormat.charAt(i);break;default:output+=code}}return output}},{key:"_setSelected",value:function _setSelected(){var list=this.list;list.find("li").removeClass("ui-em_timepicker-selected");var timeValue=this.time2int(this._getTimeValue());if(timeValue===null){return}var selected=this._findRow(timeValue);if(selected){var selectedRect=selected.getBoundingClientRect();var listRect=list.get(0).getBoundingClientRect();var topDelta=selectedRect.top-listRect.top;if(topDelta+selectedRect.height>listRect.height||topDelta<0){var newScroll=list.scrollTop()+(selectedRect.top-listRect.top)-selectedRect.height;list.scrollTop(newScroll)}var parsed=Number.parseInt(selected.dataset.time);if(this.settings.forceRoundTime||parsed===timeValue){selected.classList.add("ui-em_timepicker-selected")}}}},{key:"_isFocused",value:function _isFocused(el){return el===document.activeElement}},{key:"_handleFormatValue",value:function _handleFormatValue(e){if(e&&e.detail=="em_timepicker"){return}this._formatValue(e)}},{key:"_formatValue",value:function _formatValue(e,origin){if(this.targetEl.value===""){this._setTimeValue(null,origin);return}if(this._isFocused(this.targetEl)&&(!e||e.type!="change")){return}var settings=this.settings;var seconds=this.time2int(this.targetEl.value);if(seconds===null){var timeFormatErrorEvent=new CustomEvent("timeFormatError");this.targetEl.dispatchEvent(timeFormatErrorEvent);return}var rangeError=false;if(settings.minTime!==null&&settings.maxTime!==null&&(seconds<settings.minTime||seconds>settings.maxTime)){rangeError=true}var _iterator=_createForOfIteratorHelper(settings.disableTimeRanges),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var range=_step.value;if(seconds>=range[0]&&seconds<range[1]){rangeError=true;break}}}catch(err){_iterator.e(err)}finally{_iterator.f()}if(settings.forceRoundTime){var roundSeconds=settings.roundingFunction(seconds,settings);if(roundSeconds!=seconds){seconds=roundSeconds;origin=null}}var prettyTime=this._int2time(seconds);if(rangeError){this._setTimeValue(prettyTime);var timeRangeErrorEvent=new CustomEvent("timeRangeError");this.targetEl.dispatchEvent(timeRangeErrorEvent)}else{this._setTimeValue(prettyTime,origin)}}},{key:"_generateNoneElement",value:function _generateNoneElement(optionValue,useSelect){var label,className,value;if(_typeof(optionValue)=="object"){label=optionValue.label;className=optionValue.className;value=optionValue.value}else if(typeof optionValue=="string"){label=optionValue;value=""}else{$.error("Invalid noneOption value")}var el;if(useSelect){el=document.createElement("option");el.value=value}else{el=document.createElement("li");el.dataset.time=String(value)}el.innerText=label;el.classList.add(className);return el}},{key:"_handleKeyUp",value:function _handleKeyUp(e){if(!this.list||!Timepicker.isVisible(this.list)||this.settings.disableTextInput){return true}if(e.type==="paste"||e.type==="cut"){setTimeout(function(){if(this.settings.typeaheadHighlight){this._setSelected()}else{this.list.hide()}},0);return}switch(e.keyCode){case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 77:case 80:case 186:case 8:case 46:if(this.settings.typeaheadHighlight){this._setSelected()}else{this.list.hide()}break}}}],[{key:"extractAttrOptions",value:function extractAttrOptions(element,keys){var output={};var _iterator2=_createForOfIteratorHelper(keys),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var key=_step2.value;if(key in element.dataset){output[key]=element.dataset[key]}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}return output}},{key:"isVisible",value:function isVisible(elem){var el=elem[0];return el.offsetWidth>0&&el.offsetHeight>0}},{key:"hideAll",value:function hideAll(){var _iterator3=_createForOfIteratorHelper(document.getElementsByClassName("ui-em_timepicker-input")),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var el=_step3.value;var tp=el.em_timepickerObj;if(tp){tp.hideMe()}}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}}]);return Timepicker}();(function(factory){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&exports&&(typeof module==="undefined"?"undefined":_typeof(module))==="object"&&module&&module.exports===exports){factory(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){var _lang={};var methods={init:function init(options){return this.each(function(){var self=$(this);var tp=new Timepicker(this,options);var settings=tp.settings;_lang=settings.lang;this.em_timepickerObj=tp;self.addClass("ui-em_timepicker-input");if(settings.useSelect){_render(self)}else{self.prop("autocomplete","off");if(settings.showOn){for(var i in settings.showOn){self.on(settings.showOn[i]+".em_timepicker",methods.show)}}self.on("change.em_timepicker",tp._handleFormatValue);self.on("keydown.em_timepicker",_keydownhandler);self.on("keyup.em_timepicker",tp._handleKeyUp);if(settings.disableTextInput){self.on("keydown.em_timepicker",tp._disableTextInputHandler)}self.on("cut.em_timepicker",tp._handleKeyUp);self.on("paste.em_timepicker",tp._handleKeyUp);tp._formatValue(null,"initial")}})},show:function show(e){var self=$(this);var tp=self[0].em_timepickerObj;var settings=tp.settings;if(e){e.preventDefault()}if(settings.useSelect){tp.list.trigger("focus");return}if(tp._hideKeyboard()){self.trigger("blur")}var list=tp.list;if(self.prop("readonly")){return}if(!list||list.length===0||typeof settings.durationTime==="function"){_render(self);list=tp.list}if(Timepicker.isVisible(list)){return}if(self.is("input")){tp.selectedValue=self.val()}tp._setSelected();Timepicker.hideAll();if(typeof settings.listWidth=="number"){list.width(self.outerWidth()*settings.listWidth)}list.show();var listOffset={};if(settings.orientation.match(/r/)){listOffset.left=self.offset().left+self.outerWidth()-list.outerWidth()+parseInt(list.css("marginLeft").replace("px",""),10)}else if(settings.orientation.match(/l/)){listOffset.left=self.offset().left+parseInt(list.css("marginLeft").replace("px",""),10)}else if(settings.orientation.match(/c/)){listOffset.left=self.offset().left+(self.outerWidth()-list.outerWidth())/2+parseInt(list.css("marginLeft").replace("px",""),10)}var verticalOrientation;if(settings.orientation.match(/t/)){verticalOrientation="t"}else if(settings.orientation.match(/b/)){verticalOrientation="b"}else if(self.offset().top+self.outerHeight(true)+list.outerHeight()>$(window).height()+$(window).scrollTop()){verticalOrientation="t"}else{verticalOrientation="b"}if(verticalOrientation=="t"){list.addClass("ui-em_timepicker-positioned-top");listOffset.top=self.offset().top-list.outerHeight()+parseInt(list.css("marginTop").replace("px",""),10)}else{list.removeClass("ui-em_timepicker-positioned-top");listOffset.top=self.offset().top+self.outerHeight()+parseInt(list.css("marginTop").replace("px",""),10)}list.offset(listOffset);var selected=list.find(".ui-em_timepicker-selected");if(!selected.length){var timeInt=tp.time2int(tp._getTimeValue());if(timeInt!==null){selected=$(tp._findRow(timeInt))}else if(settings.scrollDefault){selected=$(tp._findRow(settings.scrollDefault()))}}if(!selected.length||selected.hasClass("ui-em_timepicker-disabled")){selected=list.find("li:not(.ui-em_timepicker-disabled):first")}if(selected&&selected.length){var topOffset=list.scrollTop()+selected.position().top-selected.outerHeight();list.scrollTop(topOffset)}else{list.scrollTop(0)}if(settings.stopScrollPropagation){$(document).on("wheel.ui-em_timepicker",".ui-em_timepicker-wrapper",function(e){e.preventDefault();var currentScroll=$(this).scrollTop();$(this).scrollTop(currentScroll+e.originalEvent.deltaY)})}$(document).on("mousedown.ui-em_timepicker",_closeHandler);$(window).on("resize.ui-em_timepicker",_closeHandler);if(settings.closeOnWindowScroll){$(document).on("scroll.ui-em_timepicker",_closeHandler)}self.trigger("showTimepicker");return this},hide:function hide(e){var tp=this[0].em_timepickerObj;if(tp){tp.hideMe()}Timepicker.hideAll();return this},option:function option(key,value){if(typeof key=="string"&&typeof value=="undefined"){var tp=this[0].em_timepickerObj;return tp.settings[key]}return this.each(function(){var self=$(this);var tp=self[0].em_timepickerObj;var settings=tp.settings;var list=tp.list;if(_typeof(key)=="object"){settings=$.extend(settings,key)}else if(typeof key=="string"){settings[key]=value}settings=tp.parseSettings(settings);tp.settings=settings;tp._formatValue({type:"change"},"initial");if(list){list.remove();tp.list=null}if(settings.useSelect){_render(self)}})},getSecondsFromMidnight:function getSecondsFromMidnight(){var tp=this[0].em_timepickerObj;return tp.time2int(tp._getTimeValue())},getTime:function getTime(relative_date){var tp=this[0].em_timepickerObj;var time_string=tp._getTimeValue();if(!time_string){return null}var offset=tp.time2int(time_string);if(offset===null){return null}if(!relative_date){relative_date=new Date}var time=new Date(relative_date);time.setHours(offset/3600);time.setMinutes(offset%3600/60);time.setSeconds(offset%60);time.setMilliseconds(0);return time},isVisible:function isVisible(){var tp=this[0].em_timepickerObj;return!!(tp&&tp.list&&Timepicker.isVisible(tp.list))},setTime:function setTime(value){var tp=this[0].em_timepickerObj;var settings=tp.settings;if(settings.forceRoundTime){var prettyTime=tp._roundAndFormatTime(tp.time2int(value))}else{var prettyTime=tp._int2time(tp.time2int(value))}if(value&&prettyTime===null&&settings.noneOption){prettyTime=value}tp._setTimeValue(prettyTime,"initial");tp._formatValue({type:"change"},"initial");if(tp&&tp.list){tp._setSelected()}return this},remove:function remove(){var self=this;if(!self.hasClass("ui-em_timepicker-input")){return}var tp=self[0].em_timepickerObj;var settings=tp.settings;self.removeAttr("autocomplete","off");self.removeClass("ui-em_timepicker-input");self.removeData("em_timepicker-obj");self.off(".em_timepicker");if(tp.list){tp.list.remove()}if(settings.useSelect){self.show()}tp.list=null;return this}};function _render(self){var tp=self[0].em_timepickerObj;var list=tp.list;var settings=tp.settings;if(list&&list.length){list.remove();tp.list=null}if(settings.useSelect){list=$("<select></select>",{class:"ui-em_timepicker-select"});if(self.attr("name")){list.attr("name","ui-em_timepicker-"+self.attr("name"))}var wrapped_list=list}else{list=$("<ul></ul>",{class:"ui-em_timepicker-list"});var wrapped_list=$("<div></div>",{class:"ui-em_timepicker-wrapper",tabindex:-1});wrapped_list.css({display:"none",position:"absolute"}).append(list)}if(settings.noneOption){if(settings.noneOption===true){settings.noneOption=settings.useSelect?"Time...":"None"}if($.isArray(settings.noneOption)){for(var i in settings.noneOption){if(parseInt(i,10)==i){var noneElement=tp._generateNoneElement(settings.noneOption[i],settings.useSelect);list.append(noneElement)}}}else{var noneElement=tp._generateNoneElement(settings.noneOption,settings.useSelect);list.append(noneElement)}}if(settings.className){wrapped_list.addClass(settings.className)}if((settings.minTime!==null||settings.durationTime!==null)&&settings.showDuration){var stepval=typeof settings.step=="function"?"function":settings.step;wrapped_list.addClass("ui-em_timepicker-with-duration");wrapped_list.addClass("ui-em_timepicker-step-"+settings.step)}var durStart=settings.minTime;if(typeof settings.durationTime==="function"){durStart=tp.time2int(settings.durationTime())}else if(settings.durationTime!==null){durStart=settings.durationTime}var start=settings.minTime!==null?settings.minTime:0;var end=settings.maxTime!==null?settings.maxTime:start+ONE_DAY-1;if(end<start){end+=ONE_DAY}if(end===ONE_DAY-1&&$.type(settings.timeFormat)==="string"&&settings.show2400){end=ONE_DAY}var dr=settings.disableTimeRanges;var drCur=0;var drLen=dr.length;var stepFunc=settings.step;if(typeof stepFunc!="function"){stepFunc=function stepFunc(){return settings.step}}for(var i=start,j=0;i<=end;j++,i+=stepFunc(j)*60){var timeInt=i;var timeString=tp._int2time(timeInt);if(settings.useSelect){var row=$("<option></option>",{value:timeString});row.text(timeString)}else{var row=$("<li></li>");row.addClass(timeInt%ONE_DAY<ONE_DAY/2?"ui-em_timepicker-am":"ui-em_timepicker-pm");row.attr("data-time",roundingFunction(timeInt,settings));row.text(timeString)}if((settings.minTime!==null||settings.durationTime!==null)&&settings.showDuration){var durationString=tp._int2duration(i-durStart,settings.step);if(settings.useSelect){row.text(row.text()+" ("+durationString+")")}else{var duration=$("<span></span>",{class:"ui-em_timepicker-duration"});duration.text(" ("+durationString+")");row.append(duration)}}if(drCur<drLen){if(timeInt>=dr[drCur][1]){drCur+=1}if(dr[drCur]&&timeInt>=dr[drCur][0]&&timeInt<dr[drCur][1]){if(settings.useSelect){row.prop("disabled",true)}else{row.addClass("ui-em_timepicker-disabled")}}}list.append(row)}wrapped_list.data("em_timepicker-input",self);tp.list=wrapped_list;if(settings.useSelect){if(self.val()){list.val(tp._roundAndFormatTime(tp.time2int(self.val())))}list.on("focus",function(){$(this).data("em_timepicker-input").trigger("showTimepicker")});list.on("blur",function(){$(this).data("em_timepicker-input").trigger("hideTimepicker")});list.on("change",function(){tp._setTimeValue($(this).val(),"select")});tp._setTimeValue(list.val(),"initial");self.hide().after(list)}else{var appendTo=settings.appendTo;if(typeof appendTo==="string"){appendTo=$(appendTo)}else if(typeof appendTo==="function"){appendTo=appendTo(self)}appendTo.append(wrapped_list);tp._setSelected();list.on("mousedown click","li",function(e){self.off("focus.em_timepicker");self.on("focus.em_timepicker-ie-hack",function(){self.off("focus.em_timepicker-ie-hack");self.on("focus.em_timepicker",methods.show)});if(!tp._hideKeyboard()){self[0].focus()}list.find("li").removeClass("ui-em_timepicker-selected");$(this).addClass("ui-em_timepicker-selected");if(tp._selectValue()){self.trigger("hideTimepicker");list.on("mouseup.em_timepicker click.em_timepicker","li",function(e){list.off("mouseup.em_timepicker click.em_timepicker");wrapped_list.hide()})}})}}function _closeHandler(e){if(e.target==window){return}var target=$(e.target);if(target.closest(".ui-em_timepicker-input").length||target.closest(".ui-em_timepicker-wrapper").length){return}Timepicker.hideAll();$(document).off(".ui-em_timepicker");$(window).off(".ui-em_timepicker")}function _keydownhandler(e){var self=$(this);var tp=self[0].em_timepickerObj;var list=tp.list;if(!list||!Timepicker.isVisible(list)){if(e.keyCode==40){methods.show.call(self.get(0));list=tp.list;if(!tp._hideKeyboard()){self.trigger("focus")}}else{return true}}switch(e.keyCode){case 13:if(tp._selectValue()){tp._formatValue({type:"change"});tp.hideMe()}e.preventDefault();return false;case 38:var selected=list.find(".ui-em_timepicker-selected");if(!selected.length){list.find("li").each(function(i,obj){if($(obj).position().top>0){selected=$(obj);return false}});selected.addClass("ui-em_timepicker-selected")}else if(!selected.is(":first-child")){selected.removeClass("ui-em_timepicker-selected");selected.prev().addClass("ui-em_timepicker-selected");if(selected.prev().position().top<selected.outerHeight()){list.scrollTop(list.scrollTop()-selected.outerHeight())}}return false;case 40:selected=list.find(".ui-em_timepicker-selected");if(selected.length===0){list.find("li").each(function(i,obj){if($(obj).position().top>0){selected=$(obj);return false}});selected.addClass("ui-em_timepicker-selected")}else if(!selected.is(":last-child")){selected.removeClass("ui-em_timepicker-selected");selected.next().addClass("ui-em_timepicker-selected");if(selected.next().position().top+2*selected.outerHeight()>list.outerHeight()){list.scrollTop(list.scrollTop()+selected.outerHeight())}}return false;case 27:list.find("li").removeClass("ui-em_timepicker-selected");tp.hideMe();break;case 9:tp.hideMe();break;default:return true}}$.fn.em_timepicker=function(method){if(!this.length)return this;if(methods[method]){if(!this.hasClass("ui-em_timepicker-input")){return this}return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(_typeof(method)==="object"||!method){return methods.init.apply(this,arguments)}else{$.error("Method "+method+" does not exist on jQuery.em_timepicker")}};$.fn.em_timepicker.defaults=DEFAULT_SETTINGS})})();!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).flatpickr=n()}(this,function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function n(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var a=Array(e),i=0;for(n=0;n<t;n++)for(var o=arguments[n],r=0,l=o.length;r<l;r++,i++)a[i]=o[r];return a}var t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],a={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var n=new Date(e.getTime());n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7);var t=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n){var t;return function(){var a=this,i=arguments;clearTimeout(t),t=setTimeout(function(){return e.apply(a,i)},n)}}var c=function(e){return e instanceof Array?e:[e]};function s(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function d(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){return n(e)?e:e.parentNode?f(e.parentNode,n):void 0}function m(e,n){var t=d("div","numInputWrapper"),a=d("input","numInput "+e),i=d("span","arrowUp"),o=d("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function g(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var p=function(){},h=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},v={D:p,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:p,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:p,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},D={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},w={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[w.w(e,n,t)]},F:function(e,n,t){return h(w.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(w.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return h(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map(function(n,a,o){return w[n]&&"\\"!==o[a-1]?w[n](e,i,t):"\\"!==n?n:""}).join(""):t.formatDate(e,n,i)}},C=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,s=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var d=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(t&&t.parseDate)l=t.parseDate(e,d);else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else{for(var f=void 0,m=[],g=0,p=0,h="";g<d.length;g++){var w=d[g],b="\\"===w,C="\\"===d[g-1]||b;if(D[w]&&!C){h+=D[w];var M=new RegExp(h).exec(e);M&&(f=!0)&&m["Y"!==w?"push":"unshift"]({fn:v[w],val:M[++p]})}else b||(h+=".")}l=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),m.forEach(function(e){var n=e.fn,t=e.val;return l=n(l,t,c)||l}),l=f?l:void 0}}if(l instanceof Date&&!isNaN(l.getTime()))return!0===i&&l.setHours(0,0,0,0),l;t.errorHandler(new Error("Invalid date provided: "+s))}}};function M(e,n,t){return void 0===t&&(t=!0),!1!==t?new Date(e.getTime()).setHours(0,0,0,0)-new Date(n.getTime()).setHours(0,0,0,0):e.getTime()-n.getTime()}var y=function(e,n,t){return 3600*e+60*n+t},x=864e5;function E(e){var n=e.defaultHour,t=e.defaultMinute,a=e.defaultSeconds;if(void 0!==e.minDate){var i=e.minDate.getHours(),o=e.minDate.getMinutes(),r=e.minDate.getSeconds();n<i&&(n=i),n===i&&t<o&&(t=o),n===i&&t===o&&a<r&&(a=e.minDate.getSeconds())}if(void 0!==e.maxDate){var l=e.maxDate.getHours(),c=e.maxDate.getMinutes();(n=Math.min(n,l))===l&&(t=Math.min(c,t)),n===l&&t===c&&(a=e.maxDate.getSeconds())}return{hours:n,minutes:t,seconds:a}}"function"!=typeof Object.assign&&(Object.assign=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var a=function(n){n&&Object.keys(n).forEach(function(t){return e[t]=n[t]})},i=0,o=n;i<o.length;i++){var r=o[i];a(r)}return e});function k(p,v){var w={config:e(e({},a),I.defaultConfig),l10n:i};function k(){var e;return(null===(e=w.calendarContainer)||void 0===e?void 0:e.getRootNode()).activeElement||document.activeElement}function T(e){return e.bind(w)}function S(){var e=w.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame(function(){if(void 0!==w.calendarContainer&&(w.calendarContainer.style.visibility="hidden",w.calendarContainer.style.display="block"),void 0!==w.daysContainer){var n=(w.days.offsetWidth+1)*e.showMonths;w.daysContainer.style.width=n+"px",w.calendarContainer.style.width=n+(void 0!==w.weekWrapper?w.weekWrapper.offsetWidth:0)+"px",w.calendarContainer.style.removeProperty("visibility"),w.calendarContainer.style.removeProperty("display")}})}function _(e){if(0===w.selectedDates.length){var n=void 0===w.config.minDate||M(new Date,w.config.minDate)>=0?new Date:new Date(w.config.minDate.getTime()),t=E(w.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),w.selectedDates=[n],w.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=g(e),a=t;void 0!==w.amPM&&t===w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]);var i=parseFloat(a.getAttribute("min")),l=parseFloat(a.getAttribute("max")),c=parseFloat(a.getAttribute("step")),s=parseInt(a.value,10),d=e.delta||(n?38===e.which?1:-1:0),u=s+c*d;if(void 0!==a.value&&2===a.value.length){var f=a===w.hourElement,m=a===w.minuteElement;u<i?(u=l+u+r(!f)+(r(f)&&r(!w.amPM)),m&&L(void 0,-1,w.hourElement)):u>l&&(u=a===w.hourElement?u-l-r(!w.amPM):i,m&&L(void 0,1,w.hourElement)),w.amPM&&f&&(1===c?u+s===23:Math.abs(u-s)>c)&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]),a.value=o(u)}}(e);var a=w._input.value;O(),ye(),w._input.value!==a&&w._debouncedChange()}function O(){if(void 0!==w.hourElement&&void 0!==w.minuteElement){var e,n,t=(parseInt(w.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(w.minuteElement.value,10)||0)%60,i=void 0!==w.secondElement?(parseInt(w.secondElement.value,10)||0)%60:0;void 0!==w.amPM&&(e=t,n=w.amPM.textContent,t=e%12+12*r(n===w.l10n.amPM[1]));var o=void 0!==w.config.minTime||w.config.minDate&&w.minDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.minDate,!0),l=void 0!==w.config.maxTime||w.config.maxDate&&w.maxDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.maxDate,!0);if(void 0!==w.config.maxTime&&void 0!==w.config.minTime&&w.config.minTime>w.config.maxTime){var c=y(w.config.minTime.getHours(),w.config.minTime.getMinutes(),w.config.minTime.getSeconds()),s=y(w.config.maxTime.getHours(),w.config.maxTime.getMinutes(),w.config.maxTime.getSeconds()),d=y(t,a,i);if(d>s&&d<c){var u=function(e){var n=Math.floor(e/3600),t=(e-3600*n)/60;return[n,t,e-3600*n-60*t]}(c);t=u[0],a=u[1],i=u[2]}}else{if(l){var f=void 0!==w.config.maxTime?w.config.maxTime:w.config.maxDate;(t=Math.min(t,f.getHours()))===f.getHours()&&(a=Math.min(a,f.getMinutes())),a===f.getMinutes()&&(i=Math.min(i,f.getSeconds()))}if(o){var m=void 0!==w.config.minTime?w.config.minTime:w.config.minDate;(t=Math.max(t,m.getHours()))===m.getHours()&&a<m.getMinutes()&&(a=m.getMinutes()),a===m.getMinutes()&&(i=Math.max(i,m.getSeconds()))}}A(t,a,i)}}function F(e){var n=e||w.latestSelectedDateObj;n&&n instanceof Date&&A(n.getHours(),n.getMinutes(),n.getSeconds())}function A(e,n,t){void 0!==w.latestSelectedDateObj&&w.latestSelectedDateObj.setHours(e%24,n,t||0,0),w.hourElement&&w.minuteElement&&!w.isMobile&&(w.hourElement.value=o(w.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),w.minuteElement.value=o(n),void 0!==w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(e>=12)]),void 0!==w.secondElement&&(w.secondElement.value=o(t)))}function N(e){var n=g(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&ee(t)}function P(e,n,t,a){return n instanceof Array?n.forEach(function(n){return P(e,n,t,a)}):e instanceof Array?e.forEach(function(e){return P(e,n,t,a)}):(e.addEventListener(n,t,a),void w._handlers.push({remove:function(){return e.removeEventListener(n,t,a)}}))}function Y(){De("onChange")}function j(e,n){var t=void 0!==e?w.parseDate(e):w.latestSelectedDateObj||(w.config.minDate&&w.config.minDate>w.now?w.config.minDate:w.config.maxDate&&w.config.maxDate<w.now?w.config.maxDate:w.now),a=w.currentYear,i=w.currentMonth;try{void 0!==t&&(w.currentYear=t.getFullYear(),w.currentMonth=t.getMonth())}catch(e){e.message="Invalid date supplied: "+t,w.config.errorHandler(e)}n&&w.currentYear!==a&&(De("onYearChange"),q()),!n||w.currentYear===a&&w.currentMonth===i||De("onMonthChange"),w.redraw()}function H(e){var n=g(e);~n.className.indexOf("arrow")&&L(e,n.classList.contains("arrowUp")?1:-1)}function L(e,n,t){var a=e&&g(e),i=t||a&&a.parentNode&&a.parentNode.firstChild,o=we("increment");o.delta=n,i&&i.dispatchEvent(o)}function R(e,n,t,a){var i=ne(n,!0),o=d("span",e,n.getDate().toString());return o.dateObj=n,o.$i=a,o.setAttribute("aria-label",w.formatDate(n,w.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===M(n,w.now)&&(w.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,be(n)&&(o.classList.add("selected"),w.selectedDateElem=o,"range"===w.config.mode&&(s(o,"startRange",w.selectedDates[0]&&0===M(n,w.selectedDates[0],!0)),s(o,"endRange",w.selectedDates[1]&&0===M(n,w.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===w.config.mode&&function(e){return!("range"!==w.config.mode||w.selectedDates.length<2)&&(M(e,w.selectedDates[0])>=0&&M(e,w.selectedDates[1])<=0)}(n)&&!be(n)&&o.classList.add("inRange"),w.weekNumbers&&1===w.config.showMonths&&"prevMonthDay"!==e&&a%7==6&&w.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+w.config.getWeek(n)+"</span>"),De("onDayCreate",o),o}function W(e){e.focus(),"range"===w.config.mode&&oe(e)}function B(e){for(var n=e>0?0:w.config.showMonths-1,t=e>0?w.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=w.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&ne(c.dateObj))return c}}function J(e,n){var t=k(),a=te(t||document.body),i=void 0!==e?e:a?t:void 0!==w.selectedDateElem&&te(w.selectedDateElem)?w.selectedDateElem:void 0!==w.todayDateElem&&te(w.todayDateElem)?w.todayDateElem:B(n>0?1:-1);void 0===i?w._input.focus():a?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():w.currentMonth,a=n>0?w.config.showMonths:-1,i=n>0?1:-1,o=t-w.currentMonth;o!=a;o+=i)for(var r=w.daysContainer.children[o],l=t-w.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,s=l;s>=0&&s<c&&s!=(n>0?c:-1);s+=i){var d=r.children[s];if(-1===d.className.indexOf("hidden")&&ne(d.dateObj)&&Math.abs(e.$i-s)>=Math.abs(n))return W(d)}w.changeMonth(i),J(B(i),0)}(i,n):W(i)}function K(e,n){for(var t=(new Date(e,n,1).getDay()-w.l10n.firstDayOfWeek+7)%7,a=w.utils.getDaysInMonth((n-1+12)%12,e),i=w.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=w.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",s=a+1-t,u=0;s<=a;s++,u++)o.appendChild(R("flatpickr-day "+l,new Date(e,n-1,s),0,u));for(s=1;s<=i;s++,u++)o.appendChild(R("flatpickr-day",new Date(e,n,s),0,u));for(var f=i+1;f<=42-t&&(1===w.config.showMonths||u%7!=0);f++,u++)o.appendChild(R("flatpickr-day "+c,new Date(e,n+1,f%i),0,u));var m=d("div","dayContainer");return m.appendChild(o),m}function U(){if(void 0!==w.daysContainer){u(w.daysContainer),w.weekNumbers&&u(w.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n<w.config.showMonths;n++){var t=new Date(w.currentYear,w.currentMonth,1);t.setMonth(w.currentMonth+n),e.appendChild(K(t.getFullYear(),t.getMonth()))}w.daysContainer.appendChild(e),w.days=w.daysContainer.firstChild,"range"===w.config.mode&&1===w.selectedDates.length&&oe()}}function q(){if(!(w.config.showMonths>1||"dropdown"!==w.config.monthSelectorType)){var e=function(e){return!(void 0!==w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&e<w.config.minDate.getMonth())&&!(void 0!==w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()&&e>w.config.maxDate.getMonth())};w.monthsDropdownContainer.tabIndex=-1,w.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=d("option","flatpickr-monthDropdown-month");t.value=new Date(w.currentYear,n).getMonth().toString(),t.textContent=h(n,w.config.shorthandCurrentMonth,w.l10n),t.tabIndex=-1,w.currentMonth===n&&(t.selected=!0),w.monthsDropdownContainer.appendChild(t)}}}function $(){var e,n=d("div","flatpickr-month"),t=window.document.createDocumentFragment();w.config.showMonths>1||"static"===w.config.monthSelectorType?e=d("span","cur-month"):(w.monthsDropdownContainer=d("select","flatpickr-monthDropdown-months"),w.monthsDropdownContainer.setAttribute("aria-label",w.l10n.monthAriaLabel),P(w.monthsDropdownContainer,"change",function(e){var n=g(e),t=parseInt(n.value,10);w.changeMonth(t-w.currentMonth),De("onMonthChange")}),q(),e=w.monthsDropdownContainer);var a=m("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",w.l10n.yearAriaLabel),w.config.minDate&&i.setAttribute("min",w.config.minDate.getFullYear().toString()),w.config.maxDate&&(i.setAttribute("max",w.config.maxDate.getFullYear().toString()),i.disabled=!!w.config.minDate&&w.config.minDate.getFullYear()===w.config.maxDate.getFullYear());var o=d("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function V(){u(w.monthNav),w.monthNav.appendChild(w.prevMonthNav),w.config.showMonths&&(w.yearElements=[],w.monthElements=[]);for(var e=w.config.showMonths;e--;){var n=$();w.yearElements.push(n.yearElement),w.monthElements.push(n.monthElement),w.monthNav.appendChild(n.container)}w.monthNav.appendChild(w.nextMonthNav)}function z(){w.weekdayContainer?u(w.weekdayContainer):w.weekdayContainer=d("div","flatpickr-weekdays");for(var e=w.config.showMonths;e--;){var n=d("div","flatpickr-weekdaycontainer");w.weekdayContainer.appendChild(n)}return G(),w.weekdayContainer}function G(){if(w.weekdayContainer){var e=w.l10n.firstDayOfWeek,t=n(w.l10n.weekdays.shorthand);e>0&&e<t.length&&(t=n(t.splice(e,t.length),t.splice(0,e)));for(var a=w.config.showMonths;a--;)w.weekdayContainer.children[a].innerHTML="\n <span class='flatpickr-weekday'>\n "+t.join("</span><span class='flatpickr-weekday'>")+"\n </span>\n "}}function Z(e,n){void 0===n&&(n=!0);var t=n?e:e-w.currentMonth;t<0&&!0===w._hidePrevMonthArrow||t>0&&!0===w._hideNextMonthArrow||(w.currentMonth+=t,(w.currentMonth<0||w.currentMonth>11)&&(w.currentYear+=w.currentMonth>11?1:-1,w.currentMonth=(w.currentMonth+12)%12,De("onYearChange"),q()),U(),De("onMonthChange"),Ce())}function Q(e){return w.calendarContainer.contains(e)}function X(e){if(w.isOpen&&!w.config.inline){var n=g(e),t=Q(n),a=!(n===w.input||n===w.altInput||w.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(w.input)||~e.path.indexOf(w.altInput)))&&!t&&!Q(e.relatedTarget),i=!w.config.ignoredFocusElements.some(function(e){return e.contains(n)});a&&i&&(w.config.allowInput&&w.setDate(w._input.value,!1,w.config.altInput?w.config.altFormat:w.config.dateFormat),void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement&&""!==w.input.value&&void 0!==w.input.value&&_(),w.close(),w.config&&"range"===w.config.mode&&1===w.selectedDates.length&&w.clear(!1))}}function ee(e){if(!(!e||w.config.minDate&&e<w.config.minDate.getFullYear()||w.config.maxDate&&e>w.config.maxDate.getFullYear())){var n=e,t=w.currentYear!==n;w.currentYear=n||w.currentYear,w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth=Math.min(w.config.maxDate.getMonth(),w.currentMonth):w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&(w.currentMonth=Math.max(w.config.minDate.getMonth(),w.currentMonth)),t&&(w.redraw(),De("onYearChange"),q())}}function ne(e,n){var t;void 0===n&&(n=!0);var a=w.parseDate(e,void 0,n);if(w.config.minDate&&a&&M(a,w.config.minDate,void 0!==n?n:!w.minDateHasTime)<0||w.config.maxDate&&a&&M(a,w.config.maxDate,void 0!==n?n:!w.maxDateHasTime)>0)return!1;if(!w.config.enable&&0===w.config.disable.length)return!0;if(void 0===a)return!1;for(var i=!!w.config.enable,o=null!==(t=w.config.enable)&&void 0!==t?t:w.config.disable,r=0,l=void 0;r<o.length;r++){if("function"==typeof(l=o[r])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l){var c=w.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.getTime()<=l.to.getTime())return i}return!i}function te(e){return void 0!==w.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&w.daysContainer.contains(e))}function ae(e){var n=e.target===w._input,t=w._input.value.trimEnd()!==Me();!n||!t||e.relatedTarget&&Q(e.relatedTarget)||w.setDate(w._input.value,!0,e.target===w.altInput?w.config.altFormat:w.config.dateFormat)}function ie(e){var n=g(e),t=w.config.wrap?p.contains(n):n===w._input,a=w.config.allowInput,i=w.isOpen&&(!a||!t),o=w.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return w.setDate(w._input.value,!0,n===w.altInput?w.config.altFormat:w.config.dateFormat),w.close(),n.blur();w.open()}else if(Q(n)||i||o){var r=!!w.timeContainer&&w.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),_(),fe()):me(e);break;case 27:e.preventDefault(),fe();break;case 8:case 46:t&&!w.config.allowInput&&(e.preventDefault(),w.clear());break;case 37:case 39:if(r||t)w.hourElement&&w.hourElement.focus();else{e.preventDefault();var l=k();if(void 0!==w.daysContainer&&(!1===a||l&&te(l))){var c=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),Z(c),J(B(1),0)):J(void 0,c)}}break;case 38:case 40:e.preventDefault();var s=40===e.keyCode?1:-1;w.daysContainer&&void 0!==n.$i||n===w.input||n===w.altInput?e.ctrlKey?(e.stopPropagation(),ee(w.currentYear-s),J(B(1),0)):r||J(void 0,7*s):n===w.currentYearElement?ee(w.currentYear-s):w.config.enableTime&&(!r&&w.hourElement&&w.hourElement.focus(),_(e),w._debouncedChange());break;case 9:if(r){var d=[w.hourElement,w.minuteElement,w.secondElement,w.amPM].concat(w.pluginElements).filter(function(e){return e}),u=d.indexOf(n);if(-1!==u){var f=d[u+(e.shiftKey?-1:1)];e.preventDefault(),(f||w._input).focus()}}else!w.config.noCalendar&&w.daysContainer&&w.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),w._input.focus())}}if(void 0!==w.amPM&&n===w.amPM)switch(e.key){case w.l10n.amPM[0].charAt(0):case w.l10n.amPM[0].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[0],O(),ye();break;case w.l10n.amPM[1].charAt(0):case w.l10n.amPM[1].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[1],O(),ye()}(t||Q(n))&&De("onKeyDown",e)}function oe(e,n){if(void 0===n&&(n="flatpickr-day"),1===w.selectedDates.length&&(!e||e.classList.contains(n)&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():w.days.firstElementChild.dateObj.getTime(),a=w.parseDate(w.selectedDates[0],void 0,!0).getTime(),i=Math.min(t,w.selectedDates[0].getTime()),o=Math.max(t,w.selectedDates[0].getTime()),r=!1,l=0,c=0,s=i;s<o;s+=x)ne(new Date(s),!0)||(r=r||s>i&&s<o,s<a&&(!l||s>l)?l=s:s>a&&(!c||s<c)&&(c=s));Array.from(w.rContainer.querySelectorAll("*:nth-child(-n+"+w.config.showMonths+") > ."+n)).forEach(function(n){var i,o,s,d=n.dateObj.getTime(),u=l>0&&d<l||c>0&&d>c;if(u)return n.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach(function(e){n.classList.remove(e)});r&&!u||(["startRange","inRange","endRange","notAllowed"].forEach(function(e){n.classList.remove(e)}),void 0!==e&&(e.classList.add(t<=w.selectedDates[0].getTime()?"startRange":"endRange"),a<t&&d===a?n.classList.add("startRange"):a>t&&d===a&&n.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=a,s=t,(i=d)>Math.min(o,s)&&i<Math.max(o,s))&&n.classList.add("inRange")))})}}function re(){!w.isOpen||w.config.static||w.config.inline||de()}function le(e){return function(n){var t=w.config["_"+e+"Date"]=w.parseDate(n,w.config.dateFormat),a=w.config["_"+("min"===e?"max":"min")+"Date"];void 0!==t&&(w["min"===e?"minDateHasTime":"maxDateHasTime"]=t.getHours()>0||t.getMinutes()>0||t.getSeconds()>0),w.selectedDates&&(w.selectedDates=w.selectedDates.filter(function(e){return ne(e)}),w.selectedDates.length||"min"!==e||F(t),ye()),w.daysContainer&&(ue(),void 0!==t?w.currentYearElement[e]=t.getFullYear().toString():w.currentYearElement.removeAttribute(e),w.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function ce(){return w.config.wrap?p.querySelector("[data-input]"):p}function se(){"object"!=typeof w.config.locale&&void 0===I.l10ns[w.config.locale]&&w.config.errorHandler(new Error("flatpickr: invalid locale "+w.config.locale)),w.l10n=e(e({},I.l10ns.default),"object"==typeof w.config.locale?w.config.locale:"default"!==w.config.locale?I.l10ns[w.config.locale]:void 0),D.D="("+w.l10n.weekdays.shorthand.join("|")+")",D.l="("+w.l10n.weekdays.longhand.join("|")+")",D.M="("+w.l10n.months.shorthand.join("|")+")",D.F="("+w.l10n.months.longhand.join("|")+")",D.K="("+w.l10n.amPM[0]+"|"+w.l10n.amPM[1]+"|"+w.l10n.amPM[0].toLowerCase()+"|"+w.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},v),JSON.parse(JSON.stringify(p.dataset||{}))).time_24hr&&void 0===I.defaultConfig.time_24hr&&(w.config.time_24hr=w.l10n.time_24hr),w.formatDate=b(w),w.parseDate=C({config:w.config,l10n:w.l10n})}function de(e){if("function"!=typeof w.config.position){if(void 0!==w.calendarContainer){De("onPreCalendarPosition");var n=e||w._positionElement,t=Array.prototype.reduce.call(w.calendarContainer.children,function(e,n){return e+n.offsetHeight},0),a=w.calendarContainer.offsetWidth,i=w.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,d="above"===o||"below"!==o&&c<t&&l.top>t,u=window.pageYOffset+l.top+(d?-t-2:n.offsetHeight+2);if(s(w.calendarContainer,"arrowTop",!d),s(w.calendarContainer,"arrowBottom",d),!w.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),s(w.calendarContainer,"arrowLeft",!m&&!g),s(w.calendarContainer,"arrowCenter",m),s(w.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(s(w.calendarContainer,"rightMost",h),!w.config.static)if(w.calendarContainer.style.top=u+"px",h)if(v){var D=function(){for(var e=null,n=0;n<document.styleSheets.length;n++){var t=document.styleSheets[n];if(t.cssRules){try{t.cssRules}catch(e){continue}e=t;break}}return null!=e?e:(a=document.createElement("style"),document.head.appendChild(a),a.sheet);var a}();if(void 0===D)return;var b=window.document.body.offsetWidth,C=Math.max(0,b/2-a/2),M=D.cssRules.length,y="{left:"+l.left+"px;right:auto;}";s(w.calendarContainer,"rightMost",!1),s(w.calendarContainer,"centerMost",!0),D.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+y,M),w.calendarContainer.style.left=C+"px",w.calendarContainer.style.right="auto"}else w.calendarContainer.style.left="auto",w.calendarContainer.style.right=p+"px";else w.calendarContainer.style.left=f+"px",w.calendarContainer.style.right="auto"}}}else w.config.position(w,e)}function ue(){w.config.noCalendar||w.isMobile||(q(),Ce(),U())}function fe(){w._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(w.close,0):w.close()}function me(e){e.preventDefault(),e.stopPropagation();var n=f(g(e),function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")});if(void 0!==n){var t=n,a=w.latestSelectedDateObj=new Date(t.dateObj.getTime()),i=(a.getMonth()<w.currentMonth||a.getMonth()>w.currentMonth+w.config.showMonths-1)&&"range"!==w.config.mode;if(w.selectedDateElem=t,"single"===w.config.mode)w.selectedDates=[a];else if("multiple"===w.config.mode){var o=be(a);o?w.selectedDates.splice(parseInt(o),1):w.selectedDates.push(a)}else"range"===w.config.mode&&(2===w.selectedDates.length&&w.clear(!1,!1),w.latestSelectedDateObj=a,w.selectedDates.push(a),0!==M(a,w.selectedDates[0],!0)&&w.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()}));if(O(),i){var r=w.currentYear!==a.getFullYear();w.currentYear=a.getFullYear(),w.currentMonth=a.getMonth(),r&&(De("onYearChange"),q()),De("onMonthChange")}if(Ce(),U(),ye(),i||"range"===w.config.mode||1!==w.config.showMonths?void 0!==w.selectedDateElem&&void 0===w.hourElement&&w.selectedDateElem&&w.selectedDateElem.focus():W(t),void 0!==w.hourElement&&void 0!==w.hourElement&&w.hourElement.focus(),w.config.closeOnSelect){var l="single"===w.config.mode&&!w.config.enableTime,c="range"===w.config.mode&&2===w.selectedDates.length&&!w.config.enableTime;(l||c)&&fe()}Y()}}w.parseDate=C({config:w.config,l10n:w.l10n}),w._handlers=[],w.pluginElements=[],w.loadedPlugins=[],w._bind=P,w._setHoursFromDate=F,w._positionCalendar=de,w.changeMonth=Z,w.changeYear=ee,w.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);w.input.value="",void 0!==w.altInput&&(w.altInput.value="");void 0!==w.mobileInput&&(w.mobileInput.value="");w.selectedDates=[],w.latestSelectedDateObj=void 0,!0===n&&(w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth());if(!0===w.config.enableTime){var t=E(w.config),a=t.hours,i=t.minutes,o=t.seconds;A(a,i,o)}w.redraw(),e&&De("onChange")},w.close=function(){w.isOpen=!1,w.isMobile||(void 0!==w.calendarContainer&&w.calendarContainer.classList.remove("open"),void 0!==w._input&&w._input.classList.remove("active"));De("onClose")},w.onMouseOver=oe,w._createElement=d,w.createDay=R,w.destroy=function(){void 0!==w.config&&De("onDestroy");for(var e=w._handlers.length;e--;)w._handlers[e].remove();if(w._handlers=[],w.mobileInput)w.mobileInput.parentNode&&w.mobileInput.parentNode.removeChild(w.mobileInput),w.mobileInput=void 0;else if(w.calendarContainer&&w.calendarContainer.parentNode)if(w.config.static&&w.calendarContainer.parentNode){var n=w.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else w.calendarContainer.parentNode.removeChild(w.calendarContainer);w.altInput&&(w.input.type="text",w.altInput.parentNode&&w.altInput.parentNode.removeChild(w.altInput),delete w.altInput);w.input&&(w.input.type=w.input._type,w.input.classList.remove("flatpickr-input"),w.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete w[e]}catch(e){}})},w.isEnabled=ne,w.jumpToDate=j,w.updateValue=ye,w.open=function(e,n){void 0===n&&(n=w._positionElement);if(!0===w.isMobile){if(e){e.preventDefault();var t=g(e);t&&t.blur()}return void 0!==w.mobileInput&&(w.mobileInput.focus(),w.mobileInput.click()),void De("onOpen")}if(w._input.disabled||w.config.inline)return;var a=w.isOpen;w.isOpen=!0,a||(w.calendarContainer.classList.add("open"),w._input.classList.add("active"),De("onOpen"),de(n));!0===w.config.enableTime&&!0===w.config.noCalendar&&(!1!==w.config.allowInput||void 0!==e&&w.timeContainer.contains(e.relatedTarget)||setTimeout(function(){return w.hourElement.select()},50))},w.redraw=ue,w.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(w.config,e),e)void 0!==ge[a]&&ge[a].forEach(function(e){return e()});else w.config[e]=n,void 0!==ge[e]?ge[e].forEach(function(e){return e()}):t.indexOf(e)>-1&&(w.config[e]=c(n));w.redraw(),ye(!0)},w.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=w.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return w.clear(n);pe(e,t),w.latestSelectedDateObj=w.selectedDates[w.selectedDates.length-1],w.redraw(),j(void 0,n),F(),0===w.selectedDates.length&&w.clear(!1);ye(n),n&&De("onChange")},w.toggle=function(e){if(!0===w.isOpen)return w.close();w.open(e)};var ge={locale:[se,G],showMonths:[V,S,z],minDate:[j],maxDate:[j],positionElement:[ve],clickOpens:[function(){!0===w.config.clickOpens?(P(w._input,"focus",w.open),P(w._input,"click",w.open)):(w._input.removeEventListener("focus",w.open),w._input.removeEventListener("click",w.open))}]};function pe(e,n){var t=[];if(e instanceof Array)t=e.map(function(e){return w.parseDate(e,n)});else if(e instanceof Date||"number"==typeof e)t=[w.parseDate(e,n)];else if("string"==typeof e)switch(w.config.mode){case"single":case"time":t=[w.parseDate(e,n)];break;case"multiple":t=e.split(w.config.conjunction).map(function(e){return w.parseDate(e,n)});break;case"range":t=e.split(w.l10n.rangeSeparator).map(function(e){return w.parseDate(e,n)})}else w.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));w.selectedDates=w.config.allowInvalidPreload?t:t.filter(function(e){return e instanceof Date&&ne(e,!1)}),"range"===w.config.mode&&w.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()})}function he(e){return e.slice().map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?w.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:w.parseDate(e.from,void 0),to:w.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function ve(){w._positionElement=w.config.positionElement||w._input}function De(e,n){if(void 0!==w.config){var t=w.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a<t.length;a++)t[a](w.selectedDates,w.input.value,w,n);"onChange"===e&&(w.input.dispatchEvent(we("change")),w.input.dispatchEvent(we("input")))}}function we(e){var n=document.createEvent("Event");return n.initEvent(e,!0,!0),n}function be(e){for(var n=0;n<w.selectedDates.length;n++){var t=w.selectedDates[n];if(t instanceof Date&&0===M(t,e))return""+n}return!1}function Ce(){w.config.noCalendar||w.isMobile||!w.monthNav||(w.yearElements.forEach(function(e,n){var t=new Date(w.currentYear,w.currentMonth,1);t.setMonth(w.currentMonth+n),w.config.showMonths>1||"static"===w.config.monthSelectorType?w.monthElements[n].textContent=h(t.getMonth(),w.config.shorthandCurrentMonth,w.l10n)+" ":w.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()}),w._hidePrevMonthArrow=void 0!==w.config.minDate&&(w.currentYear===w.config.minDate.getFullYear()?w.currentMonth<=w.config.minDate.getMonth():w.currentYear<w.config.minDate.getFullYear()),w._hideNextMonthArrow=void 0!==w.config.maxDate&&(w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth+1>w.config.maxDate.getMonth():w.currentYear>w.config.maxDate.getFullYear()))}function Me(e){var n=e||(w.config.altInput?w.config.altFormat:w.config.dateFormat);return w.selectedDates.map(function(e){return w.formatDate(e,n)}).filter(function(e,n,t){return"range"!==w.config.mode||w.config.enableTime||t.indexOf(e)===n}).join("range"!==w.config.mode?w.config.conjunction:w.l10n.rangeSeparator)}function ye(e){void 0===e&&(e=!0),void 0!==w.mobileInput&&w.mobileFormatStr&&(w.mobileInput.value=void 0!==w.latestSelectedDateObj?w.formatDate(w.latestSelectedDateObj,w.mobileFormatStr):""),w.input.value=Me(w.config.dateFormat),void 0!==w.altInput&&(w.altInput.value=Me(w.config.altFormat)),!1!==e&&De("onValueUpdate")}function xe(e){var n=g(e),t=w.prevMonthNav.contains(n),a=w.nextMonthNav.contains(n);t||a?Z(t?-1:1):w.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?w.changeYear(w.currentYear+1):n.classList.contains("arrowDown")&&w.changeYear(w.currentYear-1)}return function(){w.element=w.input=p,w.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(p.dataset||{}))),v),o={};w.config.parseDate=i.parseDate,w.config.formatDate=i.formatDate,Object.defineProperty(w.config,"enable",{get:function(){return w.config._enable},set:function(e){w.config._enable=he(e)}}),Object.defineProperty(w.config,"disable",{get:function(){return w.config._disable},set:function(e){w.config._disable=he(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=I.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var s=I.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):s+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(w.config,"minDate",{get:function(){return w.config._minDate},set:le("min")}),Object.defineProperty(w.config,"maxDate",{get:function(){return w.config._maxDate},set:le("max")});var d=function(e){return function(n){w.config["min"===e?"_minTime":"_maxTime"]=w.parseDate(n,"H:i:S")}};Object.defineProperty(w.config,"minTime",{get:function(){return w.config._minTime},set:d("min")}),Object.defineProperty(w.config,"maxTime",{get:function(){return w.config._maxTime},set:d("max")}),"time"===i.mode&&(w.config.noCalendar=!0,w.config.enableTime=!0);Object.assign(w.config,o,i);for(var u=0;u<n.length;u++)w.config[n[u]]=!0===w.config[n[u]]||"true"===w.config[n[u]];t.filter(function(e){return void 0!==w.config[e]}).forEach(function(e){w.config[e]=c(w.config[e]||[]).map(T)}),w.isMobile=!w.config.disableMobile&&!w.config.inline&&"single"===w.config.mode&&!w.config.disable.length&&!w.config.enable&&!w.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(u=0;u<w.config.plugins.length;u++){var f=w.config.plugins[u](w)||{};for(var m in f)t.indexOf(m)>-1?w.config[m]=c(f[m]).map(T).concat(w.config[m]):void 0===i[m]&&(w.config[m]=f[m])}i.altInputClass||(w.config.altInputClass=ce().className+" "+w.config.altInputClass);De("onParseConfig")}(),se(),function(){if(w.input=ce(),!w.input)return void w.config.errorHandler(new Error("Invalid input element specified"));w.input._type=w.input.type,w.input.type="text",w.input.classList.add("flatpickr-input"),w._input=w.input,w.config.altInput&&(w.altInput=d(w.input.nodeName,w.config.altInputClass),w._input=w.altInput,w.altInput.placeholder=w.input.placeholder,w.altInput.disabled=w.input.disabled,w.altInput.required=w.input.required,w.altInput.tabIndex=w.input.tabIndex,w.altInput.type="text",w.input.setAttribute("type","hidden"),!w.config.static&&w.input.parentNode&&w.input.parentNode.insertBefore(w.altInput,w.input.nextSibling));w.config.allowInput||w._input.setAttribute("readonly","readonly");ve()}(),function(){w.selectedDates=[],w.now=w.parseDate(w.config.now)||new Date;var e=w.config.defaultDate||("INPUT"!==w.input.nodeName&&"TEXTAREA"!==w.input.nodeName||!w.input.placeholder||w.input.value!==w.input.placeholder?w.input.value:null);e&&pe(e,w.config.dateFormat);w._initialDate=w.selectedDates.length>0?w.selectedDates[0]:w.config.minDate&&w.config.minDate.getTime()>w.now.getTime()?w.config.minDate:w.config.maxDate&&w.config.maxDate.getTime()<w.now.getTime()?w.config.maxDate:w.now,w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth(),w.selectedDates.length>0&&(w.latestSelectedDateObj=w.selectedDates[0]);void 0!==w.config.minTime&&(w.config.minTime=w.parseDate(w.config.minTime,"H:i"));void 0!==w.config.maxTime&&(w.config.maxTime=w.parseDate(w.config.maxTime,"H:i"));w.minDateHasTime=!!w.config.minDate&&(w.config.minDate.getHours()>0||w.config.minDate.getMinutes()>0||w.config.minDate.getSeconds()>0),w.maxDateHasTime=!!w.config.maxDate&&(w.config.maxDate.getHours()>0||w.config.maxDate.getMinutes()>0||w.config.maxDate.getSeconds()>0)}(),w.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=w.currentMonth),void 0===n&&(n=w.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:w.l10n.daysInMonth[e]}},w.isMobile||function(){var e=window.document.createDocumentFragment();if(w.calendarContainer=d("div","flatpickr-calendar"),w.calendarContainer.tabIndex=-1,!w.config.noCalendar){if(e.appendChild((w.monthNav=d("div","flatpickr-months"),w.yearElements=[],w.monthElements=[],w.prevMonthNav=d("span","flatpickr-prev-month"),w.prevMonthNav.innerHTML=w.config.prevArrow,w.nextMonthNav=d("span","flatpickr-next-month"),w.nextMonthNav.innerHTML=w.config.nextArrow,V(),Object.defineProperty(w,"_hidePrevMonthArrow",{get:function(){return w.__hidePrevMonthArrow},set:function(e){w.__hidePrevMonthArrow!==e&&(s(w.prevMonthNav,"flatpickr-disabled",e),w.__hidePrevMonthArrow=e)}}),Object.defineProperty(w,"_hideNextMonthArrow",{get:function(){return w.__hideNextMonthArrow},set:function(e){w.__hideNextMonthArrow!==e&&(s(w.nextMonthNav,"flatpickr-disabled",e),w.__hideNextMonthArrow=e)}}),w.currentYearElement=w.yearElements[0],Ce(),w.monthNav)),w.innerContainer=d("div","flatpickr-innerContainer"),w.config.weekNumbers){var n=function(){w.calendarContainer.classList.add("hasWeeks");var e=d("div","flatpickr-weekwrapper");e.appendChild(d("span","flatpickr-weekday",w.l10n.weekAbbreviation));var n=d("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;w.innerContainer.appendChild(t),w.weekNumbers=a,w.weekWrapper=t}w.rContainer=d("div","flatpickr-rContainer"),w.rContainer.appendChild(z()),w.daysContainer||(w.daysContainer=d("div","flatpickr-days"),w.daysContainer.tabIndex=-1),U(),w.rContainer.appendChild(w.daysContainer),w.innerContainer.appendChild(w.rContainer),e.appendChild(w.innerContainer)}w.config.enableTime&&e.appendChild(function(){w.calendarContainer.classList.add("hasTime"),w.config.noCalendar&&w.calendarContainer.classList.add("noCalendar");var e=E(w.config);w.timeContainer=d("div","flatpickr-time"),w.timeContainer.tabIndex=-1;var n=d("span","flatpickr-time-separator",":"),t=m("flatpickr-hour",{"aria-label":w.l10n.hourAriaLabel});w.hourElement=t.getElementsByTagName("input")[0];var a=m("flatpickr-minute",{"aria-label":w.l10n.minuteAriaLabel});w.minuteElement=a.getElementsByTagName("input")[0],w.hourElement.tabIndex=w.minuteElement.tabIndex=-1,w.hourElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getHours():w.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),w.minuteElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getMinutes():e.minutes),w.hourElement.setAttribute("step",w.config.hourIncrement.toString()),w.minuteElement.setAttribute("step",w.config.minuteIncrement.toString()),w.hourElement.setAttribute("min",w.config.time_24hr?"0":"1"),w.hourElement.setAttribute("max",w.config.time_24hr?"23":"12"),w.hourElement.setAttribute("maxlength","2"),w.minuteElement.setAttribute("min","0"),w.minuteElement.setAttribute("max","59"),w.minuteElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(t),w.timeContainer.appendChild(n),w.timeContainer.appendChild(a),w.config.time_24hr&&w.timeContainer.classList.add("time24hr");if(w.config.enableSeconds){w.timeContainer.classList.add("hasSeconds");var i=m("flatpickr-second");w.secondElement=i.getElementsByTagName("input")[0],w.secondElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getSeconds():e.seconds),w.secondElement.setAttribute("step",w.minuteElement.getAttribute("step")),w.secondElement.setAttribute("min","0"),w.secondElement.setAttribute("max","59"),w.secondElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(d("span","flatpickr-time-separator",":")),w.timeContainer.appendChild(i)}w.config.time_24hr||(w.amPM=d("span","flatpickr-am-pm",w.l10n.amPM[r((w.latestSelectedDateObj?w.hourElement.value:w.config.defaultHour)>11)]),w.amPM.title=w.l10n.toggleTitle,w.amPM.tabIndex=-1,w.timeContainer.appendChild(w.amPM));return w.timeContainer}());s(w.calendarContainer,"rangeMode","range"===w.config.mode),s(w.calendarContainer,"animate",!0===w.config.animate),s(w.calendarContainer,"multiMonth",w.config.showMonths>1),w.calendarContainer.appendChild(e);var i=void 0!==w.config.appendTo&&void 0!==w.config.appendTo.nodeType;if((w.config.inline||w.config.static)&&(w.calendarContainer.classList.add(w.config.inline?"inline":"static"),w.config.inline&&(!i&&w.element.parentNode?w.element.parentNode.insertBefore(w.calendarContainer,w._input.nextSibling):void 0!==w.config.appendTo&&w.config.appendTo.appendChild(w.calendarContainer)),w.config.static)){var l=d("div","flatpickr-wrapper");w.element.parentNode&&w.element.parentNode.insertBefore(l,w.element),l.appendChild(w.element),w.altInput&&l.appendChild(w.altInput),l.appendChild(w.calendarContainer)}w.config.static||w.config.inline||(void 0!==w.config.appendTo?w.config.appendTo:window.document.body).appendChild(w.calendarContainer)}(),function(){w.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(w.element.querySelectorAll("[data-"+e+"]"),function(n){return P(n,"click",w[e])})});if(w.isMobile)return void function(){var e=w.config.enableTime?w.config.noCalendar?"time":"datetime-local":"date";w.mobileInput=d("input",w.input.className+" flatpickr-mobile"),w.mobileInput.tabIndex=1,w.mobileInput.type=e,w.mobileInput.disabled=w.input.disabled,w.mobileInput.required=w.input.required,w.mobileInput.placeholder=w.input.placeholder,w.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",w.selectedDates.length>0&&(w.mobileInput.defaultValue=w.mobileInput.value=w.formatDate(w.selectedDates[0],w.mobileFormatStr));w.config.minDate&&(w.mobileInput.min=w.formatDate(w.config.minDate,"Y-m-d"));w.config.maxDate&&(w.mobileInput.max=w.formatDate(w.config.maxDate,"Y-m-d"));w.input.getAttribute("step")&&(w.mobileInput.step=String(w.input.getAttribute("step")));w.input.type="hidden",void 0!==w.altInput&&(w.altInput.type="hidden");try{w.input.parentNode&&w.input.parentNode.insertBefore(w.mobileInput,w.input.nextSibling)}catch(e){}P(w.mobileInput,"change",function(e){w.setDate(g(e).value,!1,w.mobileFormatStr),De("onChange"),De("onClose")})}();var e=l(re,50);w._debouncedChange=l(Y,300),w.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&P(w.daysContainer,"mouseover",function(e){"range"===w.config.mode&&oe(g(e))});P(w._input,"keydown",ie),void 0!==w.calendarContainer&&P(w.calendarContainer,"keydown",ie);w.config.inline||w.config.static||P(window,"resize",e);void 0!==window.ontouchstart?P(window.document,"touchstart",X):P(window.document,"mousedown",X);P(window.document,"focus",X,{capture:!0}),!0===w.config.clickOpens&&(P(w._input,"focus",w.open),P(w._input,"click",w.open));void 0!==w.daysContainer&&(P(w.monthNav,"click",xe),P(w.monthNav,["keyup","increment"],N),P(w.daysContainer,"click",me));if(void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement){var n=function(e){return g(e).select()};P(w.timeContainer,["increment"],_),P(w.timeContainer,"blur",_,{capture:!0}),P(w.timeContainer,"click",H),P([w.hourElement,w.minuteElement],["focus","click"],n),void 0!==w.secondElement&&P(w.secondElement,"focus",function(){return w.secondElement&&w.secondElement.select()}),void 0!==w.amPM&&P(w.amPM,"click",function(e){_(e)})}w.config.allowInput&&P(w._input,"blur",ae)}(),(w.selectedDates.length||w.config.noCalendar)&&(w.config.enableTime&&F(w.config.noCalendar?w.latestSelectedDateObj:void 0),ye(!1)),S();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!w.isMobile&&n&&de(),De("onReady")}(),w}function T(e,n){for(var t=Array.prototype.slice.call(e).filter(function(e){return e instanceof HTMLElement}),a=[],i=0;i<t.length;i++){var o=t[i];try{if(null!==o.getAttribute("data-fp-omit"))continue;void 0!==o._flatpickr&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=k(o,n||{}),a.push(o._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return T(this,e)},HTMLElement.prototype.flatpickr=function(e){return T([this],e)});var I=function(e,n){return"string"==typeof e?T(window.document.querySelectorAll(e),n):e instanceof Node?T([e],n):T(e,n)};return I.defaultConfig={},I.l10ns={en:e({},i),default:e({},i)},I.localize=function(n){I.l10ns.default=e(e({},I.l10ns.default),n)},I.setDefaults=function(n){I.defaultConfig=e(e({},I.defaultConfig),n)},I.parseDate=C({}),I.formatDate=b({}),I.compareDates=M,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return T(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=I),I});(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.monthSelectPlugin=factory())})(this,function(){"use strict";var __assign=function(){__assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};return __assign.apply(this,arguments)};var monthToStr=function(monthNumber,shorthand,locale){return locale.months[shorthand?"shorthand":"longhand"][monthNumber]};function clearNode(node){while(node.firstChild)node.removeChild(node.firstChild)}function getEventTarget(event){try{if(typeof event.composedPath==="function"){var path=event.composedPath();return path[0]}return event.target}catch(error){return event.target}}var defaultConfig={shorthand:false,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function monthSelectPlugin(pluginConfig){var config=__assign(__assign({},defaultConfig),pluginConfig);return function(fp){fp.config.dateFormat=config.dateFormat;fp.config.altFormat=config.altFormat;var self={monthsContainer:null};function clearUnnecessaryDOMElements(){if(!fp.rContainer)return;clearNode(fp.rContainer);for(var index=0;index<fp.monthElements.length;index++){var element=fp.monthElements[index];if(!element.parentNode)continue;element.parentNode.removeChild(element)}}function build(){if(!fp.rContainer)return;self.monthsContainer=fp._createElement("div","flatpickr-monthSelect-months");self.monthsContainer.tabIndex=-1;buildMonths();fp.rContainer.appendChild(self.monthsContainer);fp.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+config.theme)}function buildMonths(){if(!self.monthsContainer)return;clearNode(self.monthsContainer);var frag=document.createDocumentFragment();for(var i=0;i<12;i++){var month=fp.createDay("flatpickr-monthSelect-month",new Date(fp.currentYear,i),0,i);if(month.dateObj.getMonth()===(new Date).getMonth()&&month.dateObj.getFullYear()===(new Date).getFullYear())month.classList.add("today");month.textContent=monthToStr(i,config.shorthand,fp.l10n);month.addEventListener("click",selectMonth);frag.appendChild(month)}self.monthsContainer.appendChild(frag);if(fp.config.minDate&&fp.currentYear===fp.config.minDate.getFullYear())fp.prevMonthNav.classList.add("flatpickr-disabled");else fp.prevMonthNav.classList.remove("flatpickr-disabled");if(fp.config.maxDate&&fp.currentYear===fp.config.maxDate.getFullYear())fp.nextMonthNav.classList.add("flatpickr-disabled");else fp.nextMonthNav.classList.remove("flatpickr-disabled")}function bindEvents(){fp._bind(fp.prevMonthNav,"click",function(e){e.preventDefault();e.stopPropagation();fp.changeYear(fp.currentYear-1);selectYear();buildMonths()});fp._bind(fp.nextMonthNav,"click",function(e){e.preventDefault();e.stopPropagation();fp.changeYear(fp.currentYear+1);selectYear();buildMonths()});fp._bind(self.monthsContainer,"mouseover",function(e){if(fp.config.mode==="range")fp.onMouseOver(getEventTarget(e),"flatpickr-monthSelect-month")})}function setCurrentlySelected(){if(!fp.rContainer)return;if(!fp.selectedDates.length)return;var currentlySelected=fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected");for(var index=0;index<currentlySelected.length;index++){currentlySelected[index].classList.remove("selected")}var targetMonth=fp.selectedDates[0].getMonth();var month=fp.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(targetMonth+1)+")");if(month){month.classList.add("selected")}}function selectYear(){var selectedDate=fp.selectedDates[0];if(selectedDate){selectedDate=new Date(selectedDate);selectedDate.setFullYear(fp.currentYear);if(fp.config.minDate&&selectedDate<fp.config.minDate){selectedDate=fp.config.minDate}if(fp.config.maxDate&&selectedDate>fp.config.maxDate){selectedDate=fp.config.maxDate}fp.currentYear=selectedDate.getFullYear()}fp.currentYearElement.value=String(fp.currentYear);if(fp.rContainer){var months=fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month");months.forEach(function(month){month.dateObj.setFullYear(fp.currentYear);if(fp.config.minDate&&month.dateObj<fp.config.minDate||fp.config.maxDate&&month.dateObj>fp.config.maxDate){month.classList.add("flatpickr-disabled")}else{month.classList.remove("flatpickr-disabled")}})}setCurrentlySelected()}function selectMonth(e){e.preventDefault();e.stopPropagation();var eventTarget=getEventTarget(e);if(!(eventTarget instanceof Element))return;if(eventTarget.classList.contains("flatpickr-disabled"))return;if(eventTarget.classList.contains("notAllowed"))return;setMonth(eventTarget.dateObj);if(fp.config.closeOnSelect){var single=fp.config.mode==="single";var range=fp.config.mode==="range"&&fp.selectedDates.length===2;if(single||range)fp.close()}}function setMonth(date){var selectedDate=new Date(fp.currentYear,date.getMonth(),date.getDate());var selectedDates=[];switch(fp.config.mode){case"single":selectedDates=[selectedDate];break;case"multiple":selectedDates.push(selectedDate);break;case"range":if(fp.selectedDates.length===2){selectedDates=[selectedDate]}else{selectedDates=fp.selectedDates.concat([selectedDate]);selectedDates.sort(function(a,b){return a.getTime()-b.getTime()})}break}fp.setDate(selectedDates,true);setCurrentlySelected()}var shifts={37:-1,39:1,40:3,38:-3};function onKeyDown(_,__,___,e){var shouldMove=shifts[e.keyCode]!==undefined;if(!shouldMove&&e.keyCode!==13){return}if(!fp.rContainer||!self.monthsContainer)return;var currentlySelected=fp.rContainer.querySelector(".flatpickr-monthSelect-month.selected");var index=Array.prototype.indexOf.call(self.monthsContainer.children,document.activeElement);if(index===-1){var target=currentlySelected||self.monthsContainer.firstElementChild;target.focus();index=target.$i}if(shouldMove){self.monthsContainer.children[(12+index+shifts[e.keyCode])%12].focus()}else if(e.keyCode===13&&self.monthsContainer.contains(document.activeElement)){setMonth(document.activeElement.dateObj)}}function closeHook(){var _a;if(((_a=fp.config)===null||_a===void 0?void 0:_a.mode)==="range"&&fp.selectedDates.length===1)fp.clear(false);if(!fp.selectedDates.length)buildMonths()}function stubCurrentMonth(){config._stubbedCurrentMonth=fp._initialDate.getMonth();fp._initialDate.setMonth(config._stubbedCurrentMonth);fp.currentMonth=config._stubbedCurrentMonth}function unstubCurrentMonth(){if(!config._stubbedCurrentMonth)return;fp._initialDate.setMonth(config._stubbedCurrentMonth);fp.currentMonth=config._stubbedCurrentMonth;delete config._stubbedCurrentMonth}function destroyPluginInstance(){if(self.monthsContainer!==null){var months=self.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month");for(var index=0;index<months.length;index++){months[index].removeEventListener("click",selectMonth)}}}return{onParseConfig:function(){fp.config.enableTime=false},onValueUpdate:setCurrentlySelected,onKeyDown:onKeyDown,onReady:[stubCurrentMonth,clearUnnecessaryDOMElements,build,bindEvents,setCurrentlySelected,function(){fp.config.onClose.push(closeHook);fp.loadedPlugins.push("monthSelect")}],onDestroy:[unstubCurrentMonth,destroyPluginInstance,function(){fp.config.onClose=fp.config.onClose.filter(function(hook){return hook!==closeHook})}]}}}return monthSelectPlugin});!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,function(e){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function n(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function o(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var i=Math.max,a=Math.min,s=Math.round;function f(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect(),o=1,i=1;if(r(e)&&t){var a=e.offsetHeight,f=e.offsetWidth;f>0&&(o=s(n.width)/f||1),a>0&&(i=s(n.height)/a||1)}return{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function c(e){var n=t(e);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function p(e){return e?(e.nodeName||"").toLowerCase():null}function u(e){return((n(e)?e.ownerDocument:e.document)||window.document).documentElement}function l(e){return f(u(e)).left+c(e).scrollLeft}function d(e){return t(e).getComputedStyle(e)}function h(e){var t=d(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function m(e,n,o){void 0===o&&(o=!1);var i,a,d=r(n),m=r(n)&&function(e){var t=e.getBoundingClientRect(),n=s(t.width)/e.offsetWidth||1,r=s(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(n),v=u(n),g=f(e,m),y={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(d||!d&&!o)&&(("body"!==p(n)||h(v))&&(y=(i=n)!==t(i)&&r(i)?{scrollLeft:(a=i).scrollLeft,scrollTop:a.scrollTop}:c(i)),r(n)?((b=f(n,!0)).x+=n.clientLeft,b.y+=n.clientTop):v&&(b.x=l(v))),{x:g.left+y.scrollLeft-b.x,y:g.top+y.scrollTop-b.y,width:g.width,height:g.height}}function v(e){var t=f(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function g(e){return"html"===p(e)?e:e.assignedSlot||e.parentNode||(o(e)?e.host:null)||u(e)}function y(e){return["html","body","#document"].indexOf(p(e))>=0?e.ownerDocument.body:r(e)&&h(e)?e:y(g(e))}function b(e,n){var r;void 0===n&&(n=[]);var o=y(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=t(o),s=i?[a].concat(a.visualViewport||[],h(o)?o:[]):o,f=n.concat(s);return i?f:f.concat(b(g(s)))}function x(e){return["table","td","th"].indexOf(p(e))>=0}function w(e){return r(e)&&"fixed"!==d(e).position?e.offsetParent:null}function O(e){for(var n=t(e),i=w(e);i&&x(i)&&"static"===d(i).position;)i=w(i);return i&&("html"===p(i)||"body"===p(i)&&"static"===d(i).position)?n:i||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&r(e)&&"fixed"===d(e).position)return null;var n=g(e);for(o(n)&&(n=n.host);r(n)&&["html","body"].indexOf(p(n))<0;){var i=d(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||n}var j="top",E="bottom",D="right",A="left",L="auto",P=[j,E,D,A],M="start",k="end",W="viewport",B="popper",H=P.reduce(function(e,t){return e.concat([t+"-"+M,t+"-"+k])},[]),T=[].concat(P,[L]).reduce(function(e,t){return e.concat([t,t+"-"+M,t+"-"+k])},[]),R=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function S(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}}),r.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){n.has(e.name)||o(e)}),r}function C(e){return e.split("-")[0]}function q(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&o(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function V(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function N(e,r){return r===W?V(function(e){var n=t(e),r=u(e),o=n.visualViewport,i=r.clientWidth,a=r.clientHeight,s=0,f=0;return o&&(i=o.width,a=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=o.offsetLeft,f=o.offsetTop)),{width:i,height:a,x:s+l(e),y:f}}(e)):n(r)?function(e){var t=f(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(r):V(function(e){var t,n=u(e),r=c(e),o=null==(t=e.ownerDocument)?void 0:t.body,a=i(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=i(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),f=-r.scrollLeft+l(e),p=-r.scrollTop;return"rtl"===d(o||n).direction&&(f+=i(n.clientWidth,o?o.clientWidth:0)-a),{width:a,height:s,x:f,y:p}}(u(e)))}function I(e,t,o){var s="clippingParents"===t?function(e){var t=b(g(e)),o=["absolute","fixed"].indexOf(d(e).position)>=0&&r(e)?O(e):e;return n(o)?t.filter(function(e){return n(e)&&q(e,o)&&"body"!==p(e)}):[]}(e):[].concat(t),f=[].concat(s,[o]),c=f[0],u=f.reduce(function(t,n){var r=N(e,n);return t.top=i(r.top,t.top),t.right=a(r.right,t.right),t.bottom=a(r.bottom,t.bottom),t.left=i(r.left,t.left),t},N(e,c));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function _(e){return e.split("-")[1]}function F(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function U(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?C(o):null,a=o?_(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case j:t={x:s,y:n.y-r.height};break;case E:t={x:s,y:n.y+n.height};break;case D:t={x:n.x+n.width,y:f};break;case A:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?F(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case M:t[c]=t[c]-(n[p]/2-r[p]/2);break;case k:t[c]=t[c]+(n[p]/2-r[p]/2)}}return t}function z(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function X(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}function Y(e,t){void 0===t&&(t={});var r=t,o=r.placement,i=void 0===o?e.placement:o,a=r.boundary,s=void 0===a?"clippingParents":a,c=r.rootBoundary,p=void 0===c?W:c,l=r.elementContext,d=void 0===l?B:l,h=r.altBoundary,m=void 0!==h&&h,v=r.padding,g=void 0===v?0:v,y=z("number"!=typeof g?g:X(g,P)),b=d===B?"reference":B,x=e.rects.popper,w=e.elements[m?b:d],O=I(n(w)?w:w.contextElement||u(e.elements.popper),s,p),A=f(e.elements.reference),L=U({reference:A,element:x,strategy:"absolute",placement:i}),M=V(Object.assign({},x,L)),k=d===B?M:A,H={top:O.top-k.top+y.top,bottom:k.bottom-O.bottom+y.bottom,left:O.left-k.left+y.left,right:k.right-O.right+y.right},T=e.modifiersData.offset;if(d===B&&T){var R=T[i];Object.keys(H).forEach(function(e){var t=[D,E].indexOf(e)>=0?1:-1,n=[j,E].indexOf(e)>=0?"y":"x";H[e]+=R[n]*t})}return H}var G={placement:"bottom",modifiers:[],strategy:"absolute"};function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}function K(e){void 0===e&&(e={});var t=e,r=t.defaultModifiers,o=void 0===r?[]:r,i=t.defaultOptions,a=void 0===i?G:i;return function(e,t,r){void 0===r&&(r=a);var i,s,f={placement:"bottom",orderedModifiers:[],options:Object.assign({},G,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},c=[],p=!1,u={state:f,setOptions:function(r){var i="function"==typeof r?r(f.options):r;l(),f.options=Object.assign({},a,f.options,i),f.scrollParents={reference:n(e)?b(e):e.contextElement?b(e.contextElement):[],popper:b(t)};var s,p,d=function(e){var t=S(e);return R.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}((s=[].concat(o,f.options.modifiers),p=s.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{}),Object.keys(p).map(function(e){return p[e]})));return f.orderedModifiers=d.filter(function(e){return e.enabled}),f.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,o=e.effect;if("function"==typeof o){var i=o({state:f,name:t,instance:u,options:r}),a=function(){};c.push(i||a)}}),u.update()},forceUpdate:function(){if(!p){var e=f.elements,t=e.reference,n=e.popper;if(J(t,n)){f.rects={reference:m(t,O(n),"fixed"===f.options.strategy),popper:v(n)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(e){return f.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<f.orderedModifiers.length;r++)if(!0!==f.reset){var o=f.orderedModifiers[r],i=o.fn,a=o.options,s=void 0===a?{}:a,c=o.name;"function"==typeof i&&(f=i({state:f,options:s,name:c,instance:u})||f)}else f.reset=!1,r=-1}}},update:(i=function(){return new Promise(function(e){u.forceUpdate(),e(f)})},function(){return s||(s=new Promise(function(e){Promise.resolve().then(function(){s=void 0,e(i())})})),s}),destroy:function(){l(),p=!0}};if(!J(e,t))return u;function l(){c.forEach(function(e){return e()}),c=[]}return u.setOptions(r).then(function(e){!p&&r.onFirstUpdate&&r.onFirstUpdate(e)}),u}}var Q={passive:!0};var Z={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var n=e.state,r=e.instance,o=e.options,i=o.scroll,a=void 0===i||i,s=o.resize,f=void 0===s||s,c=t(n.elements.popper),p=[].concat(n.scrollParents.reference,n.scrollParents.popper);return a&&p.forEach(function(e){e.addEventListener("scroll",r.update,Q)}),f&&c.addEventListener("resize",r.update,Q),function(){a&&p.forEach(function(e){e.removeEventListener("scroll",r.update,Q)}),f&&c.removeEventListener("resize",r.update,Q)}},data:{}};var $={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=U({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},ee={top:"auto",right:"auto",bottom:"auto",left:"auto"};function te(e){var n,r=e.popper,o=e.popperRect,i=e.placement,a=e.variation,f=e.offsets,c=e.position,p=e.gpuAcceleration,l=e.adaptive,h=e.roundOffsets,m=e.isFixed,v=f.x,g=void 0===v?0:v,y=f.y,b=void 0===y?0:y,x="function"==typeof h?h({x:g,y:b}):{x:g,y:b};g=x.x,b=x.y;var w=f.hasOwnProperty("x"),L=f.hasOwnProperty("y"),P=A,M=j,W=window;if(l){var B=O(r),H="clientHeight",T="clientWidth";if(B===t(r)&&"static"!==d(B=u(r)).position&&"absolute"===c&&(H="scrollHeight",T="scrollWidth"),B=B,i===j||(i===A||i===D)&&a===k)M=E,b-=(m&&B===W&&W.visualViewport?W.visualViewport.height:B[H])-o.height,b*=p?1:-1;if(i===A||(i===j||i===E)&&a===k)P=D,g-=(m&&B===W&&W.visualViewport?W.visualViewport.width:B[T])-o.width,g*=p?1:-1}var R,S=Object.assign({position:c},l&&ee),C=!0===h?function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:s(t*r)/r||0,y:s(n*r)/r||0}}({x:g,y:b}):{x:g,y:b};return g=C.x,b=C.y,p?Object.assign({},S,((R={})[M]=L?"0":"",R[P]=w?"0":"",R.transform=(W.devicePixelRatio||1)<=1?"translate("+g+"px, "+b+"px)":"translate3d("+g+"px, "+b+"px, 0)",R)):Object.assign({},S,((n={})[M]=L?b+"px":"",n[P]=w?g+"px":"",n.transform="",n))}var ne={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,f=void 0===s||s,c={placement:C(t.placement),variation:_(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,te(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:f})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,te(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}};var re={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},o=t.attributes[e]||{},i=t.elements[e];r(i)&&p(i)&&(Object.assign(i.style,n),Object.keys(o).forEach(function(e){var t=o[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var o=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});r(o)&&p(o)&&(Object.assign(o.style,a),Object.keys(i).forEach(function(e){o.removeAttribute(e)}))})}},requires:["computeStyles"]};var oe={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=T.reduce(function(e,n){return e[n]=function(e,t,n){var r=C(e),o=[A,j].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[A,D].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e},{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},ie={left:"right",right:"left",bottom:"top",top:"bottom"};function ae(e){return e.replace(/left|right|bottom|top/g,function(e){return ie[e]})}var se={start:"end",end:"start"};function fe(e){return e.replace(/start|end/g,function(e){return se[e]})}function ce(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?T:f,p=_(r),u=p?s?H:H.filter(function(e){return _(e)===p}):P,l=u.filter(function(e){return c.indexOf(e)>=0});0===l.length&&(l=u);var d=l.reduce(function(t,n){return t[n]=Y(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[C(n)],t},{});return Object.keys(d).sort(function(e,t){return d[e]-d[t]})}var pe={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,f=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,v=t.options.placement,g=C(v),y=f||(g===v||!h?[ae(v)]:function(e){if(C(e)===L)return[];var t=ae(e);return[fe(e),t,fe(t)]}(v)),b=[v].concat(y).reduce(function(e,n){return e.concat(C(n)===L?ce(t,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)},[]),x=t.rects.reference,w=t.rects.popper,O=new Map,P=!0,k=b[0],W=0;W<b.length;W++){var B=b[W],H=C(B),T=_(B)===M,R=[j,E].indexOf(H)>=0,S=R?"width":"height",q=Y(t,{placement:B,boundary:p,rootBoundary:u,altBoundary:l,padding:c}),V=R?T?D:A:T?E:j;x[S]>w[S]&&(V=ae(V));var N=ae(V),I=[];if(i&&I.push(q[H]<=0),s&&I.push(q[V]<=0,q[N]<=0),I.every(function(e){return e})){k=B,P=!1;break}O.set(B,I)}if(P)for(var F=function(e){var t=b.find(function(t){var n=O.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return k=t,"break"},U=h?3:1;U>0;U--){if("break"===F(U))break}t.placement!==k&&(t.modifiersData[r]._skip=!0,t.placement=k,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ue(e,t,n){return i(e,a(t,n))}var le={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=void 0===o||o,f=n.altAxis,c=void 0!==f&&f,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,h=n.tether,m=void 0===h||h,g=n.tetherOffset,y=void 0===g?0:g,b=Y(t,{boundary:p,rootBoundary:u,padding:d,altBoundary:l}),x=C(t.placement),w=_(t.placement),L=!w,P=F(x),k="x"===P?"y":"x",W=t.modifiersData.popperOffsets,B=t.rects.reference,H=t.rects.popper,T="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,R="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,q={x:0,y:0};if(W){if(s){var V,N="y"===P?j:A,I="y"===P?E:D,U="y"===P?"height":"width",z=W[P],X=z+b[N],G=z-b[I],J=m?-H[U]/2:0,K=w===M?B[U]:H[U],Q=w===M?-H[U]:-B[U],Z=t.elements.arrow,$=m&&Z?v(Z):{width:0,height:0},ee=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},te=ee[N],ne=ee[I],re=ue(0,B[U],$[U]),oe=L?B[U]/2-J-re-te-R.mainAxis:K-re-te-R.mainAxis,ie=L?-B[U]/2+J+re+ne+R.mainAxis:Q+re+ne+R.mainAxis,ae=t.elements.arrow&&O(t.elements.arrow),se=ae?"y"===P?ae.clientTop||0:ae.clientLeft||0:0,fe=null!=(V=null==S?void 0:S[P])?V:0,ce=z+ie-fe,pe=ue(m?a(X,z+oe-fe-se):X,z,m?i(G,ce):G);W[P]=pe,q[P]=pe-z}if(c){var le,de="x"===P?j:A,he="x"===P?E:D,me=W[k],ve="y"===k?"height":"width",ge=me+b[de],ye=me-b[he],be=-1!==[j,A].indexOf(x),xe=null!=(le=null==S?void 0:S[k])?le:0,we=be?ge:me-B[ve]-H[ve]-xe+R.altAxis,Oe=be?me+B[ve]+H[ve]-xe-R.altAxis:ye,je=m&&be?function(e,t,n){var r=ue(e,t,n);return r>n?n:r}(we,me,Oe):ue(m?we:ge,me,m?Oe:ye);W[k]=je,q[k]=je-me}t.modifiersData[r]=q}},requiresIfExists:["offset"]};var de={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=C(n.placement),f=F(s),c=[A,D].indexOf(s)>=0?"height":"width";if(i&&a){var p=function(e,t){return z("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:X(e,P))}(o.padding,n),u=v(i),l="y"===f?j:A,d="y"===f?E:D,h=n.rects.reference[c]+n.rects.reference[f]-a[f]-n.rects.popper[c],m=a[f]-n.rects.reference[f],g=O(i),y=g?"y"===f?g.clientHeight||0:g.clientWidth||0:0,b=h/2-m/2,x=p[l],w=y-u[c]-p[d],L=y/2-u[c]/2+b,M=ue(x,L,w),k=f;n.modifiersData[r]=((t={})[k]=M,t.centerOffset=M-L,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&q(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function he(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function me(e){return[j,D,E,A].some(function(t){return e[t]>=0})}var ve={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=Y(t,{elementContext:"reference"}),s=Y(t,{altBoundary:!0}),f=he(a,r),c=he(s,o,i),p=me(f),u=me(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}},ge=K({defaultModifiers:[Z,$,ne,re]}),ye=[Z,$,ne,re,oe,pe,le,de,ve],be=K({defaultModifiers:ye});e.applyStyles=re,e.arrow=de,e.computeStyles=ne,e.createPopper=be,e.createPopperLite=ge,e.defaultModifiers=ye,e.detectOverflow=Y,e.eventListeners=Z,e.flip=pe,e.hide=ve,e.offset=oe,e.popperGenerator=K,e.popperOffsets=$,e.preventOverflow=le,Object.defineProperty(e,"__esModule",{value:!0})});!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t=t||self).tippy=e(t.Popper)}(this,function(t){"use strict";var e="undefined"!=typeof window&&"undefined"!=typeof document,n=!!e&&!!window.msCrypto,r={passive:!0,capture:!0},o=function(){return document.body};function i(t,e,n){if(Array.isArray(t)){var r=t[e];return null==r?Array.isArray(n)?n[e]:n:r}return t}function a(t,e){var n={}.toString.call(t);return 0===n.indexOf("[object")&&n.indexOf(e+"]")>-1}function s(t,e){return"function"==typeof t?t.apply(void 0,e):t}function u(t,e){return 0===e?t:function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)};var n}function p(t,e){var n=Object.assign({},t);return e.forEach(function(t){delete n[t]}),n}function c(t){return[].concat(t)}function f(t,e){-1===t.indexOf(e)&&t.push(e)}function l(t){return t.split("-")[0]}function d(t){return[].slice.call(t)}function v(t){return Object.keys(t).reduce(function(e,n){return void 0!==t[n]&&(e[n]=t[n]),e},{})}function m(){return document.createElement("div")}function g(t){return["Element","Fragment"].some(function(e){return a(t,e)})}function h(t){return a(t,"MouseEvent")}function b(t){return!(!t||!t._tippy||t._tippy.reference!==t)}function y(t){return g(t)?[t]:function(t){return a(t,"NodeList")}(t)?d(t):Array.isArray(t)?t:d(document.querySelectorAll(t))}function w(t,e){t.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function x(t,e){t.forEach(function(t){t&&t.setAttribute("data-state",e)})}function E(t){var e,n=c(t)[0];return null!=n&&null!=(e=n.ownerDocument)&&e.body?n.ownerDocument:document}function O(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(e){t[r](e,n)})}function C(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var T={isTouch:!1},A=0;function L(){T.isTouch||(T.isTouch=!0,window.performance&&document.addEventListener("mousemove",D))}function D(){var t=performance.now();t-A<20&&(T.isTouch=!1,document.removeEventListener("mousemove",D)),A=t}function k(){var t=document.activeElement;if(b(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}var R=Object.assign({appendTo:o,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),P=Object.keys(R);function j(t){var e=(t.plugins||[]).reduce(function(e,n){var r,o=n.name,i=n.defaultValue;o&&(e[o]=void 0!==t[o]?t[o]:null!=(r=R[o])?r:i);return e},{});return Object.assign({},t,e)}function M(t,e){var n=Object.assign({},e,{content:s(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(j(Object.assign({},R,{plugins:e}))):P).reduce(function(e,n){var r=(t.getAttribute("data-tippy-"+n)||"").trim();if(!r)return e;if("content"===n)e[n]=r;else try{e[n]=JSON.parse(r)}catch(t){e[n]=r}return e},{})}(t,e.plugins));return n.aria=Object.assign({},R.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?e.interactive:n.aria.expanded,content:"auto"===n.aria.content?e.interactive?null:"describedby":n.aria.content},n}function V(t,e){t.innerHTML=e}function I(t){var e=m();return!0===t?e.className="tippy-arrow":(e.className="tippy-svg-arrow",g(t)?e.appendChild(t):V(e,t)),e}function S(t,e){g(e.content)?(V(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?V(t,e.content):t.textContent=e.content)}function B(t){var e=t.firstElementChild,n=d(e.children);return{box:e,content:n.find(function(t){return t.classList.contains("tippy-content")}),arrow:n.find(function(t){return t.classList.contains("tippy-arrow")||t.classList.contains("tippy-svg-arrow")}),backdrop:n.find(function(t){return t.classList.contains("tippy-backdrop")})}}function N(t){var e=m(),n=m();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=m();function o(n,r){var o=B(e),i=o.box,a=o.content,s=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||S(a,t.props),r.arrow?s?n.arrow!==r.arrow&&(i.removeChild(s),i.appendChild(I(r.arrow))):i.appendChild(I(r.arrow)):s&&i.removeChild(s)}return r.className="tippy-content",r.setAttribute("data-state","hidden"),S(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props),{popper:e,onUpdate:o}}N.$$tippy=!0;var H=1,U=[],_=[];function z(e,a){var p,g,b,y,A,L,D,k,P=M(e,Object.assign({},R,j(v(a)))),V=!1,I=!1,S=!1,N=!1,z=[],F=u(wt,P.interactiveDebounce),W=H++,X=(k=P.plugins).filter(function(t,e){return k.indexOf(t)===e}),Y={id:W,reference:e,popper:m(),popperInstance:null,props:P,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:X,clearDelayTimeouts:function(){clearTimeout(p),clearTimeout(g),cancelAnimationFrame(b)},setProps:function(t){if(Y.state.isDestroyed)return;at("onBeforeUpdate",[Y,t]),bt();var n=Y.props,r=M(e,Object.assign({},n,v(t),{ignoreAttributes:!0}));Y.props=r,ht(),n.interactiveDebounce!==r.interactiveDebounce&&(pt(),F=u(wt,r.interactiveDebounce));n.triggerTarget&&!r.triggerTarget?c(n.triggerTarget).forEach(function(t){t.removeAttribute("aria-expanded")}):r.triggerTarget&&e.removeAttribute("aria-expanded");ut(),it(),J&&J(n,r);Y.popperInstance&&(Ct(),At().forEach(function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)}));at("onAfterUpdate",[Y,t])},setContent:function(t){Y.setProps({content:t})},show:function(){var t=Y.state.isVisible,e=Y.state.isDestroyed,n=!Y.state.isEnabled,r=T.isTouch&&!Y.props.touch,a=i(Y.props.duration,0,R.duration);if(t||e||n||r)return;if(et().hasAttribute("disabled"))return;if(at("onShow",[Y],!1),!1===Y.props.onShow(Y))return;Y.state.isVisible=!0,tt()&&($.style.visibility="visible");it(),dt(),Y.state.isMounted||($.style.transition="none");if(tt()){var u=rt(),p=u.box,c=u.content;w([p,c],0)}L=function(){var t;if(Y.state.isVisible&&!N){if(N=!0,$.offsetHeight,$.style.transition=Y.props.moveTransition,tt()&&Y.props.animation){var e=rt(),n=e.box,r=e.content;w([n,r],a),x([n,r],"visible")}st(),ut(),f(_,Y),null==(t=Y.popperInstance)||t.forceUpdate(),at("onMount",[Y]),Y.props.animation&&tt()&&function(t,e){mt(t,e)}(a,function(){Y.state.isShown=!0,at("onShown",[Y])})}},function(){var t,e=Y.props.appendTo,n=et();t=Y.props.interactive&&e===o||"parent"===e?n.parentNode:s(e,[n]);t.contains($)||t.appendChild($);Y.state.isMounted=!0,Ct()}()},hide:function(){var t=!Y.state.isVisible,e=Y.state.isDestroyed,n=!Y.state.isEnabled,r=i(Y.props.duration,1,R.duration);if(t||e||n)return;if(at("onHide",[Y],!1),!1===Y.props.onHide(Y))return;Y.state.isVisible=!1,Y.state.isShown=!1,N=!1,V=!1,tt()&&($.style.visibility="hidden");if(pt(),vt(),it(!0),tt()){var o=rt(),a=o.box,s=o.content;Y.props.animation&&(w([a,s],r),x([a,s],"hidden"))}st(),ut(),Y.props.animation?tt()&&function(t,e){mt(t,function(){!Y.state.isVisible&&$.parentNode&&$.parentNode.contains($)&&e()})}(r,Y.unmount):Y.unmount()},hideWithInteractivity:function(t){nt().addEventListener("mousemove",F),f(U,F),F(t)},enable:function(){Y.state.isEnabled=!0},disable:function(){Y.hide(),Y.state.isEnabled=!1},unmount:function(){Y.state.isVisible&&Y.hide();if(!Y.state.isMounted)return;Tt(),At().forEach(function(t){t._tippy.unmount()}),$.parentNode&&$.parentNode.removeChild($);_=_.filter(function(t){return t!==Y}),Y.state.isMounted=!1,at("onHidden",[Y])},destroy:function(){if(Y.state.isDestroyed)return;Y.clearDelayTimeouts(),Y.unmount(),bt(),delete e._tippy,Y.state.isDestroyed=!0,at("onDestroy",[Y])}};if(!P.render)return Y;var q=P.render(Y),$=q.popper,J=q.onUpdate;$.setAttribute("data-tippy-root",""),$.id="tippy-"+Y.id,Y.popper=$,e._tippy=Y,$._tippy=Y;var G=X.map(function(t){return t.fn(Y)}),K=e.hasAttribute("aria-expanded");return ht(),ut(),it(),at("onCreate",[Y]),P.showOnCreate&&Lt(),$.addEventListener("mouseenter",function(){Y.props.interactive&&Y.state.isVisible&&Y.clearDelayTimeouts()}),$.addEventListener("mouseleave",function(){Y.props.interactive&&Y.props.trigger.indexOf("mouseenter")>=0&&nt().addEventListener("mousemove",F)}),Y;function Q(){var t=Y.props.touch;return Array.isArray(t)?t:[t,0]}function Z(){return"hold"===Q()[0]}function tt(){var t;return!(null==(t=Y.props.render)||!t.$$tippy)}function et(){return D||e}function nt(){var t=et().parentNode;return t?E(t):document}function rt(){return B($)}function ot(t){return Y.state.isMounted&&!Y.state.isVisible||T.isTouch||y&&"focus"===y.type?0:i(Y.props.delay,t?0:1,R.delay)}function it(t){void 0===t&&(t=!1),$.style.pointerEvents=Y.props.interactive&&!t?"":"none",$.style.zIndex=""+Y.props.zIndex}function at(t,e,n){var r;(void 0===n&&(n=!0),G.forEach(function(n){n[t]&&n[t].apply(n,e)}),n)&&(r=Y.props)[t].apply(r,e)}function st(){var t=Y.props.aria;if(t.content){var n="aria-"+t.content,r=$.id;c(Y.props.triggerTarget||e).forEach(function(t){var e=t.getAttribute(n);if(Y.state.isVisible)t.setAttribute(n,e?e+" "+r:r);else{var o=e&&e.replace(r,"").trim();o?t.setAttribute(n,o):t.removeAttribute(n)}})}}function ut(){!K&&Y.props.aria.expanded&&c(Y.props.triggerTarget||e).forEach(function(t){Y.props.interactive?t.setAttribute("aria-expanded",Y.state.isVisible&&t===et()?"true":"false"):t.removeAttribute("aria-expanded")})}function pt(){nt().removeEventListener("mousemove",F),U=U.filter(function(t){return t!==F})}function ct(t){if(!T.isTouch||!S&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!Y.props.interactive||!C($,n)){if(c(Y.props.triggerTarget||e).some(function(t){return C(t,n)})){if(T.isTouch)return;if(Y.state.isVisible&&Y.props.trigger.indexOf("click")>=0)return}else at("onClickOutside",[Y,t]);!0===Y.props.hideOnClick&&(Y.clearDelayTimeouts(),Y.hide(),I=!0,setTimeout(function(){I=!1}),Y.state.isMounted||vt())}}}function ft(){S=!0}function lt(){S=!1}function dt(){var t=nt();t.addEventListener("mousedown",ct,!0),t.addEventListener("touchend",ct,r),t.addEventListener("touchstart",lt,r),t.addEventListener("touchmove",ft,r)}function vt(){var t=nt();t.removeEventListener("mousedown",ct,!0),t.removeEventListener("touchend",ct,r),t.removeEventListener("touchstart",lt,r),t.removeEventListener("touchmove",ft,r)}function mt(t,e){var n=rt().box;function r(t){t.target===n&&(O(n,"remove",r),e())}if(0===t)return e();O(n,"remove",A),O(n,"add",r),A=r}function gt(t,n,r){void 0===r&&(r=!1),c(Y.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),z.push({node:e,eventType:t,handler:n,options:r})})}function ht(){var t;Z()&&(gt("touchstart",yt,{passive:!0}),gt("touchend",xt,{passive:!0})),(t=Y.props.trigger,t.split(/\s+/).filter(Boolean)).forEach(function(t){if("manual"!==t)switch(gt(t,yt),t){case"mouseenter":gt("mouseleave",xt);break;case"focus":gt(n?"focusout":"blur",Et);break;case"focusin":gt("focusout",Et)}})}function bt(){z.forEach(function(t){var e=t.node,n=t.eventType,r=t.handler,o=t.options;e.removeEventListener(n,r,o)}),z=[]}function yt(t){var e,n=!1;if(Y.state.isEnabled&&!Ot(t)&&!I){var r="focus"===(null==(e=y)?void 0:e.type);y=t,D=t.currentTarget,ut(),!Y.state.isVisible&&h(t)&&U.forEach(function(e){return e(t)}),"click"===t.type&&(Y.props.trigger.indexOf("mouseenter")<0||V)&&!1!==Y.props.hideOnClick&&Y.state.isVisible?n=!0:Lt(t),"click"===t.type&&(V=!n),n&&!r&&Dt(t)}}function wt(t){var e=t.target,n=et().contains(e)||$.contains(e);"mousemove"===t.type&&n||function(t,e){var n=e.clientX,r=e.clientY;return t.every(function(t){var e=t.popperRect,o=t.popperState,i=t.props.interactiveBorder,a=l(o.placement),s=o.modifiersData.offset;if(!s)return!0;var u="bottom"===a?s.top.y:0,p="top"===a?s.bottom.y:0,c="right"===a?s.left.x:0,f="left"===a?s.right.x:0,d=e.top-r+u>i,v=r-e.bottom-p>i,m=e.left-n+c>i,g=n-e.right-f>i;return d||v||m||g})}(At().concat($).map(function(t){var e,n=null==(e=t._tippy.popperInstance)?void 0:e.state;return n?{popperRect:t.getBoundingClientRect(),popperState:n,props:P}:null}).filter(Boolean),t)&&(pt(),Dt(t))}function xt(t){Ot(t)||Y.props.trigger.indexOf("click")>=0&&V||(Y.props.interactive?Y.hideWithInteractivity(t):Dt(t))}function Et(t){Y.props.trigger.indexOf("focusin")<0&&t.target!==et()||Y.props.interactive&&t.relatedTarget&&$.contains(t.relatedTarget)||Dt(t)}function Ot(t){return!!T.isTouch&&Z()!==t.type.indexOf("touch")>=0}function Ct(){Tt();var n=Y.props,r=n.popperOptions,o=n.placement,i=n.offset,a=n.getReferenceClientRect,s=n.moveTransition,u=tt()?B($).arrow:null,p=a?{getBoundingClientRect:a,contextElement:a.contextElement||et()}:e,c=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(tt()){var n=rt().box;["placement","reference-hidden","escaped"].forEach(function(t){"placement"===t?n.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?n.setAttribute("data-"+t,""):n.removeAttribute("data-"+t)}),e.attributes.popper={}}}}];tt()&&u&&c.push({name:"arrow",options:{element:u,padding:3}}),c.push.apply(c,(null==r?void 0:r.modifiers)||[]),Y.popperInstance=t.createPopper(p,$,Object.assign({},r,{placement:o,onFirstUpdate:L,modifiers:c}))}function Tt(){Y.popperInstance&&(Y.popperInstance.destroy(),Y.popperInstance=null)}function At(){return d($.querySelectorAll("[data-tippy-root]"))}function Lt(t){Y.clearDelayTimeouts(),t&&at("onTrigger",[Y,t]),dt();var e=ot(!0),n=Q(),r=n[0],o=n[1];T.isTouch&&"hold"===r&&o&&(e=o),e?p=setTimeout(function(){Y.show()},e):Y.show()}function Dt(t){if(Y.clearDelayTimeouts(),at("onUntrigger",[Y,t]),Y.state.isVisible){if(!(Y.props.trigger.indexOf("mouseenter")>=0&&Y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&V)){var e=ot(!1);e?g=setTimeout(function(){Y.state.isVisible&&Y.hide()},e):b=requestAnimationFrame(function(){Y.hide()})}}else vt()}}function F(t,e){void 0===e&&(e={});var n=R.plugins.concat(e.plugins||[]);document.addEventListener("touchstart",L,r),window.addEventListener("blur",k);var o=Object.assign({},e,{plugins:n}),i=y(t).reduce(function(t,e){var n=e&&z(e,o);return n&&t.push(n),t},[]);return g(t)?i[0]:i}F.defaultProps=R,F.setDefaultProps=function(t){Object.keys(t).forEach(function(e){R[e]=t[e]})},F.currentInput=T;var W=Object.assign({},t.applyStyles,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),X={mouseover:"mouseenter",focusin:"focus",click:"click"};var Y={name:"animateFill",defaultValue:!1,fn:function(t){var e;if(null==(e=t.props.render)||!e.$$tippy)return{};var n=B(t.popper),r=n.box,o=n.content,i=t.props.animateFill?function(){var t=m();return t.className="tippy-backdrop",x([t],"hidden"),t}():null;return{onCreate:function(){i&&(r.insertBefore(i,r.firstElementChild),r.setAttribute("data-animatefill",""),r.style.overflow="hidden",t.setProps({arrow:!1,animation:"shift-away"}))},onMount:function(){if(i){var t=r.style.transitionDuration,e=Number(t.replace("ms",""));o.style.transitionDelay=Math.round(e/10)+"ms",i.style.transitionDuration=t,x([i],"visible")}},onShow:function(){i&&(i.style.transitionDuration="0ms")},onHide:function(){i&&x([i],"hidden")}}}};var q={clientX:0,clientY:0},$=[];function J(t){var e=t.clientX,n=t.clientY;q={clientX:e,clientY:n}}var G={name:"followCursor",defaultValue:!1,fn:function(t){var e=t.reference,n=E(t.props.triggerTarget||e),r=!1,o=!1,i=!0,a=t.props;function s(){return"initial"===t.props.followCursor&&t.state.isVisible}function u(){n.addEventListener("mousemove",f)}function p(){n.removeEventListener("mousemove",f)}function c(){r=!0,t.setProps({getReferenceClientRect:null}),r=!1}function f(n){var r=!n.target||e.contains(n.target),o=t.props.followCursor,i=n.clientX,a=n.clientY,s=e.getBoundingClientRect(),u=i-s.left,p=a-s.top;!r&&t.props.interactive||t.setProps({getReferenceClientRect:function(){var t=e.getBoundingClientRect(),n=i,r=a;"initial"===o&&(n=t.left+u,r=t.top+p);var s="horizontal"===o?t.top:r,c="vertical"===o?t.right:n,f="horizontal"===o?t.bottom:r,l="vertical"===o?t.left:n;return{width:c-l,height:f-s,top:s,right:c,bottom:f,left:l}}})}function l(){t.props.followCursor&&($.push({instance:t,doc:n}),function(t){t.addEventListener("mousemove",J)}(n))}function d(){0===($=$.filter(function(e){return e.instance!==t})).filter(function(t){return t.doc===n}).length&&function(t){t.removeEventListener("mousemove",J)}(n)}return{onCreate:l,onDestroy:d,onBeforeUpdate:function(){a=t.props},onAfterUpdate:function(e,n){var i=n.followCursor;r||void 0!==i&&a.followCursor!==i&&(d(),i?(l(),!t.state.isMounted||o||s()||u()):(p(),c()))},onMount:function(){t.props.followCursor&&!o&&(i&&(f(q),i=!1),s()||u())},onTrigger:function(t,e){h(e)&&(q={clientX:e.clientX,clientY:e.clientY}),o="focus"===e.type},onHidden:function(){t.props.followCursor&&(c(),p(),i=!0)}}}};var K={name:"inlinePositioning",defaultValue:!1,fn:function(t){var e,n=t.reference;var r=-1,o=!1,i=[],a={name:"tippyInlinePositioning",enabled:!0,phase:"afterWrite",fn:function(o){var a=o.state;t.props.inlinePositioning&&(-1!==i.indexOf(a.placement)&&(i=[]),e!==a.placement&&-1===i.indexOf(a.placement)&&(i.push(a.placement),t.setProps({getReferenceClientRect:function(){return function(t){return function(t,e,n,r){if(n.length<2||null===t)return e;if(2===n.length&&r>=0&&n[0].left>n[1].right)return n[r]||e;switch(t){case"top":case"bottom":var o=n[0],i=n[n.length-1],a="top"===t,s=o.top,u=i.bottom,p=a?o.left:i.left,c=a?o.right:i.right;return{top:s,bottom:u,left:p,right:c,width:c-p,height:u-s};case"left":case"right":var f=Math.min.apply(Math,n.map(function(t){return t.left})),l=Math.max.apply(Math,n.map(function(t){return t.right})),d=n.filter(function(e){return"left"===t?e.left===f:e.right===l}),v=d[0].top,m=d[d.length-1].bottom;return{top:v,bottom:m,left:f,right:l,width:l-f,height:m-v};default:return e}}(l(t),n.getBoundingClientRect(),d(n.getClientRects()),r)}(a.placement)}})),e=a.placement)}};function s(){var e;o||(e=function(t,e){var n;return{popperOptions:Object.assign({},t.popperOptions,{modifiers:[].concat(((null==(n=t.popperOptions)?void 0:n.modifiers)||[]).filter(function(t){return t.name!==e.name}),[e])})}}(t.props,a),o=!0,t.setProps(e),o=!1)}return{onCreate:s,onAfterUpdate:s,onTrigger:function(e,n){if(h(n)){var o=d(t.reference.getClientRects()),i=o.find(function(t){return t.left-2<=n.clientX&&t.right+2>=n.clientX&&t.top-2<=n.clientY&&t.bottom+2>=n.clientY}),a=o.indexOf(i);r=a>-1?a:r}},onHidden:function(){r=-1}}}};var Q={name:"sticky",defaultValue:!1,fn:function(t){var e=t.reference,n=t.popper;function r(e){return!0===t.props.sticky||t.props.sticky===e}var o=null,i=null;function a(){var s=r("reference")?(t.popperInstance?t.popperInstance.state.elements.reference:e).getBoundingClientRect():null,u=r("popper")?n.getBoundingClientRect():null;(s&&Z(o,s)||u&&Z(i,u))&&t.popperInstance&&t.popperInstance.update(),o=s,i=u,t.state.isMounted&&requestAnimationFrame(a)}return{onMount:function(){t.props.sticky&&a()}}}};function Z(t,e){return!t||!e||(t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left)}return e&&function(t){var e=document.createElement("style");e.textContent=t,e.setAttribute("data-tippy-stylesheet","");var n=document.head,r=document.querySelector("head>style,head>link");r?n.insertBefore(e,r):n.appendChild(e)}('.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}'),F.setDefaultProps({plugins:[Y,G,K,Q],render:N}),F.createSingleton=function(t,e){var n;void 0===e&&(e={});var r,o=t,i=[],a=[],s=e.overrides,u=[],f=!1;function l(){a=o.map(function(t){return c(t.props.triggerTarget||t.reference)}).reduce(function(t,e){return t.concat(e)},[])}function d(){i=o.map(function(t){return t.reference})}function v(t){o.forEach(function(e){t?e.enable():e.disable()})}function g(t){return o.map(function(e){var n=e.setProps;return e.setProps=function(o){n(o),e.reference===r&&t.setProps(o)},function(){e.setProps=n}})}function h(t,e){var n=a.indexOf(e);if(e!==r){r=e;var u=(s||[]).concat("content").reduce(function(t,e){return t[e]=o[n].props[e],t},{});t.setProps(Object.assign({},u,{getReferenceClientRect:"function"==typeof u.getReferenceClientRect?u.getReferenceClientRect:function(){var t;return null==(t=i[n])?void 0:t.getBoundingClientRect()}}))}}v(!1),d(),l();var b={fn:function(){return{onDestroy:function(){v(!0)},onHidden:function(){r=null},onClickOutside:function(t){t.props.showOnCreate&&!f&&(f=!0,r=null)},onShow:function(t){t.props.showOnCreate&&!f&&(f=!0,h(t,i[0]))},onTrigger:function(t,e){h(t,e.currentTarget)}}}},y=F(m(),Object.assign({},p(e,["overrides"]),{plugins:[b].concat(e.plugins||[]),triggerTarget:a,popperOptions:Object.assign({},e.popperOptions,{modifiers:[].concat((null==(n=e.popperOptions)?void 0:n.modifiers)||[],[W])})})),w=y.show;y.show=function(t){if(w(),!r&&null==t)return h(y,i[0]);if(!r||null!=t){if("number"==typeof t)return i[t]&&h(y,i[t]);if(o.indexOf(t)>=0){var e=t.reference;return h(y,e)}return i.indexOf(t)>=0?h(y,t):void 0}},y.showNext=function(){var t=i[0];if(!r)return y.show(0);var e=i.indexOf(r);y.show(i[e+1]||t)},y.showPrevious=function(){var t=i[i.length-1];if(!r)return y.show(t);var e=i.indexOf(r),n=i[e-1]||t;y.show(n)};var x=y.setProps;return y.setProps=function(t){s=t.overrides||s,x(t)},y.setInstances=function(t){v(!0),u.forEach(function(t){return t()}),o=t,v(!1),d(),l(),u=g(y),y.setProps({triggerTarget:a})},u=g(y),y},F.delegate=function(t,e){var n=[],o=[],i=!1,a=e.target,s=p(e,["target"]),u=Object.assign({},s,{trigger:"manual",touch:!1}),f=Object.assign({touch:R.touch},s,{showOnCreate:!0}),l=F(t,u);function d(t){if(t.target&&!i){var n=t.target.closest(a);if(n){var r=n.getAttribute("data-tippy-trigger")||e.trigger||R.trigger;if(!n._tippy&&!("touchstart"===t.type&&"boolean"==typeof f.touch||"touchstart"!==t.type&&r.indexOf(X[t.type])<0)){var s=F(n,f);s&&(o=o.concat(s))}}}}function v(t,e,r,o){void 0===o&&(o=!1),t.addEventListener(e,r,o),n.push({node:t,eventType:e,handler:r,options:o})}return c(l).forEach(function(t){var e=t.destroy,a=t.enable,s=t.disable;t.destroy=function(t){void 0===t&&(t=!0),t&&o.forEach(function(t){t.destroy()}),o=[],n.forEach(function(t){var e=t.node,n=t.eventType,r=t.handler,o=t.options;e.removeEventListener(n,r,o)}),n=[],e()},t.enable=function(){a(),o.forEach(function(t){return t.enable()}),i=!1},t.disable=function(){s(),o.forEach(function(t){return t.disable()}),i=!0},function(t){var e=t.reference;v(e,"touchstart",d,r),v(e,"mouseover",d),v(e,"focusin",d),v(e,"click",d)}(t)}),l},F.hideAll=function(t){var e=void 0===t?{}:t,n=e.exclude,r=e.duration;_.forEach(function(t){var e=!1;if(n&&(e=b(n)?t.reference===n:t.popper===n.popper),!e){var o=t.props.duration;t.setProps({duration:r}),t.hide(),t.state.isDestroyed||t.setProps({duration:o})}})},F.roundArrow='<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>',F});!function(root,factory){"function"==typeof define&&define.amd?define("sifter",factory):"object"==typeof exports?module.exports=factory():root.Sifter=factory()}(this,function(){function Sifter(items,settings){this.items=items,this.settings=settings||{diacritics:!0}}Sifter.prototype.tokenize=function(query,respect_word_boundaries){if(!(query=trim(String(query||"").toLowerCase()))||!query.length)return[];for(var regex,letter,tokens=[],words=query.split(/ +/),i=0,n=words.length;i<n;i++){if(regex=escape_regex(words[i]),this.settings.diacritics)for(letter in DIACRITICS)DIACRITICS.hasOwnProperty(letter)&&(regex=regex.replace(new RegExp(letter,"g"),DIACRITICS[letter]));respect_word_boundaries&&(regex="\\b"+regex),tokens.push({string:words[i],regex:new RegExp(regex,"i")})}return tokens},Sifter.prototype.iterator=function(object,callback){var iterator=is_array(object)?Array.prototype.forEach||function(callback){for(var i=0,n=this.length;i<n;i++)callback(this[i],i,this)}:function(callback){for(var key in this)this.hasOwnProperty(key)&&callback(this[key],key,this)};iterator.apply(object,[callback])},Sifter.prototype.getScoreFunction=function(search,options){function scoreValue(value,token){var pos;return!value||-1===(pos=(value=String(value||"")).search(token.regex))?0:(token=token.string.length/value.length,0===pos&&(token+=.5),token)}var field_count,tokens=(search=this.prepareSearch(search,options)).tokens,fields=search.options.fields,token_count=tokens.length,nesting=search.options.nesting,scoreObject=(field_count=fields.length)?1===field_count?function(token,data){return scoreValue(getattr(data,fields[0],nesting),token)}:function(token,data){for(var i=0,sum=0;i<field_count;i++)sum+=scoreValue(getattr(data,fields[i],nesting),token);return sum/field_count}:function(){return 0};return token_count?1===token_count?function(data){return scoreObject(tokens[0],data)}:"and"===search.options.conjunction?function(data){for(var score,i=0,sum=0;i<token_count;i++){if((score=scoreObject(tokens[i],data))<=0)return 0;sum+=score}return sum/token_count}:function(data){for(var i=0,sum=0;i<token_count;i++)sum+=scoreObject(tokens[i],data);return sum/token_count}:function(){return 0}},Sifter.prototype.getSortFunction=function(search,options){var i,n,field,fields_count,multiplier,multipliers,implicit_score,self=this,sort=!(search=self.prepareSearch(search,options)).query&&options.sort_empty||options.sort,get_field=function(name,result){return"$score"===name?result.score:getattr(self.items[result.id],name,options.nesting)},fields=[];if(sort)for(i=0,n=sort.length;i<n;i++)!search.query&&"$score"===sort[i].field||fields.push(sort[i]);if(search.query){for(implicit_score=!0,i=0,n=fields.length;i<n;i++)if("$score"===fields[i].field){implicit_score=!1;break}implicit_score&&fields.unshift({field:"$score",direction:"desc"})}else for(i=0,n=fields.length;i<n;i++)if("$score"===fields[i].field){fields.splice(i,1);break}for(multipliers=[],i=0,n=fields.length;i<n;i++)multipliers.push("desc"===fields[i].direction?-1:1);return(fields_count=fields.length)?1===fields_count?(field=fields[0].field,multiplier=multipliers[0],function(a,b){return multiplier*cmp(get_field(field,a),get_field(field,b))}):function(a,b){for(var field,i=0;i<fields_count;i++)if(field=fields[i].field,field=multipliers[i]*cmp(get_field(field,a),get_field(field,b)))return field;return 0}:null},Sifter.prototype.prepareSearch=function(query,options){if("object"==typeof query)return query;var option_fields=(options=extend({},options)).fields,option_sort=options.sort,option_sort_empty=options.sort_empty;return option_fields&&!is_array(option_fields)&&(options.fields=[option_fields]),option_sort&&!is_array(option_sort)&&(options.sort=[option_sort]),option_sort_empty&&!is_array(option_sort_empty)&&(options.sort_empty=[option_sort_empty]),{options:options,query:String(query||"").toLowerCase(),tokens:this.tokenize(query,options.respect_word_boundaries),total:0,items:[]}},Sifter.prototype.search=function(query,options){var score,fn_score,search=this.prepareSearch(query,options);return options=search.options,query=search.query,fn_score=options.score||this.getScoreFunction(search),query.length?this.iterator(this.items,function(item,id){score=fn_score(item),(!1===options.filter||0<score)&&search.items.push({score:score,id:id})}):this.iterator(this.items,function(item,id){search.items.push({score:1,id:id})}),(query=this.getSortFunction(search,options))&&search.items.sort(query),search.total=search.items.length,"number"==typeof options.limit&&(search.items=search.items.slice(0,options.limit)),search};var cmp=function(a,b){return"number"==typeof a&&"number"==typeof b?b<a?1:a<b?-1:0:(a=asciifold(String(a||"")),(b=asciifold(String(b||"")))<a?1:a<b?-1:0)},extend=function(a,b){for(var k,object,i=1,n=arguments.length;i<n;i++)if(object=arguments[i])for(k in object)object.hasOwnProperty(k)&&(a[k]=object[k]);return a},getattr=function(obj,name,nesting){if(obj&&name){if(!nesting)return obj[name];for(var names=name.split(".");names.length&&(obj=obj[names.shift()]););return obj}},trim=function(str){return(str+"").replace(/^\s+|\s+$|/g,"")},escape_regex=function(str){return(str+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},is_array=Array.isArray||"undefined"!=typeof $&&$.isArray||function(object){return"[object Array]"===Object.prototype.toString.call(object)},DIACRITICS={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},asciifold=function(){var i,n,k,chunk,foreignletters="",lookup={};for(k in DIACRITICS)if(DIACRITICS.hasOwnProperty(k))for(foreignletters+=chunk=DIACRITICS[k].substring(2,DIACRITICS[k].length-1),i=0,n=chunk.length;i<n;i++)lookup[chunk.charAt(i)]=k;var regexp=new RegExp("["+foreignletters+"]","g");return function(str){return str.replace(regexp,function(foreignletter){return lookup[foreignletter]}).toLowerCase()}}();return Sifter}),function(root,factory){"function"==typeof define&&define.amd?define("microplugin",factory):"object"==typeof exports?module.exports=factory():root.MicroPlugin=factory()}(this,function(){var MicroPlugin={mixin:function(Interface){Interface.plugins={},Interface.prototype.initializePlugins=function(plugins){var i,n,key,queue=[];if(this.plugins={names:[],settings:{},requested:{},loaded:{}},utils.isArray(plugins))for(i=0,n=plugins.length;i<n;i++)"string"==typeof plugins[i]?queue.push(plugins[i]):(this.plugins.settings[plugins[i].name]=plugins[i].options,queue.push(plugins[i].name));else if(plugins)for(key in plugins)plugins.hasOwnProperty(key)&&(this.plugins.settings[key]=plugins[key],queue.push(key));for(;queue.length;)this.require(queue.shift())},Interface.prototype.loadPlugin=function(name){var plugins=this.plugins,plugin=Interface.plugins[name];if(!Interface.plugins.hasOwnProperty(name))throw new Error('Unable to find "'+name+'" plugin');plugins.requested[name]=!0,plugins.loaded[name]=plugin.fn.apply(this,[this.plugins.settings[name]||{}]),plugins.names.push(name)},Interface.prototype.require=function(name){var plugins=this.plugins;if(!this.plugins.loaded.hasOwnProperty(name)){if(plugins.requested[name])throw new Error('Plugin has circular dependency ("'+name+'")');this.loadPlugin(name)}return plugins.loaded[name]},Interface.define=function(name,fn){Interface.plugins[name]={name:name,fn:fn}}}},utils={isArray:Array.isArray||function(vArg){return"[object Array]"===Object.prototype.toString.call(vArg)}};return MicroPlugin}),function(root,factory){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],factory):"object"==typeof module&&"object"==typeof module.exports?module.exports=factory(require("jquery"),require("sifter"),require("microplugin")):root.Selectize=factory(root.jQuery,root.Sifter,root.MicroPlugin)}(this,function($,Sifter,MicroPlugin){"use strict";function MicroEvent(){}$.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var parent=this.parentNode;parent.replaceChild(this.firstChild,this),parent.normalize()}).end()};function isset(object){return void 0!==object}function hash_key(value){return null==value?null:"boolean"==typeof value?value?"1":"0":value+""}function escape_html(str){return(str+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function debounce_events(self,types,fn){var type,trigger=self.trigger,event_args={};for(type in self.trigger=function(){var type=arguments[0];if(-1===types.indexOf(type))return trigger.apply(self,arguments);event_args[type]=arguments},fn.apply(self,[]),self.trigger=trigger,event_args)event_args.hasOwnProperty(type)&&trigger.apply(self,event_args[type])}function getSelection(input){var sel,selLen,result={};return void 0===input?console.warn("WARN getSelection cannot locate input control"):"selectionStart"in input?(result.start=input.selectionStart,result.length=input.selectionEnd-result.start):document.selection&&(input.focus(),sel=document.selection.createRange(),selLen=document.selection.createRange().text.length,sel.moveStart("character",-input.value.length),result.start=sel.text.length-selLen,result.length=selLen),result}function measureString(str,$parent){return str?(Selectize.$testInput||(Selectize.$testInput=$("<span />").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),$("<div />").css({position:"absolute",width:0,height:0,overflow:"hidden"}).append(Selectize.$testInput).appendTo("body")),Selectize.$testInput.text(str),transferStyles($parent,Selectize.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),Selectize.$testInput.width()):0}function autoGrow($input){function update(e,options){var printable,keyCode,selection;options=options||{},(e=e||window.event||{}).metaKey||e.altKey||!options.force&&!1===$input.data("grow")||(options=$input.val(),e.type&&"keydown"===e.type.toLowerCase()&&(printable=48<=(keyCode=e.keyCode)&&keyCode<=57||65<=keyCode&&keyCode<=90||96<=keyCode&&keyCode<=111||186<=keyCode&&keyCode<=222||32===keyCode,46===keyCode||8===keyCode?(selection=getSelection($input[0])).length?options=options.substring(0,selection.start)+options.substring(selection.start+selection.length):8===keyCode&&selection.start?options=options.substring(0,selection.start-1)+options.substring(selection.start+1):46===keyCode&&void 0!==selection.start&&(options=options.substring(0,selection.start)+options.substring(selection.start+1)):printable&&(keyCode=e.shiftKey,selection=String.fromCharCode(e.keyCode),options+=selection=keyCode?selection.toUpperCase():selection.toLowerCase())),e=(printable=$input.attr("placeholder"))?measureString(printable,$input)+4:0,(keyCode=Math.max(measureString(options,$input),e)+4)!==currentWidth&&(currentWidth=keyCode,$input.width(keyCode),$input.triggerHandler("resize")))}var currentWidth=null;$input.on("keydown keyup update blur",update),update()}MicroEvent.prototype={on:function(event,fct){this._events=this._events||{},this._events[event]=this._events[event]||[],this._events[event].push(fct)},off:function(event,fct){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[event]:(this._events=this._events||{},void(event in this._events!=!1&&this._events[event].splice(this._events[event].indexOf(fct),1)))},trigger:function(event){if(this._events=this._events||{},event in this._events!=!1)for(var i=0;i<this._events[event].length;i++)this._events[event][i].apply(this,Array.prototype.slice.call(arguments,1))}},MicroEvent.mixin=function(destObject){for(var props=["on","off","trigger"],i=0;i<props.length;i++)destObject.prototype[props[i]]=MicroEvent.prototype[props[i]]};var options,IS_MAC=/Mac/.test(navigator.userAgent),KEY_CMD=IS_MAC?91:17,KEY_CTRL=IS_MAC?18:17,SUPPORTS_VALIDITY_API=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,hook={before:function(self,method,fn){var original=self[method];self[method]=function(){return fn.apply(self,arguments),original.apply(self,arguments)}},after:function(self,method,fn){var original=self[method];self[method]=function(){var result=original.apply(self,arguments);return fn.apply(self,arguments),result}}},transferStyles=function($from,$to,properties){var i,n,styles={};if(properties)for(i=0,n=properties.length;i<n;i++)styles[properties[i]]=$from.css(properties[i]);else styles=$from.css();$to.css(styles)},Selectize=function($input,settings){var i,n,fn,delay,timeout,input=$input[0],computedStyle=(input.selectize=this,window.getComputedStyle&&window.getComputedStyle(input,null));if(computedStyle=(computedStyle?computedStyle.getPropertyValue("direction"):input.currentStyle&&input.currentStyle.direction)||$input.parents("[dir]:first").attr("dir")||"",$.extend(this,{order:0,settings:settings,$input:$input,tabIndex:$input.attr("tabindex")||"",tagType:"select"===input.tagName.toLowerCase()?1:2,rtl:/rtl/i.test(computedStyle),eventNS:".selectize"+ ++Selectize.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:$input.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",lastValidValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===settings.loadThrottle?this.onSearchChange:(fn=this.onSearchChange,delay=settings.loadThrottle,function(){var self=this,args=arguments;window.clearTimeout(timeout),timeout=window.setTimeout(function(){fn.apply(self,args)},delay)})}),this.sifter=new Sifter(this.options,{diacritics:settings.diacritics}),this.settings.options){for(i=0,n=this.settings.options.length;i<n;i++)this.registerOption(this.settings.options[i]);delete this.settings.options}if(this.settings.optgroups){for(i=0,n=this.settings.optgroups.length;i<n;i++)this.registerOptionGroup(this.settings.optgroups[i]);delete this.settings.optgroups}this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),"boolean"!=typeof this.settings.hideSelected&&(this.settings.hideSelected="multi"===this.settings.mode),this.initializePlugins(this.settings.plugins),this.setupCallbacks(),this.setupTemplates(),this.setup()};return MicroEvent.mixin(Selectize),void 0!==MicroPlugin?MicroPlugin.mixin(Selectize):(MicroPlugin="Dependency MicroPlugin is missing",options=(options={explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'})||{},console.error("Selectize: "+MicroPlugin),options.explanation&&(console.group&&console.group(),console.error(options.explanation),console.group&&console.groupEnd())),$.extend(Selectize.prototype,{setup:function(){var $parent,inputId,fn,self=this,settings=self.settings,eventNS=self.eventNS,$window=$(window),$document=$(document),$input=self.$input,inputMode=self.settings.mode,classes=$input.attr("class")||"",$wrapper=$("<div>").addClass(settings.wrapperClass).addClass(classes).addClass(inputMode),$control=$("<div>").addClass(settings.inputClass).addClass("items").appendTo($wrapper),$control_input=$('<input type="text" autocomplete="new-password" autofill="no" />').appendTo($control).attr("tabindex",$input.is(":disabled")?"-1":self.tabIndex),$dropdown_parent=$(settings.dropdownParent||$wrapper),inputMode=$("<div>").addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent),$dropdown_parent=$("<div>").addClass(settings.dropdownContentClass).attr("tabindex","-1").appendTo(inputMode);(inputId=$input.attr("id"))&&($control_input.attr("id",inputId+"-selectized"),$("label[for='"+inputId+"']").attr("for",inputId+"-selectized")),self.settings.copyClassesToDropdown&&inputMode.addClass(classes),$wrapper.css({width:$input[0].style.width}),self.plugins.names.length&&(inputId="plugin-"+self.plugins.names.join(" plugin-"),$wrapper.addClass(inputId),inputMode.addClass(inputId)),(null===settings.maxItems||1<settings.maxItems)&&1===self.tagType&&$input.attr("multiple","multiple"),self.settings.placeholder&&$control_input.attr("placeholder",settings.placeholder),!self.settings.splitOn&&self.settings.delimiter&&(classes=self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),self.settings.splitOn=new RegExp("\\s*"+classes+"+\\s*")),$input.attr("autocorrect")&&$control_input.attr("autocorrect",$input.attr("autocorrect")),$input.attr("autocapitalize")&&$control_input.attr("autocapitalize",$input.attr("autocapitalize")),$input.is("input")&&($control_input[0].type=$input[0].type),self.$wrapper=$wrapper,self.$control=$control,self.$control_input=$control_input,self.$dropdown=inputMode,self.$dropdown_content=$dropdown_parent,inputMode.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",function(e){e.stopImmediatePropagation()}),inputMode.on("mouseenter","[data-selectable]",function(){return self.onOptionHover.apply(self,arguments)}),inputMode.on("mousedown click","[data-selectable]",function(){return self.onOptionSelect.apply(self,arguments)}),inputId="mousedown",classes="*:not(input)",fn=function(){return self.onItemSelect.apply(self,arguments)},($parent=$control).on(inputId,classes,function(e){for(var child=e.target;child&&child.parentNode!==$parent[0];)child=child.parentNode;return e.currentTarget=child,fn.apply(this,[e])}),autoGrow($control_input),$control.on({mousedown:function(){return self.onMouseDown.apply(self,arguments)},click:function(){return self.onClick.apply(self,arguments)}}),$control_input.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return self.onKeyDown.apply(self,arguments)},keypress:function(){return self.onKeyPress.apply(self,arguments)},input:function(){return self.onInput.apply(self,arguments)},resize:function(){self.positionDropdown.apply(self,[])},blur:function(){return self.onBlur.apply(self,arguments)},focus:function(){return self.ignoreBlur=!1,self.onFocus.apply(self,arguments)},paste:function(){return self.onPaste.apply(self,arguments)}}),$document.on("keydown"+eventNS,function(e){self.isCmdDown=e[IS_MAC?"metaKey":"ctrlKey"],self.isCtrlDown=e[IS_MAC?"altKey":"ctrlKey"],self.isShiftDown=e.shiftKey}),$document.on("keyup"+eventNS,function(e){e.keyCode===KEY_CTRL&&(self.isCtrlDown=!1),16===e.keyCode&&(self.isShiftDown=!1),e.keyCode===KEY_CMD&&(self.isCmdDown=!1)}),$document.on("mousedown"+eventNS,function(e){if(self.isFocused){if(e.target===self.$dropdown[0]||e.target.parentNode===self.$dropdown[0])return!1;self.$control.has(e.target).length||e.target===self.$control[0]||self.blur(e.target)}}),$window.on(["scroll"+eventNS,"resize"+eventNS].join(" "),function(){self.isOpen&&self.positionDropdown.apply(self,arguments)}),$window.on("mousemove"+eventNS,function(){self.ignoreHover=!1}),this.revertSettings={$children:$input.children().detach(),tabindex:$input.attr("tabindex")},$input.attr("tabindex",-1).hide().after(self.$wrapper),Array.isArray(settings.items)&&(self.lastValidValue=settings.items,self.setValue(settings.items),delete settings.items),SUPPORTS_VALIDITY_API&&$input.on("invalid"+eventNS,function(e){e.preventDefault(),self.isInvalid=!0,self.refreshState()}),self.updateOriginalInput(),self.refreshItems(),self.refreshState(),self.updatePlaceholder(),self.isSetup=!0,$input.is(":disabled")&&self.disable(),self.on("change",this.onChange),$input.data("selectize",self),$input.addClass("selectized"),self.trigger("initialize"),!0===settings.preload&&self.onSearchChange("")},setupTemplates:function(){var field_label=this.settings.labelField,field_value=this.settings.valueField,field_optgroup=this.settings.optgroupLabelField;this.settings.render=$.extend({},{optgroup:function(data){return'<div class="optgroup">'+data.html+"</div>"},optgroup_header:function(data,escape){return'<div class="optgroup-header">'+escape(data[field_optgroup])+"</div>"},option:function(data,escape){return'<div class="option '+(""===data[field_value]?"selectize-dropdown-emptyoptionlabel":"")+'">'+escape(data[field_label])+"</div>"},item:function(data,escape){return'<div class="item">'+escape(data[field_label])+"</div>"},option_create:function(data,escape){return'<div class="create">Add <strong>'+escape(data.input)+"</strong>…</div>"}},this.settings.render)},setupCallbacks:function(){var key,fn,callbacks={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(key in callbacks)callbacks.hasOwnProperty(key)&&(fn=this.settings[callbacks[key]])&&this.on(key,fn)},onClick:function(e){this.isFocused&&this.isOpen||(this.focus(),e.preventDefault())},onMouseDown:function(e){var self=this,defaultPrevented=e.isDefaultPrevented();$(e.target);if(self.isFocused){if(e.target!==self.$control_input[0])return"single"===self.settings.mode?self.isOpen?self.close():self.open():defaultPrevented||self.setActiveItem(null),!1}else defaultPrevented||window.setTimeout(function(){self.focus()},0)},onChange:function(){""!==this.getValue()&&(this.lastValidValue=this.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(e){var self=this;self.isFull()||self.isInputHidden||self.isLocked?e.preventDefault():self.settings.splitOn&&setTimeout(function(){var pastedText=self.$control_input.val();if(pastedText.match(self.settings.splitOn))for(var splitInput=pastedText.trim().split(self.settings.splitOn),i=0,n=splitInput.length;i<n;i++)self.createItem(splitInput[i])},0)},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var character=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&character===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){var $next;e.target,this.$control_input[0];if(this.isLocked)9!==e.keyCode&&e.preventDefault();else{switch(e.keyCode){case 65:if(this.isCmdDown)return void this.selectAll();break;case 27:return void(this.isOpen&&(e.preventDefault(),e.stopPropagation(),this.close()));case 78:if(!e.ctrlKey||e.altKey)break;case 40:return!this.isOpen&&this.hasOptions?this.open():this.$activeOption&&(this.ignoreHover=!0,($next=this.getAdjacentOption(this.$activeOption,1)).length&&this.setActiveOption($next,!0,!0)),void e.preventDefault();case 80:if(!e.ctrlKey||e.altKey)break;case 38:return this.$activeOption&&(this.ignoreHover=!0,($next=this.getAdjacentOption(this.$activeOption,-1)).length&&this.setActiveOption($next,!0,!0)),void e.preventDefault();case 13:return void(this.isOpen&&this.$activeOption&&(this.onOptionSelect({currentTarget:this.$activeOption}),e.preventDefault()));case 37:return void this.advanceSelection(-1,e);case 39:return void this.advanceSelection(1,e);case 9:return this.settings.selectOnTab&&this.isOpen&&this.$activeOption&&(this.onOptionSelect({currentTarget:this.$activeOption}),this.isFull()||e.preventDefault()),void(this.settings.create&&this.createItem()&&this.settings.showAddOptionOnCreate&&e.preventDefault());case 8:case 46:return void this.deleteSelection(e)}!this.isFull()&&!this.isInputHidden||(IS_MAC?e.metaKey:e.ctrlKey)||e.preventDefault()}},onInput:function(e){var value=this.$control_input.val()||"";this.lastValue!==value&&(this.lastValue=value,this.onSearchChange(value),this.refreshOptions(),this.trigger("type",value))},onSearchChange:function(value){var self=this,fn=self.settings.load;fn&&!self.loadedSearches.hasOwnProperty(value)&&(self.loadedSearches[value]=!0,self.load(function(callback){fn.apply(self,[value,callback])}))},onFocus:function(e){var wasFocused=this.isFocused;if(this.isDisabled)return this.blur(),e&&e.preventDefault(),!1;this.ignoreFocus||(this.isFocused=!0,"focus"===this.settings.preload&&this.onSearchChange(""),wasFocused||this.trigger("focus"),this.$activeItems.length||(this.showInput(),this.setActiveItem(null),this.refreshOptions(!!this.settings.openOnFocus)),this.refreshState())},onBlur:function(e,dest){var self=this;if(self.isFocused&&(self.isFocused=!1,!self.ignoreFocus)){if(!self.ignoreBlur&&document.activeElement===self.$dropdown_content[0])return self.ignoreBlur=!0,void self.onFocus(e);e=function(){self.close(),self.setTextboxValue(""),self.setActiveItem(null),self.setActiveOption(null),self.setCaret(self.items.length),self.refreshState(),dest&&dest.focus&&dest.focus(),self.isBlurring=!1,self.ignoreFocus=!1,self.trigger("blur")};self.isBlurring=!0,self.ignoreFocus=!0,self.settings.create&&self.settings.createOnBlur?self.createItem(null,!1,e):e()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(e){var $target,self=this;e.preventDefault&&(e.preventDefault(),e.stopPropagation()),($target=$(e.currentTarget)).hasClass("create")?self.createItem(null,function(){self.settings.closeAfterSelect&&self.close()}):void 0!==($target=$target.attr("data-value"))&&(self.lastQuery=null,self.setTextboxValue(""),self.addItem($target),self.settings.closeAfterSelect?self.close():!self.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&self.setActiveOption(self.getOption($target)))},onItemSelect:function(e){this.isLocked||"multi"===this.settings.mode&&(e.preventDefault(),this.setActiveItem(e.currentTarget,e))},load:function(fn){var self=this,$wrapper=self.$wrapper.addClass(self.settings.loadingClass);self.loading++,fn.apply(self,[function(results){self.loading=Math.max(self.loading-1,0),results&&results.length&&(self.addOption(results),self.refreshOptions(self.isFocused&&!self.isInputHidden)),self.loading||$wrapper.removeClass(self.settings.loadingClass),self.trigger("load",results)}])},getTextboxValue:function(){return this.$control_input.val()},setTextboxValue:function(value){var $input=this.$control_input;$input.val()!==value&&($input.val(value).triggerHandler("update"),this.lastValue=value)},getValue:function(){return 1===this.tagType&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(value,silent){debounce_events(this,silent?[]:["change"],function(){this.clear(silent),this.addItems(value,silent)})},setMaxItems:function(value){this.settings.maxItems=value=0===value?null:value,this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),this.refreshState()},setActiveItem:function($item,e){var eventName,i,end,item,swap,$last;if("single"!==this.settings.mode){if(!($item=$($item)).length)return $(this.$activeItems).removeClass("active"),this.$activeItems=[],void(this.isFocused&&this.showInput());if("mousedown"===(eventName=e&&e.type.toLowerCase())&&this.isShiftDown&&this.$activeItems.length){for($last=this.$control.children(".active:last"),$last=Array.prototype.indexOf.apply(this.$control[0].childNodes,[$last[0]]),(end=Array.prototype.indexOf.apply(this.$control[0].childNodes,[$item[0]]))<$last&&(swap=$last,$last=end,end=swap),i=$last;i<=end;i++)item=this.$control[0].childNodes[i],-1===this.$activeItems.indexOf(item)&&($(item).addClass("active"),this.$activeItems.push(item));e.preventDefault()}else"mousedown"===eventName&&this.isCtrlDown||"keydown"===eventName&&this.isShiftDown?$item.hasClass("active")?(swap=this.$activeItems.indexOf($item[0]),this.$activeItems.splice(swap,1),$item.removeClass("active")):this.$activeItems.push($item.addClass("active")[0]):($(this.$activeItems).removeClass("active"),this.$activeItems=[$item.addClass("active")[0]]);this.hideInput(),this.isFocused||this.focus()}},setActiveOption:function($option,scroll,animate){var height_item,y,scroll_top,scroll_bottom;this.$activeOption&&(this.$activeOption.removeClass("active"),this.trigger("dropdown_item_deactivate",this.$activeOption.attr("data-value"))),this.$activeOption=null,($option=$($option)).length&&(this.$activeOption=$option.addClass("active"),this.isOpen&&this.trigger("dropdown_item_activate",this.$activeOption.attr("data-value")),!scroll&&isset(scroll)||($option=this.$dropdown_content.height(),height_item=this.$activeOption.outerHeight(!0),scroll=this.$dropdown_content.scrollTop()||0,scroll_bottom=(scroll_top=y=this.$activeOption.offset().top-this.$dropdown_content.offset().top+scroll)-$option+height_item,$option+scroll<y+height_item?this.$dropdown_content.stop().animate({scrollTop:scroll_bottom},animate?this.settings.scrollDuration:0):y<scroll&&this.$dropdown_content.stop().animate({scrollTop:scroll_top},animate?this.settings.scrollDuration:0)))},selectAll:function(){"single"!==this.settings.mode&&(this.$activeItems=Array.prototype.slice.apply(this.$control.children(":not(input)").addClass("active")),this.$activeItems.length&&(this.hideInput(),this.close()),this.focus())},hideInput:function(){this.setTextboxValue(""),this.$control_input.css({opacity:0,position:"absolute",left:this.rtl?1e4:-1e4}),this.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var self=this;return self.isDisabled||(self.ignoreFocus=!0,self.$control_input[0].focus(),window.setTimeout(function(){self.ignoreFocus=!1,self.onFocus()},0)),self},blur:function(dest){return this.$control_input[0].blur(),this.onBlur(null,dest),this},getScoreFunction:function(query){return this.sifter.getScoreFunction(query,this.getSearchOptions())},getSearchOptions:function(){var settings=this.settings,sort=settings.sortField;return{fields:settings.searchField,conjunction:settings.searchConjunction,sort:sort="string"==typeof sort?[{field:sort}]:sort,nesting:settings.nesting}},search:function(query){var i,result,calculateScore,settings=this.settings,options=this.getSearchOptions();if(settings.score&&"function"!=typeof(calculateScore=this.settings.score.apply(this,[query])))throw new Error('Selectize "score" setting must be a function that returns a function');if(query!==this.lastQuery?(this.lastQuery=query,result=this.sifter.search(query,$.extend(options,{score:calculateScore})),this.currentResults=result):result=$.extend(!0,{},this.currentResults),settings.hideSelected)for(i=result.items.length-1;0<=i;i--)-1!==this.items.indexOf(hash_key(result.items[i].id))&&result.items.splice(i,1);return result},refreshOptions:function(triggerDropdown){void 0===triggerDropdown&&(triggerDropdown=!0);var i,j,k,groups,groups_order,option,option_html,optgroup,optgroups,html,html_children,has_create_option,$active,$create,d,tmp,self=this,query=self.$control_input.val().trim(),results=self.search(query),$dropdown_content=self.$dropdown_content,active_before=self.$activeOption&&hash_key(self.$activeOption.attr("data-value")),n=results.items.length;for("number"==typeof self.settings.maxOptions&&(n=Math.min(n,self.settings.maxOptions)),groups={},groups_order=[],i=0;i<n;i++)for(option=self.options[results.items[i].id],option_html=self.render("option",option),optgroup=option[self.settings.optgroupField]||"",j=0,k=(optgroups=Array.isArray(optgroup)?optgroup:[optgroup])&&optgroups.length;j<k;j++)optgroup=optgroups[j],self.optgroups.hasOwnProperty(optgroup)||(optgroup=""),groups.hasOwnProperty(optgroup)||(groups[optgroup]=document.createDocumentFragment(),groups_order.push(optgroup)),groups[optgroup].appendChild(option_html);for(this.settings.lockOptgroupOrder&&groups_order.sort(function(a,b){return(self.optgroups[a]&&self.optgroups[a].$order||0)-(self.optgroups[b]&&self.optgroups[b].$order||0)}),html=document.createDocumentFragment(),i=0,n=groups_order.length;i<n;i++)optgroup=groups_order[i],self.optgroups.hasOwnProperty(optgroup)&&groups[optgroup].childNodes.length?((html_children=document.createDocumentFragment()).appendChild(self.render("optgroup_header",self.optgroups[optgroup])),html_children.appendChild(groups[optgroup]),html.appendChild(self.render("optgroup",$.extend({},self.optgroups[optgroup],{html:(d=html_children,tmp=void 0,(tmp=document.createElement("div")).appendChild(d.cloneNode(!0)),tmp.innerHTML),dom:html_children})))):html.appendChild(groups[optgroup]);if($dropdown_content.html(html),self.settings.highlight&&($dropdown_content.removeHighlight(),results.query.length&&results.tokens.length))for(i=0,n=results.tokens.length;i<n;i++)!function($element,pattern){var regex,highlight;if("string"!=typeof pattern||pattern.length)regex="string"==typeof pattern?new RegExp(pattern,"i"):pattern,highlight=function(node){var skip=0;if(3===node.nodeType){var spannode,match,pos=node.data.search(regex);0<=pos&&0<node.data.length&&(match=node.data.match(regex),(spannode=document.createElement("span")).className="highlight",(pos=node.splitText(pos)).splitText(match[0].length),match=pos.cloneNode(!0),spannode.appendChild(match),pos.parentNode.replaceChild(spannode,pos),skip=1)}else if(1===node.nodeType&&node.childNodes&&!/(script|style)/i.test(node.tagName)&&("highlight"!==node.className||"SPAN"!==node.tagName))for(var i=0;i<node.childNodes.length;++i)i+=highlight(node.childNodes[i]);return skip},$element.each(function(){highlight(this)})}($dropdown_content,results.tokens[i].regex);if(!self.settings.hideSelected)for(self.$dropdown.find(".selected").removeClass("selected"),i=0,n=self.items.length;i<n;i++)self.getOption(self.items[i]).addClass("selected");(has_create_option=self.canCreate(query))&&self.settings.showAddOptionOnCreate&&($dropdown_content.prepend(self.render("option_create",{input:query})),$create=$($dropdown_content[0].childNodes[0])),self.hasOptions=0<results.items.length||has_create_option&&self.settings.showAddOptionOnCreate,self.hasOptions?(0<results.items.length?(query=active_before&&self.getOption(active_before),""!==results.query&&query&&query.length?$active=query:"single"===self.settings.mode&&self.items.length&&($active=self.getOption(self.items[0])),$active&&$active.length||($active=$create&&!self.settings.addPrecedence?self.getAdjacentOption($create,1):$dropdown_content.find("[data-selectable]:first"))):$active=$create,self.setActiveOption($active),triggerDropdown&&!self.isOpen&&self.open()):(self.setActiveOption(null),triggerDropdown&&self.isOpen&&self.close())},addOption:function(data){var i,n,value;if(Array.isArray(data))for(i=0,n=data.length;i<n;i++)this.addOption(data[i]);else(value=this.registerOption(data))&&(this.userOptions[value]=!0,this.lastQuery=null,this.trigger("option_add",value,data))},registerOption:function(data){var key=hash_key(data[this.settings.valueField]);return null!=key&&!this.options.hasOwnProperty(key)&&(data.$order=data.$order||++this.order,this.options[key]=data,key)},registerOptionGroup:function(data){var key=hash_key(data[this.settings.optgroupValueField]);return!!key&&(data.$order=data.$order||++this.order,this.optgroups[key]=data,key)},addOptionGroup:function(id,data){data[this.settings.optgroupValueField]=id,(id=this.registerOptionGroup(data))&&this.trigger("optgroup_add",id,data)},removeOptionGroup:function(id){this.optgroups.hasOwnProperty(id)&&(delete this.optgroups[id],this.renderCache={},this.trigger("optgroup_remove",id))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(value,data){var value_new,index_item,order_old;if(value=hash_key(value),value_new=hash_key(data[this.settings.valueField]),null!==value&&this.options.hasOwnProperty(value)){if("string"!=typeof value_new)throw new Error("Value must be set in option data");order_old=this.options[value].$order,value_new!==value&&(delete this.options[value],-1!==(index_item=this.items.indexOf(value))&&this.items.splice(index_item,1,value_new)),data.$order=data.$order||order_old,this.options[value_new]=data,index_item=this.renderCache.item,order_old=this.renderCache.option,index_item&&(delete index_item[value],delete index_item[value_new]),order_old&&(delete order_old[value],delete order_old[value_new]),-1!==this.items.indexOf(value_new)&&(index_item=this.getItem(value),order_old=$(this.render("item",data)),index_item.hasClass("active")&&order_old.addClass("active"),index_item.replaceWith(order_old)),this.lastQuery=null,this.isOpen&&this.refreshOptions(!1)}},removeOption:function(value,silent){value=hash_key(value);var cache_items=this.renderCache.item,cache_options=this.renderCache.option;cache_items&&delete cache_items[value],cache_options&&delete cache_options[value],delete this.userOptions[value],delete this.options[value],this.lastQuery=null,this.trigger("option_remove",value),this.removeItem(value,silent)},clearOptions:function(silent){var self=this,options=(self.loadedSearches={},self.userOptions={},self.renderCache={},self.options);$.each(self.options,function(key,value){-1==self.items.indexOf(key)&&delete options[key]}),self.options=self.sifter.items=options,self.lastQuery=null,self.trigger("option_clear"),self.clear(silent)},getOption:function(value){return this.getElementWithValue(value,this.$dropdown_content.find("[data-selectable]"))},getFirstOption:function(){var $options=this.$dropdown.find("[data-selectable]");return 0<$options.length?$options.eq(0):$()},getAdjacentOption:function($option,direction){var $options=this.$dropdown.find("[data-selectable]"),$option=$options.index($option)+direction;return 0<=$option&&$option<$options.length?$options.eq($option):$()},getElementWithValue:function(value,$els){if(null!=(value=hash_key(value)))for(var i=0,n=$els.length;i<n;i++)if($els[i].getAttribute("data-value")===value)return $($els[i]);return $()},getElementWithTextContent:function(textContent,ignoreCase,$els){if(null!=(textContent=hash_key(textContent)))for(var i=0,n=$els.length;i<n;i++){var eleTextContent=$els[i].textContent;if(1==ignoreCase&&(eleTextContent=null!==eleTextContent?eleTextContent.toLowerCase():null,textContent=textContent.toLowerCase()),eleTextContent===textContent)return $($els[i])}return $()},getItem:function(value){return this.getElementWithValue(value,this.$control.children())},getFirstItemMatchedByTextContent:function(textContent,ignoreCase){return this.getElementWithTextContent(textContent,ignoreCase=null!==ignoreCase&&!0===ignoreCase,this.$dropdown_content.find("[data-selectable]"))},addItems:function(values,silent){this.buffer=document.createDocumentFragment();for(var childNodes=this.$control[0].childNodes,i=0;i<childNodes.length;i++)this.buffer.appendChild(childNodes[i]);for(var items=Array.isArray(values)?values:[values],i=0,n=items.length;i<n;i++)this.isPending=i<n-1,this.addItem(items[i],silent);values=this.$control[0];values.insertBefore(this.buffer,values.firstChild),this.buffer=null},addItem:function(value,silent){debounce_events(this,silent?[]:["change"],function(){var $item,$option,wasFull,inputMode=this.settings.mode;value=hash_key(value),-1!==this.items.indexOf(value)?"single"===inputMode&&this.close():this.options.hasOwnProperty(value)&&("single"===inputMode&&this.clear(silent),"multi"===inputMode&&this.isFull()||($item=$(this.render("item",this.options[value])),wasFull=this.isFull(),this.items.splice(this.caretPos,0,value),this.insertAtCaret($item),this.isPending&&(wasFull||!this.isFull())||this.refreshState(),this.isSetup&&(wasFull=this.$dropdown_content.find("[data-selectable]"),this.isPending||($option=this.getOption(value),$option=this.getAdjacentOption($option,1).attr("data-value"),this.refreshOptions(this.isFocused&&"single"!==inputMode),$option&&this.setActiveOption(this.getOption($option))),!wasFull.length||this.isFull()?this.close():this.isPending||this.positionDropdown(),this.updatePlaceholder(),this.trigger("item_add",value,$item),this.isPending||this.updateOriginalInput({silent:silent}))))})},removeItem:function(value,silent){var i,idx,$item=value instanceof $?value:this.getItem(value);value=hash_key($item.attr("data-value")),-1!==(i=this.items.indexOf(value))&&(this.trigger("item_before_remove",value,$item),$item.remove(),$item.hasClass("active")&&(idx=this.$activeItems.indexOf($item[0]),this.$activeItems.splice(idx,1)),this.items.splice(i,1),this.lastQuery=null,!this.settings.persist&&this.userOptions.hasOwnProperty(value)&&this.removeOption(value,silent),i<this.caretPos&&this.setCaret(this.caretPos-1),this.refreshState(),this.updatePlaceholder(),this.updateOriginalInput({silent:silent}),this.positionDropdown(),this.trigger("item_remove",value,$item))},createItem:function(input,triggerDropdown){var self=this,caret=self.caretPos,callback=(input=input||(self.$control_input.val()||"").trim(),arguments[arguments.length-1]);if("function"!=typeof callback&&(callback=function(){}),"boolean"!=typeof triggerDropdown&&(triggerDropdown=!0),!self.canCreate(input))return callback(),!1;self.lock();var fn,called,setup="function"==typeof self.settings.create?this.settings.create:function(input){var data={},input=data[self.settings.labelField]=input;if(!self.settings.formatValueToKey||"function"!=typeof self.settings.formatValueToKey||null!=(input=self.settings.formatValueToKey.apply(this,[input]))&&"object"!=typeof input&&"function"!=typeof input)return data[self.settings.valueField]=input,data;throw new Error('Selectize "formatValueToKey" setting must be a function that returns a value other than object or function.')},create=(called=!(fn=function(data){return self.unlock(),!data||"object"!=typeof data||"string"!=typeof(value=hash_key(data[self.settings.valueField]))?callback():(self.setTextboxValue(""),self.addOption(data),self.setCaret(caret),self.addItem(value),self.refreshOptions(triggerDropdown&&"single"!==self.settings.mode),void callback(data));var value}),function(){called||(called=!0,fn.apply(this,arguments))}),setup=setup.apply(this,[input,create]);return void 0!==setup&&create(setup),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var invalid=!this.items.length;this.isInvalid=invalid,this.$control_input.prop("required",invalid),this.$input.prop("required",!invalid)},refreshClasses:function(){var isFull=this.isFull(),isLocked=this.isLocked;this.$wrapper.toggleClass("rtl",this.rtl),this.$control.toggleClass("focus",this.isFocused).toggleClass("disabled",this.isDisabled).toggleClass("required",this.isRequired).toggleClass("invalid",this.isInvalid).toggleClass("locked",isLocked).toggleClass("full",isFull).toggleClass("not-full",!isFull).toggleClass("input-active",this.isFocused&&!this.isInputHidden).toggleClass("dropdown-active",this.isOpen).toggleClass("has-options",!$.isEmptyObject(this.options)).toggleClass("has-items",0<this.items.length),this.$control_input.data("grow",!isFull&&!isLocked)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(opts){var i,n,options,label;if(opts=opts||{},1===this.tagType){for(options=[],i=0,n=this.items.length;i<n;i++)label=this.options[this.items[i]][this.settings.labelField]||"",options.push('<option value="'+escape_html(this.items[i])+'" selected="selected">'+escape_html(label)+"</option>");options.length||this.$input.attr("multiple")||options.push('<option value="" selected="selected"></option>'),this.$input.html(options.join(""))}else this.$input.val(this.getValue()),this.$input.attr("value",this.$input.val());this.isSetup&&!opts.silent&&this.trigger("change",this.$input.val())},updatePlaceholder:function(){var $input;this.settings.placeholder&&($input=this.$control_input,this.items.length?$input.removeAttr("placeholder"):$input.attr("placeholder",this.settings.placeholder),$input.triggerHandler("update",{force:!0}))},open:function(){this.isLocked||this.isOpen||"multi"===this.settings.mode&&this.isFull()||(this.focus(),this.isOpen=!0,this.refreshState(),this.$dropdown.css({visibility:"hidden",display:"block"}),this.positionDropdown(),this.$dropdown.css({visibility:"visible"}),this.trigger("dropdown_open",this.$dropdown))},close:function(){var trigger=this.isOpen;"single"===this.settings.mode&&this.items.length&&(this.hideInput(),this.isBlurring&&this.$control_input.blur()),this.isOpen=!1,this.$dropdown.hide(),this.setActiveOption(null),this.refreshState(),trigger&&this.trigger("dropdown_close",this.$dropdown)},positionDropdown:function(){var $control=this.$control,offset="body"===this.settings.dropdownParent?$control.offset():$control.position();offset.top+=$control.outerHeight(!0),this.$dropdown.css({width:$control[0].getBoundingClientRect().width,top:offset.top,left:offset.left})},clear:function(silent){this.items.length&&(this.$control.children(":not(input)").remove(),this.items=[],this.lastQuery=null,this.setCaret(0),this.setActiveItem(null),this.updatePlaceholder(),this.updateOriginalInput({silent:silent}),this.refreshState(),this.showInput(),this.trigger("clear"))},insertAtCaret:function($el){var caret=Math.min(this.caretPos,this.items.length),$el=$el[0],target=this.buffer||this.$control[0];0===caret?target.insertBefore($el,target.firstChild):target.insertBefore($el,target.childNodes[caret]),this.setCaret(caret+1)},deleteSelection:function(e){var i,n,values,option_select,$tail,direction=e&&8===e.keyCode?-1:1,selection=getSelection(this.$control_input[0]);if(this.$activeOption&&!this.settings.hideSelected&&(option_select=("string"==typeof this.settings.deselectBehavior&&"top"===this.settings.deselectBehavior?this.getFirstOption():this.getAdjacentOption(this.$activeOption,-1)).attr("data-value")),values=[],this.$activeItems.length){for($tail=this.$control.children(".active:"+(0<direction?"last":"first")),$tail=this.$control.children(":not(input)").index($tail),0<direction&&$tail++,i=0,n=this.$activeItems.length;i<n;i++)values.push($(this.$activeItems[i]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(this.isFocused||"single"===this.settings.mode)&&this.items.length&&(direction<0&&0===selection.start&&0===selection.length?values.push(this.items[this.caretPos-1]):0<direction&&selection.start===this.$control_input.val().length&&values.push(this.items[this.caretPos]));if(!values.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete.apply(this,[values]))return!1;for(void 0!==$tail&&this.setCaret($tail);values.length;)this.removeItem(values.pop());return this.showInput(),this.positionDropdown(),this.refreshOptions(!0),option_select&&(e=this.getOption(option_select)).length&&this.setActiveOption(e),!0},advanceSelection:function(direction,e){var tail,valueLength,selection;0!==direction&&(this.rtl&&(direction*=-1),tail=0<direction?"last":"first",selection=getSelection(this.$control_input[0]),this.isFocused&&!this.isInputHidden?(valueLength=this.$control_input.val().length,(direction<0?0!==selection.start||0!==selection.length:selection.start!==valueLength)||valueLength||this.advanceCaret(direction,e)):(selection=this.$control.children(".active:"+tail)).length&&(valueLength=this.$control.children(":not(input)").index(selection),this.setActiveItem(null),this.setCaret(0<direction?valueLength+1:valueLength)))},advanceCaret:function(direction,e){var $adj;0!==direction&&(this.isShiftDown?($adj=this.$control_input[0<direction?"next":"prev"]()).length&&(this.hideInput(),this.setActiveItem($adj),e&&e.preventDefault()):this.setCaret(this.caretPos+direction))},setCaret:function(i){if(i="single"===this.settings.mode?this.items.length:Math.max(0,Math.min(this.items.length,i)),!this.isPending)for(var $child,$children=this.$control.children(":not(input)"),j=0,n=$children.length;j<n;j++)$child=$($children[j]).detach(),j<i?this.$control_input.before($child):this.$control.append($child);this.caretPos=i},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){this.$input.prop("disabled",!0),this.$control_input.prop("disabled",!0).prop("tabindex",-1),this.isDisabled=!0,this.lock()},enable:function(){this.$input.prop("disabled",!1),this.$control_input.prop("disabled",!1).prop("tabindex",this.tabIndex),this.isDisabled=!1,this.unlock()},destroy:function(){var eventNS=this.eventNS,revertSettings=this.revertSettings;this.trigger("destroy"),this.off(),this.$wrapper.remove(),this.$dropdown.remove(),this.$input.html("").append(revertSettings.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:revertSettings.tabindex}).show(),this.$control_input.removeData("grow"),this.$input.removeData("selectize"),0==--Selectize.count&&Selectize.$testInput&&(Selectize.$testInput.remove(),Selectize.$testInput=void 0),$(window).off(eventNS),$(document).off(eventNS),$(document.body).off(eventNS),delete this.$input[0].selectize},render:function(templateName,data){var value,id,html="",cache=!1;return(cache="option"!==templateName&&"item"!==templateName?cache:!!(value=hash_key(data[this.settings.valueField])))&&(isset(this.renderCache[templateName])||(this.renderCache[templateName]={}),this.renderCache[templateName].hasOwnProperty(value))?this.renderCache[templateName][value]:(html=$(this.settings.render[templateName].apply(this,[data,escape_html])),"option"===templateName||"option_create"===templateName?data[this.settings.disabledField]||html.attr("data-selectable",""):"optgroup"===templateName&&(id=data[this.settings.optgroupValueField]||"",html.attr("data-group",id),data[this.settings.disabledField]&&html.attr("data-disabled","")),"option"!==templateName&&"item"!==templateName||html.attr("data-value",value||""),cache&&(this.renderCache[templateName][value]=html[0]),html[0])},clearCache:function(templateName){void 0===templateName?this.renderCache={}:delete this.renderCache[templateName]},canCreate:function(input){if(!this.settings.create)return!1;var filter=this.settings.createFilter;return input.length&&("function"!=typeof filter||filter.apply(this,[input]))&&("string"!=typeof filter||new RegExp(filter).test(input))&&(!(filter instanceof RegExp)||filter.test(input))}}),Selectize.count=0,Selectize.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,showAddOptionOnCreate:!0,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!0,preload:!1,allowEmptyOption:!1,showEmptyOptionInDropdown:!1,emptyOptionLabel:"--",closeAfterSelect:!1,scrollDuration:60,deselectBehavior:"previous",loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},$.fn.selectize=function(settings_user){function init_select($input,settings_element){function addOption($option,group){$option=$($option);var arr,value=hash_key($option.val());(value||settings.allowEmptyOption)&&(optionsMap.hasOwnProperty(value)?group&&((arr=optionsMap[value][field_optgroup])?$.isArray(arr)?arr.push(group):optionsMap[value][field_optgroup]=[arr,group]:optionsMap[value][field_optgroup]=group):((arr=readData($option)||{})[field_label]=arr[field_label]||$option.text(),arr[field_value]=arr[field_value]||value,arr[field_disabled]=arr[field_disabled]||$option.prop("disabled"),arr[field_optgroup]=arr[field_optgroup]||group,optionsMap[value]=arr,options.push(arr),$option.is(":selected")&&settings_element.items.push(value)))}var i,n,tagName,$children,options=settings_element.options,optionsMap={},readData=function($el){$el=attr_data&&$el.attr(attr_data);return"string"==typeof $el&&$el.length?JSON.parse($el):null};for(settings_element.maxItems=$input.attr("multiple")?null:1,i=0,n=($children=$input.children()).length;i<n;i++)"optgroup"===(tagName=$children[i].tagName.toLowerCase())?function($optgroup){var i,n,id,optgroup,$options;for((id=($optgroup=$($optgroup)).attr("label"))&&((optgroup=readData($optgroup)||{})[field_optgroup_label]=id,optgroup[field_optgroup_value]=id,optgroup[field_disabled]=$optgroup.prop("disabled"),settings_element.optgroups.push(optgroup)),i=0,n=($options=$("option",$optgroup)).length;i<n;i++)addOption($options[i],id)}($children[i]):"option"===tagName&&addOption($children[i])}var defaults=$.fn.selectize.defaults,settings=$.extend({},defaults,settings_user),attr_data=settings.dataAttr,field_label=settings.labelField,field_value=settings.valueField,field_disabled=settings.disabledField,field_optgroup=settings.optgroupField,field_optgroup_label=settings.optgroupLabelField,field_optgroup_value=settings.optgroupValueField;return this.each(function(){var $input,tag_name,placeholder,input_html;this.selectize||($input=$(this),tag_name=this.tagName.toLowerCase(),(placeholder=$input.attr("placeholder")||$input.attr("data-placeholder"))||settings.allowEmptyOption||(placeholder=$input.children('option[value=""]').text()),settings.allowEmptyOption&&settings.showEmptyOptionInDropdown&&!$input.children('option[value=""]').length&&(input_html=$input.html(),$input.html('<option value="">'+settings.emptyOptionLabel+"</option>"+input_html)),("select"===tag_name?init_select:function($input,settings_element){var i,n,values,option,data_raw=$input.attr(attr_data);if(data_raw)for(settings_element.options=JSON.parse(data_raw),i=0,n=settings_element.options.length;i<n;i++)settings_element.items.push(settings_element.options[i][field_value]);else{data_raw=$.trim($input.val()||"");if(settings.allowEmptyOption||data_raw.length){for(i=0,n=(values=data_raw.split(settings.delimiter)).length;i<n;i++)(option={})[field_label]=values[i],option[field_value]=values[i],settings_element.options.push(option);settings_element.items=values}}})($input,input_html={placeholder:placeholder,options:[],optgroups:[],items:[]}),new Selectize($input,$.extend(!0,{},defaults,input_html,settings_user)))})},$.fn.selectize.defaults=Selectize.defaults,$.fn.selectize.support={validity:SUPPORTS_VALIDITY_API},Selectize.define("auto_position",function(){const POSITION={top:"top",bottom:"bottom"};this.positionDropdown=function(){const $control=this.$control,offset="body"===this.settings.dropdownParent?$control.offset():$control.position();offset.top+=$control.outerHeight(!0);var dropdownHeight=this.$dropdown.prop("scrollHeight")+5,dropdownHeight=this.$control.get(0).getBoundingClientRect().top+dropdownHeight+this.$wrapper.height()>window.innerHeight?POSITION.top:POSITION.bottom,styles={width:$control.outerWidth(),left:offset.left};dropdownHeight===POSITION.top?(Object.assign(styles,{bottom:offset.top,top:"unset",margin:"0 0 5px 0"}),this.$dropdown.addClass("selectize-position-top")):(Object.assign(styles,{top:offset.top,bottom:"unset",margin:"5px 0 0 0"}),this.$dropdown.removeClass("selectize-position-top")),this.$dropdown.css(styles)}}),Selectize.define("auto_select_on_type",function(options){var originalBlur,self=this;self.onBlur=(originalBlur=self.onBlur,function(e){var $matchedItem=self.getFirstItemMatchedByTextContent(self.lastValue,!0);return void 0!==$matchedItem.attr("data-value")&&self.getValue()!==$matchedItem.attr("data-value")&&self.setValue($matchedItem.attr("data-value")),originalBlur.apply(this,arguments)})}),Selectize.define("autofill_disable",function(options){var original,self=this;self.setup=(original=self.setup,function(){original.apply(self,arguments),self.$control_input.attr({autocomplete:"new-password",autofill:"no"})})}),Selectize.define("drag_drop",function(options){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');var self,original;"multi"===this.settings.mode&&((self=this).lock=(original=self.lock,function(){var sortable=self.$control.data("sortable");return sortable&&sortable.disable(),original.apply(self,arguments)}),self.unlock=function(){var original=self.unlock;return function(){var sortable=self.$control.data("sortable");return sortable&&sortable.enable(),original.apply(self,arguments)}}(),self.setup=function(){var original=self.setup;return function(){original.apply(this,arguments);var $control=self.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:self.isLocked,start:function(e,ui){ui.placeholder.css("width",ui.helper.css("width")),$control.addClass("dragging")},stop:function(){$control.removeClass("dragging");var active=self.$activeItems?self.$activeItems.slice():null,values=[];$control.children("[data-value]").each(function(){values.push($(this).attr("data-value"))}),self.isFocused=!1,self.setValue(values),self.isFocused=!0,self.setActiveItem(active),self.positionDropdown()}})}}())}),Selectize.define("dropdown_header",function(options){var original,self=this;options=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(data){return'<div class="'+data.headerClass+'"><div class="'+data.titleRowClass+'"><span class="'+data.labelClass+'">'+data.title+'</span><a href="javascript:void(0)" class="'+data.closeClass+'">×</a></div></div>'}},options),self.setup=(original=self.setup,function(){original.apply(self,arguments),self.$dropdown_header=$(options.html(options)),self.$dropdown.prepend(self.$dropdown_header)})}),Selectize.define("optgroup_columns",function(options){function equalizeSizes(){var i,height_max,width,width_parent,$optgroups=$("[data-group]",self.$dropdown_content),n=$optgroups.length;if(n&&self.$dropdown_content.width()){if(options.equalizeHeight){for(i=height_max=0;i<n;i++)height_max=Math.max(height_max,$optgroups.eq(i).height());$optgroups.css({height:height_max})}options.equalizeWidth&&(width_parent=self.$dropdown_content.innerWidth()-getScrollbarWidth(),width=Math.round(width_parent/n),$optgroups.css({width:width}),1<n&&(width_parent=width_parent-width*(n-1),$optgroups.eq(n-1).css({width:width_parent})))}}var original,self=this,getScrollbarWidth=(options=$.extend({equalizeWidth:!0,equalizeHeight:!0},options),this.getAdjacentOption=function($option,direction){var $options=$option.closest("[data-group]").find("[data-selectable]"),$option=$options.index($option)+direction;return 0<=$option&&$option<$options.length?$options.eq($option):$()},this.onKeyDown=(original=self.onKeyDown,function(e){var index,$optgroup;if(!this.isOpen||37!==e.keyCode&&39!==e.keyCode)return original.apply(this,arguments);self.ignoreHover=!0,index=($optgroup=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),($optgroup=(e=($optgroup=37===e.keyCode?$optgroup.prev("[data-group]"):$optgroup.next("[data-group]")).find("[data-selectable]")).eq(Math.min(e.length-1,index))).length&&this.setActiveOption($optgroup)}),function(){var div,width=getScrollbarWidth.width,doc=document;return void 0===width&&((div=doc.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',div=div.firstChild,doc.body.appendChild(div),width=getScrollbarWidth.width=div.offsetWidth-div.clientWidth,doc.body.removeChild(div)),width});(options.equalizeHeight||options.equalizeWidth)&&(hook.after(this,"positionDropdown",equalizeSizes),hook.after(this,"refreshOptions",equalizeSizes))}),Selectize.define("remove_button",function(options){options=$.extend({label:"×",title:"Remove",className:"remove",append:!0},options),("single"===this.settings.mode?function(thisRef,options){options.className="remove-single";var original,self=thisRef,html='<a href="javascript:void(0)" class="'+options.className+'" tabindex="-1" title="'+escape_html(options.title)+'">'+options.label+"</a>";thisRef.setup=(original=self.setup,function(){var id,render_item;options.append&&(id=$(self.$input.context).attr("id"),$("#"+id),render_item=self.settings.render.item,self.settings.render.item=function(data){return html_container=render_item.apply(thisRef,arguments),html_element=html,$("<span>").append(html_container).append(html_element);var html_container,html_element}),original.apply(thisRef,arguments),thisRef.$control.on("click","."+options.className,function(e){e.preventDefault(),self.isLocked||self.clear()})})}:function(thisRef,options){var original,self=thisRef,html='<a href="javascript:void(0)" class="'+options.className+'" tabindex="-1" title="'+escape_html(options.title)+'">'+options.label+"</a>";thisRef.setup=(original=self.setup,function(){var render_item;options.append&&(render_item=self.settings.render.item,self.settings.render.item=function(data){return html_container=render_item.apply(thisRef,arguments),html_element=html,pos=html_container.search(/(<\/[^>]+>\s*)$/),html_container.substring(0,pos)+html_element+html_container.substring(pos);var html_container,html_element,pos}),original.apply(thisRef,arguments),thisRef.$control.on("click","."+options.className,function(e){if(e.preventDefault(),!self.isLocked)return e=$(e.currentTarget).parent(),self.setActiveItem(e),self.deleteSelection()&&self.setCaret(self.items.length),!1})})})(this,options)}),Selectize.define("restore_on_backspace",function(options){var original,self=this;options.text=options.text||function(option){return option[this.settings.labelField]},this.onKeyDown=(original=self.onKeyDown,function(e){var index;return 8===e.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(index=this.caretPos-1)&&index<this.items.length?(index=this.options[this.items[index]],this.deleteSelection(e)&&(this.setTextboxValue(options.text.apply(this,[index])),this.refreshOptions(!0)),void e.preventDefault()):original.apply(this,arguments)})}),Selectize.define("select_on_focus",function(options){var originalFocus,originalBlur,self=this;self.on("focus",(originalFocus=self.onFocus,function(e){var value=self.getItem(self.getValue()).text();return self.clear(),self.setTextboxValue(value),self.$control_input.select(),setTimeout(function(){self.settings.selectOnTab&&self.setActiveOption(self.getFirstItemMatchedByTextContent(value)),self.settings.score=null},0),originalFocus.apply(this,arguments)})),self.onBlur=(originalBlur=self.onBlur,function(e){return""===self.getValue()&&self.lastValidValue!==self.getValue()&&self.setValue(self.lastValidValue),setTimeout(function(){self.settings.score=function(){return function(){return 1}}},0),originalBlur.apply(this,arguments)}),self.settings.score=function(){return function(){return 1}}}),Selectize.define("tag_limit",function(options){const self=this;options.tagLimit=options.tagLimit,this.onBlur=function(){const original=self.onBlur;return function(e){if(original.apply(this,e),e){const $control=this.$control,$items=$control.find(".item"),limit=options.tagLimit;void 0===limit||$items.length<=limit||($items.toArray().forEach(function(item,index){index<limit||$(item).hide()}),$control.append("<span><b>"+($items.length-limit)+"</b></span>"))}}}(),this.onFocus=function(){const original=self.onFocus;return function(e){if(original.apply(this,e),e){const $control=this.$control,$items=$control.find(".item");$items.show(),$control.find("span").remove()}}}()}),Selectize});Selectize.define("click2deselect",function(options){var self=this;var setup=self.setup;this.setup=function(){setup.apply(self,arguments);self.$dropdown.on("click","[data-selectable]",function(e){let value=this.getAttribute("data-value");if(this.classList.contains("checked")){this.classList.remove("checked");self.removeItem(value);self.refreshItems();self.refreshOptions()}else{this.classList.add("checked")}return false})}});
|
1 |
+
jQuery(document).ready(function($){var load_ui_css=false;$("#start-time").each(function(i,el){$(el).addClass("em-time-input em-time-start").next("#end-time").addClass("em-time-input em-time-end").parent().addClass("em-time-range")});if($(".em-time-input").length>0){em_setup_timepicker("body")}$(".events-table").on("click",".em-event-delete",function(){if(!confirm("Are you sure you want to delete?")){return false}window.location.href=this.href});$("#event-form #event-image-delete, #location-form #location-image-delete").on("click",function(){var el=$(this);if(el.is(":checked")){el.closest(".event-form-image, .location-form-image").find("#event-image-img, #location-image-img").hide()}else{el.closest(".event-form-image, .location-form-image").find("#event-image-img, #location-image-img").show()}});$(".event-form-with-recurrence").each(function(){let recurring_form=$(this);recurring_form.on("change",".em-recurrence-checkbox",function(){if(this.checked){recurring_form.find(".em-recurring-text").each(function(){this.style.removeProperty("display")});recurring_form.find(".em-event-text").each(function(){this.style.setProperty("display","none","important")})}else{recurring_form.find(".em-recurring-text").each(function(){this.style.setProperty("display","none","important")});recurring_form.find(".em-event-text").each(function(){this.style.removeProperty("display")})}})});$(".event-form-with-recurrence .em-recurrence-checkbox").trigger("change");$("#event-form.em-event-admin-recurring").on("submit",function(event){var form=$(this);if(form.find('input[name="event_reschedule"]').first().val()==1){var warning_text=EM.event_reschedule_warning}else if(form.find('input[name="event_recreate_tickets"]').first().val()==1){var warning_text=EM.event_recurrence_bookings}else{var warning_text=EM.event_recurrence_overwrite}confirmation=confirm(warning_text);if(confirmation==false){event.preventDefault()}});$(".em-reschedule-trigger").on("click",function(e){e.preventDefault();var trigger=$(this);trigger.closest(".em-recurrence-reschedule").find(trigger.data("target")).removeClass("reschedule-hidden");trigger.siblings(".em-reschedule-value").val(1);trigger.addClass("reschedule-hidden").siblings("a").removeClass("reschedule-hidden")});$(".em-reschedule-cancel").on("click",function(e){e.preventDefault();var trigger=$(this);trigger.closest(".em-recurrence-reschedule").find(trigger.data("target")).addClass("reschedule-hidden");trigger.siblings(".em-reschedule-value").val(0);trigger.addClass("reschedule-hidden").siblings("a").removeClass("reschedule-hidden")});if($("#em-tickets-form").length>0){$("#event-rsvp").on("click",function(event){if(!this.checked){confirmation=confirm(EM.disable_bookings_warning);if(confirmation==false){event.preventDefault()}else{$("#event-rsvp-options").hide()}}else{$("#event-rsvp-options").fadeIn()}});if($("input#event-rsvp").is(":checked")){$("div#rsvp-data").fadeIn()}else{$("div#rsvp-data").hide()}var reset_ticket_forms=function(){$("#em-tickets-form table tbody tr.em-tickets-row").show();$("#em-tickets-form table tbody tr.em-tickets-row-form").hide()};if($("#em-recurrence-checkbox").length>0){$("#em-recurrence-checkbox").on("change",function(){if($("#em-recurrence-checkbox").is(":checked")){$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring").show();$("#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal, #em-tickets-form .hidden").hide()}else{$("#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal").show();$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring, #em-tickets-form .hidden").hide()}}).trigger("change")}else if($("#em-form-recurrence").length>0){$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring").show();$("#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal, #em-tickets-form .hidden").hide()}else{$("#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring, #em-tickets-form .hidden").hide()}$("#em-tickets-add").on("click",function(e){e.preventDefault();reset_ticket_forms();var tickets=$("#em-tickets-form table tbody");tickets.first(".em-ticket-template").find("input.em-date-input.flatpickr-input").each(function(){if("_flatpickr"in this){this._flatpickr.destroy()}});var rowNo=tickets.length+1;var slot=tickets.first(".em-ticket-template").clone(true).attr("id","em-ticket-"+rowNo).removeClass("em-ticket-template").addClass("em-ticket").appendTo($("#em-tickets-form table"));slot.find("*[name]").each(function(index,el){el=$(el);el.attr("name",el.attr("name").replace("em_tickets[0]","em_tickets["+rowNo+"]"))});let start_datepicker=slot.find(".ticket-dates-from-normal").first();if(start_datepicker.attr("data-until-id")){let until_id=start_datepicker.attr("data-until-id").replace("-0","-"+rowNo);start_datepicker.attr("data-until-id",until_id);slot.find(".ticket-dates-to-normal").attr("id",start_datepicker.attr("data-until-id"))}slot.show().find(".ticket-actions-edit").trigger("click");slot.find(".em-time-input").off().each(function(index,el){if(typeof this.em_timepickerObj=="object"){this.em_timepicker("remove")}});em_setup_datepicker(slot);em_setup_timepicker(slot);$("html, body").animate({scrollTop:slot.offset().top-30});check_ticket_sortability()});$(document).on("click",".ticket-actions-edit",function(e){e.preventDefault();reset_ticket_forms();var tbody=$(this).closest("tbody");tbody.find("tr.em-tickets-row").hide();tbody.find("tr.em-tickets-row-form").fadeIn();return false});$(document).on("click",".ticket-actions-edited",function(e){e.preventDefault();var tbody=$(this).closest("tbody");var rowNo=tbody.attr("id").replace("em-ticket-","");tbody.find(".em-tickets-row").fadeIn();tbody.find(".em-tickets-row-form").hide();tbody.find("*[name]").each(function(index,el){el=$(el);if(el.attr("name")=="ticket_start_pub"){tbody.find("span.ticket_start").text(el.val())}else if(el.attr("name")=="ticket_end_pub"){tbody.find("span.ticket_end").text(el.val())}else if(el.attr("name")=="em_tickets["+rowNo+"][ticket_type]"){if(el.find(":selected").val()=="members"){tbody.find("span.ticket_name").prepend("* ")}}else if(el.attr("name")=="em_tickets["+rowNo+"][ticket_start_recurring_days]"){var text=tbody.find("select.ticket-dates-from-recurring-when").val()=="before"?"-"+el.val():el.val();if(el.val()!=""){tbody.find("span.ticket_start_recurring_days").text(text);tbody.find("span.ticket_start_recurring_days_text, span.ticket_start_time").removeClass("hidden").show()}else{tbody.find("span.ticket_start_recurring_days").text(" - ");tbody.find("span.ticket_start_recurring_days_text, span.ticket_start_time").removeClass("hidden").hide()}}else if(el.attr("name")=="em_tickets["+rowNo+"][ticket_end_recurring_days]"){var text=tbody.find("select.ticket-dates-to-recurring-when").val()=="before"?"-"+el.val():el.val();if(el.val()!=""){tbody.find("span.ticket_end_recurring_days").text(text);tbody.find("span.ticket_end_recurring_days_text, span.ticket_end_time").removeClass("hidden").show()}else{tbody.find("span.ticket_end_recurring_days").text(" - ");tbody.find("span.ticket_end_recurring_days_text, span.ticket_end_time").removeClass("hidden").hide()}}else{var classname=el.attr("name").replace("em_tickets["+rowNo+"][","").replace("]","").replace("[]","");tbody.find(".em-tickets-row ."+classname).text(el.val())}});$(document).triggerHandler("em_maps_tickets_edit",[tbody,rowNo,true]);$("html, body").animate({scrollTop:tbody.parent().offset().top-30});return false});$(document).on("change",".em-ticket-form select.ticket_type",function(e){var el=$(this);if(el.find("option:selected").val()=="members"){el.closest(".em-ticket-form").find(".ticket-roles").fadeIn()}else{el.closest(".em-ticket-form").find(".ticket-roles").hide()}});$(document).on("click",".em-ticket-form .ticket-options-advanced",function(e){e.preventDefault();var el=$(this);if(el.hasClass("show")){el.closest(".em-ticket-form").find(".em-ticket-form-advanced").fadeIn();el.find(".show,.show-advanced").hide();el.find(".hide,.hide-advanced").show()}else{el.closest(".em-ticket-form").find(".em-ticket-form-advanced").hide();el.find(".show,.show-advanced").show();el.find(".hide,.hide-advanced").hide()}el.toggleClass("show")});$(".em-ticket-form").each(function(){var show_advanced=false;var el=$(this);el.find('.em-ticket-form-advanced input[type="text"]').each(function(){if(this.value!="")show_advanced=true});if(el.find('.em-ticket-form-advanced input[type="checkbox"]:checked').length>0){show_advanced=true}el.find(".em-ticket-form-advanced option:selected").each(function(){if(this.value!="")show_advanced=true});if(show_advanced)el.find(".ticket-options-advanced").trigger("click")});$(document).on("click",".ticket-actions-delete",function(e){e.preventDefault();var el=$(this);var tbody=el.closest("tbody");if(tbody.find("input.ticket_id").val()>0){el.text("Deleting...");$.getJSON($(this).attr("href"),{em_ajax_action:"delete_ticket",id:tbody.find("input.ticket_id").val()},function(data){if(data.result){tbody.remove()}else{el.text("Delete");alert(data.error)}})}else{tbody.remove()}check_ticket_sortability();return false});$("#em-tickets-form.em-tickets-sortable table").sortable({items:"> tbody",placeholder:"em-ticket-sortable-placeholder",handle:".ticket-status",helper:function(event,el){var helper=$(el).clone().addClass("em-ticket-sortable-helper");var tds=helper.find(".em-tickets-row td").length;helper.children().remove();helper.append('<tr class="em-tickets-row"><td colspan="'+tds+'" style="text-align:left; padding-left:15px;"><span class="dashicons dashicons-tickets-alt"></span></td></tr>');return helper}});var check_ticket_sortability=function(){var em_tickets=$("#em-tickets-form table tbody.em-ticket");if(em_tickets.length==1){em_tickets.find(".ticket-status").addClass("single");$("#em-tickets-form.em-tickets-sortable table").sortable("option","disabled",true)}else{em_tickets.find(".ticket-status").removeClass("single");$("#em-tickets-form.em-tickets-sortable table").sortable("option","disabled",false)}};check_ticket_sortability()}if($("#em-bookings-table").length>0){$(document).on("click","#em-bookings-table .tablenav-pages a",function(){var el=$(this);var form=el.parents("#em-bookings-table form.bookings-filter");var match=el.attr("href").match(/#[0-9]+/);if(match!=null&&match.length>0){var pno=match[0].replace("#","");form.find("input[name=pno]").val(pno)}else{form.find("input[name=pno]").val(1)}form.trigger("submit");return false});var em_bookings_settings_dialog={modal:true,autoOpen:false,minWidth:500,height:"auto",buttons:[{text:EM.bookings_settings_save,click:function(e){e.preventDefault();var match=$("#em-bookings-table form.bookings-filter [name=cols]").val("");var booking_form_cols=$("form#em-bookings-table-settings-form input.em-bookings-col-item");$.each(booking_form_cols,function(i,item_match){if(item_match.value==1){if(match.val()!=""){match.val(match.val()+","+item_match.name)}else{match.val(item_match.name)}}});$("#em-bookings-table-settings").trigger("submitted");$("#em-bookings-table form.bookings-filter").trigger("submit");$(this).dialog("close")}}],appendTo:"#em-dialog-wrapper"};var em_bookings_export_dialog={modal:true,autoOpen:false,minWidth:500,height:"auto",buttons:[{text:EM.bookings_export_save,click:function(e){$(this).children("form").trigger("submit");$(this).dialog("close")}}],appendTo:"#em-dialog-wrapper"};if($("#em-bookings-table-settings").length>0){$('<div id="em-dialog-wrapper" class="em"></div>').appendTo("body");$("#em-bookings-table-settings").dialog(em_bookings_settings_dialog);$(document).on("click","#em-bookings-table-settings-trigger",function(e){e.preventDefault();$("#em-bookings-table-settings").dialog("open")});$("#em-bookings-table-export").dialog(em_bookings_export_dialog);$(document).on("click","#em-bookings-table-export-trigger",function(e){e.preventDefault();$("#em-bookings-table-export").dialog("open")});var export_overlay_show_tickets=function(){if($("#em-bookings-table-export-form input[name=show_tickets]").is(":checked")){$("#em-bookings-table-export-form .em-bookings-col-item-ticket").show();$("#em-bookings-table-export-form #em-bookings-export-cols-active .em-bookings-col-item-ticket input").val(1)}else{$("#em-bookings-table-export-form .em-bookings-col-item-ticket").hide().find("input").val(0)}};$("#em-bookings-table form select").each(function(i,el){$(el).on("change",function(e){var select_el=$(this);var input_par=$("#em-bookings-table-export-form input[name="+select_el.attr("name")+"]");var input_par_selected=select_el.find("option:selected");input_par.val(input_par_selected.val())})});export_overlay_show_tickets();$("#em-bookings-table-export-form input[name=show_tickets]").on("click",export_overlay_show_tickets);$(".em-bookings-cols-sortable").sortable({connectWith:".em-bookings-cols-sortable",update:function(event,ui){if(ui.item.parents("ul#em-bookings-cols-active, ul#em-bookings-export-cols-active").length>0){ui.item.addClass("ui-state-highlight").removeClass("ui-state-default").children("input").val(1)}else{ui.item.addClass("ui-state-default").removeClass("ui-state-highlight").children("input").val(0)}}}).disableSelection();load_ui_css=true}$(document).on("submit","#em-bookings-table form.bookings-filter",function(e){var el=$(this);el.parents("#em-bookings-table").find(".table-wrap").first().append('<div id="em-loading" />');$.post(EM.ajaxurl,el.serializeArray(),function(data){var root=el.parents("#em-bookings-table").first();root.replaceWith(data);$("#em-bookings-table-export input[name=scope]").val(root.find("select[name=scope]").val());$("#em-bookings-table-export input[name=status]").val(root.find("select[name=status]").val());jQuery(document).triggerHandler("em_bookings_filtered",[data,root,el])});return false});$(document).on("click",".em-bookings-approve,.em-bookings-reject,.em-bookings-unapprove,.em-bookings-delete,.em-bookings-ajax-action",function(){var el=$(this);if(el.hasClass("em-bookings-delete")){if(!confirm(EM.booking_delete)){return false}}var url=em_ajaxify(el.attr("href"));var td=el.parents("td").first();td.html(EM.txt_loading);td.load(url);return false})}if($(".em_bookings_events_table").length>0){$(document).on("submit",".em_bookings_events_table form",function(e){var el=$(this);var url=em_ajaxify(el.attr("action"));el.parents(".em_bookings_events_table").find(".table-wrap").first().append('<div id="em-loading" />');$.get(url,el.serializeArray(),function(data){el.parents(".em_bookings_events_table").first().replaceWith(data)});return false});$(document).on("click",".em_bookings_events_table .tablenav-pages a",function(){var el=$(this);var url=em_ajaxify(el.attr("href"));el.parents(".em_bookings_events_table").find(".table-wrap").first().append('<div id="em-loading" />');$.get(url,function(data){el.parents(".em_bookings_events_table").first().replaceWith(data)});return false})}$(document).on("click","a.em-booking-button",function(e){e.preventDefault();var button=$(this);if(button.text()!=EM.bb_booked&&$(this).text()!=EM.bb_booking){button.text(EM.bb_booking);var button_data=button.attr("id").split("_");$.ajax({url:EM.ajaxurl,dataType:"jsonp",data:{event_id:button_data[1],_wpnonce:button_data[2],action:"booking_add_one"},success:function(response,statusText,xhr,$form){if(response.result){button.text(EM.bb_booked);button.addClass("disabled")}else{button.text(EM.bb_error)}if(response.message!="")alert(response.message);$(document).triggerHandler("em_booking_button_response",[response,button])},error:function(){button.text(EM.bb_error)}})}return false});$(document).on("click","a.em-cancel-button",function(e){e.preventDefault();var button=$(this);if(button.text()!=EM.bb_cancelled&&button.text()!=EM.bb_canceling){button.text(EM.bb_canceling);var button_data=button.attr("id").split("_");$.ajax({url:EM.ajaxurl,dataType:"jsonp",data:{booking_id:button_data[1],_wpnonce:button_data[2],action:"booking_cancel"},success:function(response,statusText,xhr,$form){if(response.result){button.text(EM.bb_cancelled);button.addClass("disabled")}else{button.text(EM.bb_cancel_error)}},error:function(){button.text(EM.bb_cancel_error)}})}return false});$(document).on("click","a.em-booking-button-action",function(e){e.preventDefault();var button=$(this);var button_data={_wpnonce:button.attr("data-nonce"),action:button.attr("data-action")};if(button.attr("data-event-id"))button_data.event_id=button.attr("data-event-id");if(button.attr("data-booking-id"))button_data.booking_id=button.attr("data-booking-id");if(button.text()!=EM.bb_booked&&$(this).text()!=EM.bb_booking){if(button.attr("data-loading")){button.text(button.attr("data-loading"))}else{button.text(EM.bb_booking)}$.ajax({url:EM.ajaxurl,dataType:"jsonp",data:button_data,success:function(response,statusText,xhr,$form){if(response.result){if(button.attr("data-success")){button.text(button.attr("data-success"))}else{button.text(EM.bb_booked)}button.addClass("disabled")}else{if(button.attr("data-error")){button.text(button.attr("data-error"))}else{button.text(EM.bb_error)}}if(response.message!="")alert(response.message);$(document).triggerHandler("em_booking_button_action_response",[response,button])},error:function(){if(button.attr("data-error")){button.text(button.attr("data-error"))}else{button.text(EM.bb_error)}}})}return false});if($(".em-date-single, .em-date-range, #em-date-start").length>0){load_ui_css=true;em_setup_datepicker("body")}if(load_ui_css)em_load_jquery_css();if($(".em-datepicker").length>0){em_setup_datepicker("body")}$("#em-wrapper input.select-all").on("change",function(){if($(this).is(":checked")){$("input.row-selector").prop("checked",true);$("input.select-all").prop("checked",true)}else{$("input.row-selector").prop("checked",false);$("input.select-all").prop("checked",false)}});function updateIntervalDescriptor(){$(".interval-desc").hide();var number="-plural";if($("input.em-recurrence-interval").val()==1||$("input.em-recurrence-interval").val()=="")number="-singular";var descriptor="span.interval-desc.interval-"+$("select.em-recurrence-frequency").val()+number;$(descriptor).show()}function updateIntervalSelectors(){$(".alternate-selector").hide();$(".em-"+$("select.em-recurrence-frequency").val()+"-selector").show()}updateIntervalDescriptor();updateIntervalSelectors();$("input.em-recurrence-interval").on("keyup",updateIntervalDescriptor);$("select.em-recurrence-frequency").on("change",updateIntervalDescriptor);$("select.em-recurrence-frequency").on("change",updateIntervalSelectors);if($(".em-location-map").length>0||$(".em-locations-map").length>0||$("#em-map").length>0||$(".em-search-geo").length>0){em_maps_load()}$(".em-location-types .em-location-types-select").on("change",function(){let el=$(this);if(el.val()==0){$(".em-location-type").hide()}else{let location_type=el.find("option:selected").data("display-class");$(".em-location-type").hide();$(".em-location-type."+location_type).show();if(location_type!="em-location-type-place"){jQuery("#em-location-reset a").trigger("click")}}if(el.data("active")!==""&&el.val()!==el.data("active")){$(".em-location-type-delete-active-alert").hide();$(".em-location-type-delete-active-alert").show()}else{$(".em-location-type-delete-active-alert").hide()}}).trigger("change");if(jQuery("div.em-location-data input#location-name").length>0){$("div.em-location-data input#location-name").selectize({plugins:["restore_on_backspace"],valueField:"id",labelField:"label",searchField:"label",create:true,createOnBlur:true,maxItems:1,persist:false,addPrecedence:true,selectOnTab:true,diacritics:true,render:{item:function(item,escape){return"<div>"+item.label+"</div>"},option:function(item,escape){let meta="";if(typeof item.address!=="undefined"){if(item.address!==""&&item.town!==""){meta=escape(item.address)+", "+escape(item.town)}else if(item.address!==""){meta=escape(item.address)}else if(item.town!==""){meta=escape(item.town)}}return'<div class="em-locations-autocomplete-item">'+'<div class="em-locations-autocomplete-label">'+escape(item.label)+"</div>"+'<div style="font-size:11px; text-decoration:italic;">'+meta+"</div>"+"</div>"}},load:function(query,callback){if(!query.length)return callback();$.ajax({url:EM.locationajaxurl,data:{q:query,method:"selectize"},dataType:"json",type:"POST",error:function(){callback()},success:function(data){callback(data)}})},onItemAdd:function(value,data){this.clearCache();var option=this.options[value];if(value===option.label){jQuery("input#location-address").focus();return}jQuery("input#location-name").val(option.value);jQuery("input#location-address").val(option.address);jQuery("input#location-town").val(option.town);jQuery("input#location-state").val(option.state);jQuery("input#location-region").val(option.region);jQuery("input#location-postcode").val(option.postcode);jQuery("input#location-latitude").val(option.latitude);jQuery("input#location-longitude").val(option.longitude);if(typeof option.country==="undefined"||option.country===""){jQuery("select#location-country option:selected").removeAttr("selected")}else{jQuery('select#location-country option[value="'+option.country+'"]').attr("selected","selected")}jQuery("input#location-id").val(option.id).trigger("change");jQuery("div.em-location-data input, div.em-location-data select").prop("readonly",true).css("opacity","0.5");jQuery("#em-location-reset").show();jQuery("#em-location-search-tip").hide();this.disable();this.$control.blur();jQuery('div.em-location-data [class^="em-selectize"]').each(function(){this.selectize.disable()});jQuery(document).triggerHandler("em_locations_autocomplete_selected",[event,option])}});jQuery("#em-location-reset a").on("click",function(){jQuery("div.em-location-data input, div.em-location-data select").each(function(){this.style.removeProperty("opacity");this.readOnly=false;if(this.type=="text")this.value=""});jQuery("div.em-location-data option:selected").removeAttr("selected");jQuery("input#location-id").val("");jQuery("#em-location-reset").hide();jQuery("#em-location-search-tip").show();jQuery("#em-map").hide();jQuery("#em-map-404").show();if(typeof marker!=="undefined"){marker.setPosition(new google.maps.LatLng(0,0));infoWindow.close();marker.setDraggable(true)}let $selectize=$("div.em-location-data input#location-name")[0].selectize;$selectize.enable();$selectize.clear(true);$selectize.clearOptions();jQuery("div.em-location-data select.em-selectize").each(function(){if("selectize"in this){this.selectize.enable();this.selectize.clear(true)}});return false});if(jQuery("input#location-id").val()!="0"&&jQuery("input#location-id").val()!=""){jQuery("div.em-location-data input, div.em-location-data select").each(function(){this.style.setProperty("opacity","0.5","important");this.readOnly=true});jQuery("#em-location-reset").show();jQuery("#em-location-search-tip").hide();jQuery("div.em-location-data select.em-selectize, div.em-location-data input.em-selectize-autocomplete").each(function(){if("selectize"in this)this.selectize.disable()})}}$("select:not([multiple]).em-selectize, .em-selectize select:not([multiple])").selectize();$("select[multiple].em-selectize, .em-selectize select[multiple]").selectize({hideSelected:false,plugins:["remove_button","click2deselect"],diacritics:true,render:{item:function(item,escape){return'<div class="item">'+item.text.replace(/^\s+/i,"")+"</div>"},option:function(item,escape){let html='<div class="option">';if(this.$input.hasClass("checkboxes")){html+=item.text.replace(/^(\s+)?/i,"$1<span></span> ")}else{html+=item.text}html+="</div>";return html}}});$(".em-selectize.always-open").each(function(){if("selectize"in this){let s=this.selectize;s.open();s.advanceSelection=function(){};s.setActiveItem=function(){};this.selectize.$control.on("click",".remove",function(e){e.preventDefault();if(s.isLocked)return;var $item=$(e.currentTarget).parent();s.removeItem($item.attr("data-value"));s.refreshOptions();return false})}});$(document).triggerHandler("em_selectize_loaded");if(window.moment){var replace_specials=function(day,string){string=string.replace(/##T/g,Intl.DateTimeFormat().resolvedOptions().timeZone);string=string.replace(/#T/g,"GMT"+day.format("Z"));string=string.replace(/###t/g,day.utcOffset()*-60);string=string.replace(/##t/g,day.isDST());string=string.replace(/#t/g,day.daysInMonth());return string};$(".em-date-momentjs").each(function(){var el=$(this);var day_start=moment.unix(el.data("date-start"));var date_start_string=replace_specials(day_start,day_start.format(el.data("date-format")));if(el.data("date-start")!==el.data("date-end")){var day_end=moment.unix(el.data("date-end"));var day_end_string=replace_specials(day_start,day_end.format(el.data("date-format")));var date_string=date_start_string+el.data("date-separator")+day_end_string}else{var date_string=date_start_string}el.text(date_string)});var get_date_string=function(ts,format){let date=new Date(ts*1e3);let minutes=date.getMinutes();if(format==24){let hours=date.getHours();hours=hours<10?"0"+hours:hours;minutes=minutes<10?"0"+minutes:minutes;return hours+":"+minutes}else{let hours=date.getHours()%12;let ampm=hours>=12?"PM":"AM";if(hours===0)hours=12;minutes=minutes<10?"0"+minutes:minutes;return hours+":"+minutes+" "+ampm}};$(".em-time-localjs").each(function(){var el=$(this);var strTime=get_date_string(el.data("time"),el.data("time-format"));if(el.data("time-end")){var separator=el.data("time-separator")?el.data("time-separator"):" - ";strTime=strTime+separator+get_date_string(el.data("time-end"),el.data("time-format"))}el.text(strTime)})}var tooltip_vars={theme:"light-border",appendTo:"parent",content(reference){return reference.getAttribute("aria-label")}};$(document).trigger("em-tippy-vars",[tooltip_vars]);tippy(".em-tooltip",tooltip_vars);let tippy_ddm_options={theme:"light-border",arrow:false,allowHTML:true,interactive:true,trigger:"manual",placement:"bottom",zIndex:1e6};$(document).trigger("em-tippy-ddm-vars",[tippy_ddm_options]);$(".em-tooltip-ddm").each(function(){let ddm_content,ddm_content_sibling;if(this.getAttribute("data-content")){ddm_content=document.getElementById(this.getAttribute("data-content"));ddm_content_sibling=ddm_content.previousElementSibling}else{ddm_content=this.nextElementSibling;ddm_content_sibling=ddm_content.previousElementSibling}let tippy_content=document.createElement("div");let button_width=this.getAttribute("data-button-width");if(button_width){if(button_width=="match"){tippy_ddm_options.maxWidth=this.clientWidth}else{tippy_ddm_options.maxWidth=this.getAttribute("data-button-width")}}tippy_ddm_options.content=tippy_content;let tippy_ddm=tippy(this,tippy_ddm_options);tippy_ddm.props.distance=50;tippy_ddm.setProps({onShow(instance){if(instance.reference.getAttribute("data-tooltip-class")){instance.popper.classList.add(instance.reference.getAttribute("data-tooltip-class"))}instance.popper.classList.add("em-tooltip-ddm-display");tippy_content.append(ddm_content);ddm_content.classList.remove("em-tooltip-ddm-content")},onShown(instance){ddm_content.firstElementChild.focus()},onHidden(instance){if(ddm_content.previousElementSibling!==ddm_content_sibling){ddm_content_sibling.after(ddm_content);ddm_content.classList.add("em-tooltip-ddm-content")}}});let tippy_listener=function(e){if(e.type==="keydown"&&!(e.which===13||e.which===40))return false;e.preventDefault();e.stopPropagation();this._tippy.show()};this.addEventListener("click",tippy_listener);this.addEventListener("keydown",tippy_listener);tippy_content.addEventListener("blur",function(){tippy_content.hide()});tippy_content.addEventListener("mouseover",function(){ddm_content.firstElementChild.blur()})});jQuery(document).triggerHandler("em_javascript_loaded")});function em_load_jquery_css(wrapper=false){if(EM.ui_css&&jQuery("link#jquery-ui-em-css").length==0){var script=document.createElement("link");script.id="jquery-ui-em-css";script.rel="stylesheet";script.href=EM.ui_css;document.body.appendChild(script);if(wrapper){em_setup_jquery_ui_wrapper()}}}function em_setup_jquery_ui_wrapper(){if(jQuery("#em-jquery-ui").length===0){jQuery("body").append('<div id="em-jquery-ui" class="em">')}}function em_setup_datepicker(wrap){wrap=jQuery(wrap);let dateDivs=wrap.find(".em-date-single, .em-date-range");if(dateDivs.length>0){var datepicker_vals={dateFormat:"yy-mm-dd",changeMonth:true,changeYear:true,firstDay:EM.firstDay,yearRange:"c-100:c+15",beforeShow:function(el,inst){em_setup_jquery_ui_wrapper();inst.dpDiv.appendTo("#em-jquery-ui")}};if(EM.dateFormat)datepicker_vals.dateFormat=EM.dateFormat;if(EM.yearRange)datepicker_vals.yearRange=EM.yearRange;jQuery(document).triggerHandler("em_datepicker",datepicker_vals);dateDivs.find("input.em-date-input-loc").each(function(i,dateInput){var dateInput=jQuery(dateInput);var dateValue=dateInput.nextAll("input.em-date-input").first();var dateValue_value=dateValue.val();dateInput.datepicker(datepicker_vals);dateInput.datepicker("option","altField",dateValue);if(dateValue_value){var this_date_formatted=jQuery.datepicker.formatDate(EM.dateFormat,jQuery.datepicker.parseDate("yy-mm-dd",dateValue_value));dateInput.val(this_date_formatted);dateValue.val(dateValue_value)}dateInput.on("change",function(){if(jQuery(this).val()==""){jQuery(this).nextAll(".em-date-input").first().val("")}})});dateDivs.filter(".em-date-range").find('input.em-date-input-loc[type="text"]').each(function(i,dateInput){dateInput=jQuery(dateInput);if(dateInput.hasClass("em-date-start")){dateInput.datepicker("option","onSelect",function(selectedDate){var startDate=jQuery(this);var endDate=startDate.parents(".em-date-range").find(".em-date-end").first();var startValue=startDate.nextAll("input.em-date-input").first().val();var endValue=endDate.nextAll("input.em-date-input").first().val();startDate.trigger("em_datepicker_change");if(startValue>endValue&&endValue!=""){endDate.datepicker("setDate",selectedDate);endDate.trigger("change").trigger("em_datepicker_change")}endDate.datepicker("option","minDate",selectedDate)})}else if(dateInput.hasClass("em-date-end")){var startInput=dateInput.parents(".em-date-range").find(".em-date-start").first();if(startInput.val()!=""){dateInput.datepicker("option","minDate",startInput.val())}}})}let datePickerDivs=wrap.find(".em-datepicker, .em-datepicker-range");if(datePickerDivs.length>0){let datepicker_wrapper=jQuery("#em-flatpickr");if(datepicker_wrapper.length===0){datepicker_wrapper=jQuery('<div class="em pixelbones em-flatpickr" id="em-flatpickr"></div>').appendTo("body")}if("locale"in EM.datepicker){flatpickr.localize(flatpickr.l10ns[EM.datepicker.locale]);flatpickr.l10ns.default.firstDayOfWeek=EM.firstDay}let datepicker_options={appendTo:datepicker_wrapper[0],dateFormat:"Y-m-d",disableMoble:"true",allowInput:true,onChange:function(selectedDates,dateStr,instance){let wrapper=jQuery(instance.input).closest(".em-datepicker");let data_wrapper=wrapper.find(".em-datepicker-data");let inputs=data_wrapper.find("input");let dateFormat=function(d){let month=""+(d.getMonth()+1),day=""+d.getDate(),year=d.getFullYear();if(month.length<2)month="0"+month;if(day.length<2)day="0"+day;return[year,month,day].join("-")};if(selectedDates.length===0){inputs.attr("value","")}else{inputs[0].setAttribute("value",dateFormat(selectedDates[0]));if(instance.config.mode==="range"&&selectedDates[1]!==undefined){inputs[1].setAttribute("value",dateFormat(selectedDates[1]))}else if(instance.config.mode==="single"&&instance.input.classList.contains("em-date-input-start")&&wrapper.hasClass("em-datepicker-until")){let fp;if(wrapper.attr("data-until-id")){let fp_input=jQuery("#"+wrapper.attr("data-until-id")+" .em-date-input-end");fp=fp_input[0]._flatpickr}else{fp=wrapper.find(".em-date-input-end")[0]._flatpickr}if(fp.selectedDates[0]!==undefined||fp.selectedDates[0]<selectedDates[0]){fp.setDate(selectedDates[0]);inputs[0].setAttribute("value",dateFormat(fp.selectedDates[0]))}fp.set("minDate",selectedDates[0])}}inputs.trigger("change");let current_date=data_wrapper.attr("date-value");data_wrapper.attr("data-value",dateStr);if(current_date===dateStr)data_wrapper.trigger("change")},onClose:function(selectedDates,dateStr,instance){if(instance.config.mode==="range"&&selectedDates[1]!==undefined){if(selectedDates.length===1){instance.setDate([selectedDates[0],selectedDates[0]],true)}}},locale:{}};if(EM.datepicker.format!==datepicker_options.dateFormat){datepicker_options.altFormat=EM.datepicker.format;datepicker_options.altInput=true}jQuery(document).triggerHandler("em_datepicker_options",datepicker_options);datePickerDivs.each(function(i,datePickerDiv){datePickerDiv=jQuery(datePickerDiv);datePickerDiv.find(".em-datepicker-data").addClass("hidden");let isRange=datePickerDiv.hasClass("em-datepicker-range");let options=Object.assign({},datepicker_options);options.mode=isRange?"range":"single";if(isRange&&"onClose"in options){options.onClose=function(selectedDates,dateStr,instance){if(selectedDates.length===1){instance.setDate([selectedDates[0],selectedDates[0]])}}}if(datePickerDiv.attr("data-separator"))options.locale.rangeSeparator=datePickerDiv.attr("data-separator");if(datePickerDiv.attr("data-format"))options.altFormat=datePickerDiv.attr("data-format");let FPs=datePickerDiv.find(".em-date-input");FPs.attr("type","text").flatpickr(options);let inputs=datePickerDiv.find(".em-datepicker-data input");inputs.attr("type","hidden");if(datePickerDiv.hasClass("em-datepicker-until")){let start_fp,end_fp;if(datePickerDiv.attr("data-until-id")){end_fp=jQuery("#"+datePickerDiv.attr("data-until-id")+" .em-date-input-end")[0]._flatpickr}else{end_fp=FPs.filter(".em-date-input-end")[0]._flatpickr;if(inputs[1]&&inputs[1].value){end_fp.setDate(inputs[1].value,false,"Y-m-d")}}if(inputs[0]&&inputs[0].value){start_fp=FPs.filter(".em-date-input-start")[0]._flatpickr;start_fp.setDate(inputs[0].value,false,"Y-m-d");end_fp.set("minDate",inputs[0].value)}}else{let dates=[];inputs.each(function(i,input){if(input.value){dates.push(input.value)}});FPs[0]._flatpickr.setDate(dates,false,"Y-m-d")}});jQuery(document).triggerHandler("em_flatpickr_loaded")}}function em_setup_timepicker(wrap){wrap=jQuery(wrap);var timepicker_options={step:15};timepicker_options.timeFormat=EM.show24hours==1?"G:i":"g:i A";jQuery(document).triggerHandler("em_timepicker_options",timepicker_options);wrap.find(".em-time-input").em_timepicker(timepicker_options);wrap.find(".em-time-range input.em-time-start").each(function(i,el){var time=jQuery(el);time.data("oldTime",time.em_timepicker("getSecondsFromMidnight"))}).on("change",function(){var start=jQuery(this);var end=start.nextAll(".em-time-end");if(end.val()){var oldTime=start.data("oldTime");var duration=(end.em_timepicker("getSecondsFromMidnight")-oldTime)*1e3;var time=start.em_timepicker("getSecondsFromMidnight");if(end.em_timepicker("getSecondsFromMidnight")>=oldTime){end.em_timepicker("setTime",new Date(start.em_timepicker("getTime").getTime()+duration))}start.data("oldTime",time)}});wrap.find(".event-form-when .em-time-range input.em-time-end").on("change",function(){var end=jQuery(this);var start=end.prevAll(".em-time-start");var wrapper=end.closest(".event-form-when");var start_date=wrapper.find(".em-date-end").val();var end_date=wrapper.find(".em-date-start").val();if(start.val()){if(start.em_timepicker("getTime")>end.em_timepicker("getTime")&&(end_date.length==0||start_date==end_date)){end.addClass("error")}else{end.removeClass("error")}}});wrap.find(".event-form-when .em-date-end").on("change",function(){jQuery(this).closest(".event-form-when").find(".em-time-end").trigger("change")});wrap.find(".em-time-range input.em-time-all-day").on("change",function(){var allday=jQuery(this);if(allday.is(":checked")){allday.closest(".em-time-range").find(".em-time-input").each(function(){this.style.setProperty("background-color","#ccc","important");this.readOnly=true})}else{allday.closest(".em-time-range").find(".em-time-input").each(function(){this.style.removeProperty("background-color");this.readOnly=false})}}).trigger("change")}var em_ajaxify=function(url){if(url.search("em_ajax=0")!=-1){url=url.replace("em_ajax=0","em_ajax=1")}else if(url.search(/\?/)!=-1){url=url+"&em_ajax=1"}else{url=url+"?em_ajax=1"}return url};var em_maps_loaded=false;var maps={};var maps_markers={};var infoWindow;function em_maps_load(){if(!em_maps_loaded){if(jQuery("script#google-maps").length==0&&(typeof google!=="object"||typeof google.maps!=="object")){var script=document.createElement("script");script.type="text/javascript";script.id="google-maps";var proto=EM.is_ssl?"https:":"http:";if(typeof EM.google_maps_api!=="undefined"){script.src=proto+"//maps.google.com/maps/api/js?v=quarterly&libraries=places&callback=em_maps&key="+EM.google_maps_api}else{script.src=proto+"//maps.google.com/maps/api/js?v=quarterly&libraries=places&callback=em_maps"}document.body.appendChild(script)}else if(typeof google==="object"&&typeof google.maps==="object"&&!em_maps_loaded){em_maps()}else if(jQuery("script#google-maps").length>0){jQuery(window).load(function(){if(!em_maps_loaded)em_maps()})}}}jQuery(document).on("em_view_loaded_map",function(e,view,form){if(!em_maps_loaded){em_maps_load()}else{let map=view.find(".em-locations-map");em_maps_load_locations(map)}});function em_maps_load_locations(el){var el=jQuery(el);var map_id=el.attr("id").replace("em-locations-map-","");var em_data=jQuery.parseJSON(el.nextAll(".em-locations-map-coords").first().text());if(em_data==null){var em_data=jQuery.parseJSON(jQuery("#em-locations-map-coords-"+map_id).text())}jQuery.getJSON(document.URL,em_data,function(data){if(data.length>0){var map_options={mapTypeId:google.maps.MapTypeId.ROADMAP};if(typeof EM.google_map_id_styles=="object"&&typeof EM.google_map_id_styles[map_id]!=="undefined"){console.log(EM.google_map_id_styles[map_id]);map_options.styles=EM.google_map_id_styles[map_id]}else if(typeof EM.google_maps_styles!=="undefined"){map_options.styles=EM.google_maps_styles}jQuery(document).triggerHandler("em_maps_locations_map_options",map_options);var marker_options={};jQuery(document).triggerHandler("em_maps_location_marker_options",marker_options);maps[map_id]=new google.maps.Map(el[0],map_options);maps_markers[map_id]=[];var bounds=new google.maps.LatLngBounds;jQuery.map(data,function(location,i){if(!(location.location_latitude==0&&location.location_longitude==0)){var latitude=parseFloat(location.location_latitude);var longitude=parseFloat(location.location_longitude);var location_position=new google.maps.LatLng(latitude,longitude);jQuery.extend(marker_options,{position:location_position,map:maps[map_id]});var marker=new google.maps.Marker(marker_options);maps_markers[map_id].push(marker);marker.setTitle(location.location_name);var myContent='<div class="em-map-balloon"><div id="em-map-balloon-'+map_id+'" class="em-map-balloon-content">'+location.location_balloon+"</div></div>";em_map_infobox(marker,myContent,maps[map_id]);bounds.extend(new google.maps.LatLng(latitude,longitude))}});maps[map_id].fitBounds(bounds);jQuery(document).triggerHandler("em_maps_locations_hook",[maps[map_id],data,map_id,maps_markers[map_id]])}else{el.children().first().html("No locations found");jQuery(document).triggerHandler("em_maps_locations_hook_not_found",[el])}})}function em_maps_load_location(el){el=jQuery(el);var map_id=el.attr("id").replace("em-location-map-","");em_LatLng=new google.maps.LatLng(jQuery("#em-location-map-coords-"+map_id+" .lat").text(),jQuery("#em-location-map-coords-"+map_id+" .lng").text());var map_options={zoom:14,center:em_LatLng,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false,gestureHandling:"cooperative"};if(typeof EM.google_map_id_styles=="object"&&typeof EM.google_map_id_styles[map_id]!=="undefined"){console.log(EM.google_map_id_styles[map_id]);map_options.styles=EM.google_map_id_styles[map_id]}else if(typeof EM.google_maps_styles!=="undefined"){map_options.styles=EM.google_maps_styles}jQuery(document).triggerHandler("em_maps_location_map_options",map_options);maps[map_id]=new google.maps.Map(document.getElementById("em-location-map-"+map_id),map_options);var marker_options={position:em_LatLng,map:maps[map_id]};jQuery(document).triggerHandler("em_maps_location_marker_options",marker_options);maps_markers[map_id]=new google.maps.Marker(marker_options);infoWindow=new google.maps.InfoWindow({content:jQuery("#em-location-map-info-"+map_id+" .em-map-balloon").get(0)});infoWindow.open(maps[map_id],maps_markers[map_id]);maps[map_id].panBy(40,-70);jQuery(document).triggerHandler("em_maps_location_hook",[maps[map_id],infoWindow,maps_markers[map_id],map_id]);jQuery(window).on("resize",function(e){google.maps.event.trigger(maps[map_id],"resize");maps[map_id].setCenter(maps_markers[map_id].getPosition());maps[map_id].panBy(40,-70)})}jQuery(document).on("em_search_ajax",function(e,vars,wrapper){if(em_maps_loaded){wrapper.find(".em-location-map").each(function(index,el){em_maps_load_location(el)});wrapper.find(".em-locations-map").each(function(index,el){em_maps_load_locations(el)})}});function em_maps(){jQuery(".em-location-map").each(function(index,el){em_maps_load_location(el)});jQuery(".em-locations-map").each(function(index,el){em_maps_load_locations(el)});if(jQuery("select#location-select-id, input#location-address").length>0){var map,marker;var refresh_map_location=function(){var location_latitude=jQuery("#location-latitude").val();var location_longitude=jQuery("#location-longitude").val();if(!(location_latitude==0&&location_longitude==0)){var position=new google.maps.LatLng(location_latitude,location_longitude);marker.setPosition(position);var mapTitle=jQuery("input#location-name").length>0?jQuery("input#location-name").val():jQuery("input#title").val();mapTitle=em_esc_attr(mapTitle);marker.setTitle(mapTitle);jQuery("#em-map").show();jQuery("#em-map-404").hide();google.maps.event.trigger(map,"resize");map.setCenter(position);map.panBy(40,-55);infoWindow.setContent('<div id="location-balloon-content"><strong>'+mapTitle+"</strong><br>"+em_esc_attr(jQuery("#location-address").val())+"<br>"+em_esc_attr(jQuery("#location-town").val())+"</div>");infoWindow.open(map,marker);jQuery(document).triggerHandler("em_maps_location_hook",[map,infoWindow,marker,0])}else{jQuery("#em-map").hide();jQuery("#em-map-404").show()}};var get_map_by_id=function(id){if(jQuery("#em-map").length>0){jQuery("#em-map-404 .em-loading-maps").show();jQuery.getJSON(document.URL,{em_ajax_action:"get_location",id:id},function(data){if(data.location_latitude!=0&&data.location_longitude!=0){loc_latlng=new google.maps.LatLng(data.location_latitude,data.location_longitude);marker.setPosition(loc_latlng);marker.setTitle(data.location_name);marker.setDraggable(false);jQuery("#em-map").show();jQuery("#em-map-404").hide();jQuery("#em-map-404 .em-loading-maps").hide();map.setCenter(loc_latlng);map.panBy(40,-55);infoWindow.setContent('<div id="location-balloon-content">'+data.location_balloon+"</div>");infoWindow.open(map,marker);google.maps.event.trigger(map,"resize");jQuery(document).triggerHandler("em_maps_location_hook",[map,infoWindow,marker,0])}else{jQuery("#em-map").hide();jQuery("#em-map-404").show();jQuery("#em-map-404 .em-loading-maps").hide()}})}};jQuery("#location-select-id, input#location-id").on("change",function(){get_map_by_id(jQuery(this).val())});jQuery("#location-name, #location-town, #location-address, #location-state, #location-postcode, #location-country").on("change",function(){if(jQuery(this).prop("readonly")===true)return;var addresses=[jQuery("#location-address").val(),jQuery("#location-town").val(),jQuery("#location-state").val(),jQuery("#location-postcode").val()];var address="";jQuery.each(addresses,function(i,val){if(val!=""){address=address==""?address+val:address+", "+val}});if(address==""){jQuery("#em-map").hide();jQuery("#em-map-404").show();return false}if(jQuery("#location-country option:selected").val()!=0){address=address==""?address+jQuery("#location-country option:selected").text():address+", "+jQuery("#location-country option:selected").text()}jQuery("#em-map-404 .em-loading-maps").show();if(address!=""&&jQuery("#em-map").length>0){geocoder.geocode({address:address},function(results,status){if(status==google.maps.GeocoderStatus.OK){jQuery("#location-latitude").val(results[0].geometry.location.lat());jQuery("#location-longitude").val(results[0].geometry.location.lng())}refresh_map_location()})}});if(jQuery("#em-map").length>0){var em_LatLng=new google.maps.LatLng(0,0);var map_options={zoom:14,center:em_LatLng,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:false,gestureHandling:"cooperative"};if(typeof EM.google_maps_styles!=="undefined"){map_options.styles=EM.google_maps_styles}map=new google.maps.Map(document.getElementById("em-map"),map_options);var marker=new google.maps.Marker({position:em_LatLng,map:map,draggable:true});infoWindow=new google.maps.InfoWindow({content:""});var geocoder=new google.maps.Geocoder;google.maps.event.addListener(infoWindow,"domready",function(){document.getElementById("location-balloon-content").parentNode.style.overflow="";document.getElementById("location-balloon-content").parentNode.parentNode.style.overflow=""});google.maps.event.addListener(marker,"dragend",function(){var position=marker.getPosition();jQuery("#location-latitude").val(position.lat());jQuery("#location-longitude").val(position.lng());map.setCenter(position);map.panBy(40,-55)});if(jQuery("#location-select-id").length>0){jQuery("#location-select-id").trigger("change")}else{refresh_map_location()}jQuery(document).triggerHandler("em_map_loaded",[map,infoWindow,marker])}jQuery(window).on("resize",function(e){google.maps.event.trigger(map,"resize");map.setCenter(marker.getPosition());map.panBy(40,-55)})}em_maps_loaded=true;jQuery(document).triggerHandler("em_maps_loaded")}function em_map_infobox(marker,message,map){var iw=new google.maps.InfoWindow({content:message});google.maps.event.addListener(marker,"click",function(){if(infoWindow)infoWindow.close();infoWindow=iw;iw.open(map,marker)})}function em_esc_attr(str){if(typeof str!=="string")return"";return str.replace(/</gi,"<").replace(/>/gi,">")}let openModal=function(modal,onOpen=null){modal=jQuery(modal);modal.appendTo(document.body);setTimeout(function(){modal.addClass("active").find(".em-modal-popup").addClass("active");jQuery(document).triggerHandler("em_modal_open",[modal]);if(typeof onOpen==="function"){onOpen()}},100)};let closeModal=function(modal,onClose=null){modal.removeClass("active").find(".em-modal-popup").removeClass("active");setTimeout(function(){if(modal.attr("data-parent")){let wrapper=jQuery("#"+modal.attr("data-parent"));if(wrapper.length){modal.appendTo(wrapper)}}modal.triggerHandler("em_modal_close");if(typeof onClose==="function"){onClose()}},500)};jQuery(document).on("click",".em-modal .em-close-modal",function(e){let modal=jQuery(this).closest(".em-modal");if(!modal.attr("data-prevent-close")){closeModal(modal)}});jQuery(document).on("click",".em-modal",function(e){var target=jQuery(e.target);if(target.hasClass("em-modal")){let modal=jQuery(this);if(!modal.attr("data-prevent-close")){closeModal(modal)}}});jQuery(document).ready(function($){let views_ddm_options={theme:"light-border",allowHTML:true,interactive:true,trigger:"manual",placement:"bottom",zIndex:1e6};$(document).trigger("em-search-views-trigger-vars",[views_ddm_options]);let tooltip_vars={theme:"light-border",appendTo:"parent",touch:false};$(document).trigger("em-tippy-vars",[tooltip_vars]);let search_forms=$(".em-search");search_forms.each(function(){let search=$(this);let search_id=search.attr("id").replace("em-search-","");let search_form=search.find(".em-search-form").first();let search_advanced=search.find(".em-search-advanced");const update_input_count=function(input,qty=1){let el=jQuery(input);let total=qty>0?qty:null;el.attr("data-advanced-total-input",total);update_search_totals()};const update_search_totals=function(applied=false){search.find("span.total-count").remove();let total=0;search_advanced.find("[data-advanced-total-input]").each(function(){let total_input=this.getAttribute("data-advanced-total-input");total+=Math.abs(total_input)});search.attr("data-advanced-total",total);update_trigger_count(applied);search_advanced.find(".em-search-advanced-section").each(function(){let section=$(this);let section_total=0;section.attr("data-advanced-total",0);section.find("[data-advanced-total-input]").each(function(){let total_input=this.getAttribute("data-advanced-total-input");section_total+=Math.abs(total_input)});section.attr("data-advanced-total",section_total);update_section_count(section)});if(total>0||!search.attr("data-advanced-previous-total")||total!=search.attr("data-advanced-previous-total")){update_submit_buttons(true)}update_clear_button_count()};const update_trigger_count=function(applied=false){let triggers=jQuery('.em-search-advanced-trigger[data-search-advanced-id="em-search-advanced-'+search_id+'"]');triggers.find("span.total-count").remove();let total=search.attr("data-advanced-total");if(total>0){let trigger_count=jQuery('<span class="total-count">'+total+"</span>").appendTo(triggers);if(!applied){trigger_count.addClass("tentative")}}};const update_submit_buttons=function(disabled=false){let submit_button=search_advanced.find('button[type="submit"]');let main_submit_button=search.find('.em-search-main-bar button[type="submit"]');let submit_buttons=submit_button.add(main_submit_button);if(disabled){submit_buttons.removeClass("disabled").attr("aria-disabled","false")}else{submit_buttons.addClass("disabled").attr("aria-disabled","true")}};const update_section_count=function(section){let section_total=section.attr("data-advanced-total");section.find("header span.total-count").remove();if(section_total>0){$('<span class="total-count">'+section_total+"</span>").appendTo(section.find("header"))}};const update_clear_button_count=function(){let clear_link=search_advanced.find('button[type="reset"]');if(!clear_link.attr("data-placeholder")){clear_link.attr("data-placeholder",clear_link.text())}let total=search.attr("data-advanced-total");if(total>0){clear_link.text(clear_link.attr("data-placeholder")+" ("+total+")").prop("disabled",false);clear_link.removeClass("disabled").attr("aria-disabled","false")}else{clear_link.text(clear_link.attr("data-placeholder"));clear_link.addClass("disabled").attr("aria-disabled","true")}};search.find(".em-search-views-trigger").each(function(){tooltip_vars.content=this.parentElement.getAttribute("aria-label");let views_tooltip=tippy(this.parentElement,tooltip_vars);let views_content=this.parentElement.querySelector(".em-search-views-options");let views_content_parent=views_content.parentElement;let views_select=views_content.querySelector("select");let tippy_content=document.createElement("div");views_ddm_options.content=tippy_content;let views_ddm=tippy(this,views_ddm_options);views_ddm.setProps({onShow(instance){views_tooltip.disable();tippy_content.append(views_content)},onShown(instance){views_select.focus()},onHidden(instance){views_tooltip.enable();if(views_content.parentElement!==views_content_parent){views_content_parent.append(views_content)}}});let tippy_listener=function(e){if(e.type==="keydown"&&!(e.which===13||e.which===40))return false;e.preventDefault();e.stopPropagation();this._tippy.show();views_tooltip.hide()};this.addEventListener("click",tippy_listener);this.addEventListener("keydown",tippy_listener);this.firstElementChild.addEventListener("focus",function(e){views_tooltip.show()});this.firstElementChild.addEventListener("blur",function(){views_tooltip.hide()});views_select.addEventListener("blur",function(){views_ddm.hide()})});search.on("keydown click",".em-search-views select.em-search-views-options-list",function(e){if(e.type==="keydown"&&e.which!==13)return true;let select=$(this);if(select.val().length>1){select.val([select.val().shift()])}let option=select.find(":checked").first();let views_wrapper=select.closest(".em-search-views");let view_type=option.attr("value");let trigger=views_wrapper.children(".em-search-views-trigger");let trigger_option=trigger.children(".em-search-view-option");if(view_type!==trigger_option.attr("data-view")){trigger_option.attr("data-view",option.attr("value")).text(option.text());$("#em-view-"+search_id).find("#em-view-custom-data-search-"+search_id).remove();search_form.trigger("forcesubmit")}trigger[0]._tippy.hide()});search.on("click","button.em-search-advanced-trigger",function(){if(search.hasClass("advanced-mode-inline")){if(!search_advanced.hasClass("visible")){search_advanced.slideDown().addClass("visible")}else{search_advanced.slideUp().removeClass("visible")}}else{if(!search_advanced.hasClass("active")){let form_wrapper=$('<form action="" method="post" class="em-search-advanced-form" id="em-search-form-advanced-'+search_id+'"></form>');form_wrapper.appendTo(search_advanced);search_advanced.find(".em-modal-popup").appendTo(form_wrapper);this.blur();openModal(search_advanced,function(){search_advanced.find("input.em-search-text").focus()})}}});search_advanced.on("em_modal_close",function(){search_advanced.find(".em-modal-popup").appendTo(search_advanced);search_advanced.children("form").remove();let trigger=search.find("button.em-search-advanced-trigger").focus();if("_tippy"in trigger[0]){trigger[0]._tippy.hide()}});search_advanced.find(".em-search-advanced-section > header").on("click",function(){let header=$(this);let section=header.closest("section");let content=header.siblings(".em-search-section-content");if(section.hasClass("active")){content.slideUp();section.removeClass("active")}else{content.slideDown();section.addClass("active")}});let search_form_advanced_calculate_totals_inputs=function(input){let el=$(input);let qty=el.val()!==""?1:0;update_input_count(el,qty)};search.on("change input",".em-search-main-bar input.em-search-text",function(e){let advanced_search_input=search_advanced.find("input.em-search-text");advanced_search_input.val(this.value);search_form_advanced_calculate_totals_inputs(advanced_search_input[0])});search.on("change",".em-search-main-bar input.em-search-geo-coords",function(){let el=$(this);let advanced_geo=search_advanced.find("div.em-search-geo");let advanced_geo_coords=advanced_geo.find("input.em-search-geo-coords");advanced_geo_coords.val(el.val()).attr("class",el.attr("class"));let geo_text=el.siblings("input.em-search-geo").first();advanced_geo.find("input.em-search-geo").val(geo_text.val()).attr("class",geo_text.attr("class"));search_form_advanced_calculate_totals_inputs(advanced_geo_coords)});search.find(".em-search-main-bar .em-datepicker input.em-search-scope.flatpickr-input").each(function(){if(!("_flatpickr"in this))return;this._flatpickr.config.onClose.push(function(selectedDates,dateStr,instance){let advanced_datepicker=search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input");advanced_datepicker[0]._flatpickr.setDate(selectedDates,true);advanced_datepicker[0]._flatpickr.close()})});search_advanced.on("change input","input.em-search-text",function(e){if(e.type==="change"){search.find(".em-search-main input.em-search-text").val(this.value)}else{search_form_advanced_calculate_totals_inputs(this)}});search_advanced.on("change","input.em-search-geo-coords",function(e){search_form_advanced_calculate_totals_inputs(this);let el=$(this);let main=search.find(".em-search-main div.em-search-geo");if(main.length>0){main.find("input.em-search-geo-coords").val(el.val()).attr("class",el.attr("class"));let geo_text=el.siblings("input.em-search-geo");main.find("input.em-search-geo").val(geo_text.val()).attr("class",geo_text.attr("class"))}});search_advanced.on("change","input.em-search-eventful",function(e){let el=$(this);let qty=el.prop("checked")?1:0;update_input_count(el,qty)});search_advanced.on("calculate_totals",function(){$(this).find("input.em-search-text, input.em-search-geo-coords").each(function(){search_form_advanced_calculate_totals_inputs(this)});$(this).find("input.em-search-eventful").trigger("change")});search_advanced.on("clear_search",function(){$(this).find("input.em-search-geo").removeClass("off").removeClass("on").val("")});search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input").each(function(){if(!("_flatpickr"in this))return;this._flatpickr.config.onClose.push(function(selectedDates,dateStr,instance){let previous_value=instance.input.getAttribute("data-previous-value");if(previous_value!==dateStr){let qty=dateStr?1:0;update_input_count(instance.input,qty);let main_datepicker=search.find(".em-search-main-bar .em-datepicker input.em-search-scope.flatpickr-input");main_datepicker[0]._flatpickr.setDate(selectedDates,true);instance.input.setAttribute("data-previous-value",dateStr)}})});search_advanced.on("calculate_totals",function(){search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input").first().each(function(){let qty=this._flatpickr.selectedDates.length>0?1:0;update_input_count(this,qty)})});search_advanced.on("clear_search",function(){search_advanced.find(".em-datepicker input.em-search-scope.flatpickr-input").each(function(){this._flatpickr.clear();update_input_count(this,0)})});let scope_calendar_check=function(){search.find(".em-datepicker input.em-search-scope.flatpickr-input").each(function(){if(search.attr("data-view")=="calendar"){this.setAttribute("data-advanced-total-input",0);this._flatpickr.input.disabled=true}else{this._flatpickr.input.disabled=false;let qty=this._flatpickr.selectedDates.length>0?1:0;this.setAttribute("data-advanced-total-input",qty)}})};$(document).on("em_search_loaded",scope_calendar_check);scope_calendar_check();search_advanced.find("select.em-selectize").each(function(){this.selectize.on("change",function(){search_advanced_selectize_change(this)})});search_advanced.on("calculate_totals",function(){$(this).find("select.em-selectize").each(function(){search_advanced_selectize_change(this.selectize)})});search_advanced.on("clear_search",function(){search_advanced.find("select.em-selectize").each(function(){this.selectize.clear();this.selectize.refreshItems();this.selectize.refreshOptions();if(!this.classList.contains("always-open")){this.selectize.close();this.selectize.$dropdown.hide()}})});let search_advanced_selectize_change=function(selectize){let qty=selectize.items.length;if(qty==1&&!selectize.items[0]){qty=0}update_input_count(selectize.$input,qty)};let locations_selectize_load_complete=function(){if("selectize"in this){this.selectize.settings.placeholder=this.selectize.settings.original_placeholder;this.selectize.updatePlaceholder();let options=[];this.selectize.$input.find("option").each(function(){let value=this.value!==null?this.value:this.innerHTML;options.push({value:value,text:this.innerHTML})});this.selectize.addOption(options);this.selectize.refreshOptions(false)}};let locations_selectize_load_start=function(){if("selectize"in this){this.selectize.clearOptions();if(!("original_placeholder"in this.selectize.settings))this.selectize.settings.original_placeholder=this.selectize.settings.placeholder;this.selectize.settings.placeholder=EM.txt_loading;this.selectize.updatePlaceholder()}};$(".em-search-advanced select[name=country], .em-search select[name=country]").on("change",function(){var el=$(this);let wrapper=el.closest(".em-search-location");wrapper.find("select[name=state]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=region]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=town]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=state], select[name=region], select[name=town]").each(locations_selectize_load_start);if(el.val()!=""){wrapper.find(".em-search-location-meta").slideDown();var data={action:"search_states",country:el.val(),return_html:true};wrapper.find("select[name=state]").load(EM.ajaxurl,data,locations_selectize_load_complete);data.action="search_regions";wrapper.find("select[name=region]").load(EM.ajaxurl,data,locations_selectize_load_complete);data.action="search_towns";wrapper.find("select[name=town]").load(EM.ajaxurl,data,locations_selectize_load_complete)}else{wrapper.find(".em-search-location-meta").slideUp()}});$(".em-search-advanced select[name=region], .em-search select[name=region]").on("change",function(){var el=$(this);let wrapper=el.closest(".em-search-location");wrapper.find("select[name=state]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=town]").html('<option value="">'+EM.txt_loading+"</option>");wrapper.find("select[name=state], select[name=town]").each(locations_selectize_load_start);var data={action:"search_states",region:el.val(),country:wrapper.find("select[name=country]").val(),return_html:true};wrapper.find("select[name=state]").load(EM.ajaxurl,data,locations_selectize_load_complete);data.action="search_towns";wrapper.find("select[name=town]").load(EM.ajaxurl,data,locations_selectize_load_complete)});$(".em-search-advanced select[name=state], .em-search select[name=state]").on("change",function(){var el=$(this);let wrapper=el.closest(".em-search-location");wrapper.find("select[name=town]").html('<option value="">'+EM.txt_loading+"</option>").each(locations_selectize_load_start);var data={action:"search_towns",state:el.val(),region:wrapper.find("select[name=region]").val(),country:wrapper.find("select[name=country]").val(),return_html:true};wrapper.find("select[name=town]").load(EM.ajaxurl,data,locations_selectize_load_complete)});search_advanced.on("click",'button[type="reset"]',function(){if(search.attr("data-advanced-total")==0)return;search_advanced.find("input.em-search-text, input.em-search-geo").val("").attr("data-advanced-total-input",null).trigger("change");search.trigger("clear_search");search_advanced.trigger("clear_search");update_search_totals(true);search_advanced.find(".em-search-advanced-section").removeClass("active").children(".em-search-section-content").slideUp();search_advanced.find('button[type="submit"]').trigger("forceclick");update_clear_button_count()}).each(function(){search_advanced.trigger("calculate_totals");update_search_totals(true)});const on_update_trigger_count=function(e,applied=true){update_trigger_count(applied)};search.on("update_trigger_count",on_update_trigger_count);search_advanced.on("update_trigger_count",on_update_trigger_count);search_advanced.on("click forceclick",'button[type="submit"]',function(e){e.preventDefault();if(this.classList.contains("disabled")&&e.type!=="forceclick")return false;closeModal(search_advanced,function(){search_form.submit()});return false});search.on("submit forcesubmit",".em-search-form",function(e){e.preventDefault();let form=$(this);let submit_buttons=form.find('button[type="submit"]');if(e.type!=="forcesubmit"&&submit_buttons.hasClass("disabled"))return false;let wrapper=form.closest(".em-search");if(wrapper.hasClass("em-search-legacy")){em_submit_legacy_search_form(form)}else{let view=$("#em-view-"+search_id);let view_type=form.find('[name="view"]').val();if(Array.isArray(view_type))view_type=view_type.shift();let custom_view_data=view.find("#em-view-custom-data-search-"+search_id).clone();let custom_view_data_container=$('<div class="em-view-custom-data"></div>');custom_view_data.children().appendTo(custom_view_data_container);custom_view_data.remove();custom_view_data_container.appendTo(form);view.append('<div class="em-loading"></div>');submit_buttons.each(function(){this.setAttribute("data-button-text",this.innerHTML);this.innerHTML=EM.txt_searching});var vars=form.serialize();$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){submit_buttons.each(function(){this.innerHTML=this.getAttribute("data-button-text")});view=EM_View_Updater(view,responseText);view.attr("data-view",view_type);search.attr("data-view",view_type);search_advanced.attr("data-view",view_type);jQuery(document).triggerHandler("em_view_loaded_"+view_type,[view,form,e]);jQuery(document).triggerHandler("em_search_loaded",[view,form,e]);jQuery(document).triggerHandler("em_search_result",[vars,view,e]);wrapper.find(".count.tentative").removeClass("tentative");submit_buttons.addClass("disabled").attr("aria-disabled","true");update_search_totals(true);search.attr("data-advanced-previous-total",search.attr("data-advanced-total"));update_submit_buttons(false);custom_view_data_container.remove()}})}return false});EM_ResizeObserver(EM.search.breakpoints,[search[0]])});$(document).on("click",".em-search-advanced-trigger[data-search-advanced-id]",function(){if(this.getAttribute("data-parent-trigger")){document.getElementById(this.getAttribute("data-parent-trigger")).click()}});$(document).on("click",".em-view-container .em-ajax.em-pagination a.page-numbers",function(e){var a=$(this);var data=a.closest(".em-pagination").attr("data-em-ajax");var view=a.closest(".em-view-container");var qvars=a.attr("href").split("?");var vars=qvars[1];if(data!=""){vars=vars!=""?vars+"&"+data:data}view.append('<div class="loading" id="em-loading"></div>');$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){view=EM_View_Updater(view,responseText);view.find(".em-pagination").each(function(){paginationObserver.observe(this)});jQuery(document).triggerHandler("em_page_loaded",[view])}});e.preventDefault();return false});const paginationObserver=new ResizeObserver(function(entries){for(let entry of entries){let el=entry.target;if(!el.classList.contains("observing")){el.classList.add("observing");let overflowing=false;el.classList.remove("overflowing");for(const item of el.querySelectorAll(".not-current")){if(item.scrollHeight>item.clientHeight||item.scrollWidth>item.clientWidth){overflowing=true;break}}if(overflowing){el.classList.add("overflowing")}el.classList.remove("observing")}}});$(".em-pagination").each(function(){paginationObserver.observe(this)});$(document).on("click change",".em-search-legacy .em-toggle",function(e){e.preventDefault();var el=$(this);var rel=el.attr("rel").split(":");if(el.hasClass("show-search")){if(rel.length>1){el.closest(rel[1]).find(rel[0]).slideUp()}else{$(rel[0]).slideUp()}el.find(".show, .show-advanced").show();el.find(".hide, .hide-advanced").hide();el.removeClass("show-search")}else{if(rel.length>1){el.closest(rel[1]).find(rel[0]).slideDown()}else{$(rel[0]).slideDown()}el.find(".show, .show-advanced").hide();el.find(".hide, .hide-advanced").show();el.addClass("show-search")}});let em_submit_legacy_search_form=function(form){if(this.em_search&&this.em_search.value==EM.txt_search){this.em_search.value=""}var results_wrapper=form.closest(".em-search-wrapper").find(".em-search-ajax");if(results_wrapper.length==0)results_wrapper=$(".em-search-ajax");if(results_wrapper.length>0){results_wrapper.append('<div class="loading" id="em-loading"></div>');var submitButton=form.find(".em-search-submit button");submitButton.attr("data-button-text",submitButton.val()).val(EM.txt_searching);var img=submitButton.children("img");if(img.length>0)img.attr("src",img.attr("src").replace("search-mag.png","search-loading.gif"));var vars=form.serialize();$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){submitButton.val(submitButton.attr("data-button-text"));if(img.length>0)img.attr("src",img.attr("src").replace("search-loading.gif","search-mag.png"));results_wrapper.replaceWith(responseText);if(form.find("input[name=em_search]").val()==""){form.find("input[name=em_search]").val(EM.txt_search)}results_wrapper=form.closest(".em-search-wrapper").find(".em-search-ajax");if(results_wrapper.length==0)results_wrapper=$(".em-search-ajax");jQuery(document).triggerHandler("em_search_ajax",[vars,results_wrapper,e])}});e.preventDefault();return false}};if($(".em-search-ajax").length>0){$(document).on("click",".em-search-ajax a.page-numbers",function(e){var a=$(this);var data=a.closest(".em-pagination").attr("data-em-ajax");var wrapper=a.closest(".em-search-ajax");var wrapper_parent=wrapper.parent();var qvars=a.attr("href").split("?");var vars=qvars[1];if(data!=""){vars=vars!=""?vars+"&"+data:data}vars+="&legacy=1";wrapper.append('<div class="loading" id="em-loading"></div>');$.ajax(EM.ajaxurl,{type:"POST",dataType:"html",data:vars,success:function(responseText){wrapper.replaceWith(responseText);wrapper=wrapper_parent.find(".em-search-ajax");jQuery(document).triggerHandler("em_search_ajax",[vars,wrapper,e])}});e.preventDefault();return false})}});jQuery(document).ready(function($){const em_calendar_init=function(calendar){calendar=$(calendar);if(!calendar.attr("id")||!calendar.attr("id").match(/^em-calendar-[0-9+]$/)){calendar.attr("id","em-calendar-"+Math.floor(Math.random()*1e4))}calendar.find("a").off("click");calendar.on("click","a.em-calnav, a.em-calnav-today",function(e){e.preventDefault();const el=$(this);if(el.data("disabled")==1||el.attr("href")==="")return;el.closest(".em-calendar").prepend('<div class="loading" id="em-loading"></div>');let url=em_ajaxify(el.attr("href"));const calendar_id=calendar.attr("id").replace("em-calendar-","");const custom_data=$("form#em-view-custom-data-calendar-"+calendar_id);let form_data=[];if(custom_data.length>0){form_data=new FormData(custom_data[0]);let url_params=new URL(url,window.location.origin).searchParams;for(const[key,value]of url_params.entries()){form_data.set(key,value)}}$.ajax({url:url,data:form_data,processData:false,contentType:false,method:"POST",success:function(data){let view=EM_View_Updater(calendar,data);if(view.hasClass("em-view-container")){calendar=view.find(".em-calendar")}else{calendar=view}calendar.trigger("em_calendar_load")},dataType:"html"})});let calendar_trigger_ajax=function(calendar,year,month){let link=calendar.find(".em-calnav-next");let url=new URL(link.attr("href"),window.location.origin);url.searchParams.set("mo",month);url.searchParams.set("yr",year);link.attr("href",url.toString()).trigger("click")};let calendar_resize_monthpicker=function(instance,text){let span=$('<span class="marker">'+text+"</span>");span.insertAfter(instance);let width=span.width()+40;span.remove();instance.style.setProperty("width",width+"px","important")};let calendar_month_init=function(){let month_form=calendar.find(".month form");calendar.find(".event-style-pill .em-cal-event").on("click",function(e){e.preventDefault();if(!(calendar.hasClass("preview-tooltips")&&calendar.data("preview-tooltips-trigger"))&&!calendar.hasClass("preview-modal")){let link=this.getAttribute("data-event-url");if(link!==null){}}});if(month_form.length>0){month_form.find('input[type="submit"]').hide();let select=$('<select style="display:none;visibility:hidden;"></select>').appendTo(month_form);let option=$("<option></option>").appendTo(select);let current_datetime=calendar.find('select[name="month"]').val()+calendar.find('select[name="year"]').val();let month=calendar.find('select[name="month"]');let year=calendar.find('select[name="year"]');let monthpicker=calendar.find(".em-month-picker");let month_value=monthpicker.data("month-value");monthpicker.prop("type","text").prop("value",month_value);calendar_resize_monthpicker(monthpicker[0],month_value);let monthpicker_wrapper=$("#em-flatpickr");if(monthpicker_wrapper.length===0){monthpicker_wrapper=$('<div class="em pixelbones" id="em-flatpickr"></div>').appendTo("body")}let minDate=null;if(calendar.data("scope")==="future"){minDate=new Date;minDate.setMonth(minDate.getMonth()-1)}monthpicker.flatpickr({appendTo:monthpicker_wrapper[0],dateFormat:"F Y",minDate:minDate,disableMobile:"true",plugins:[new monthSelectPlugin({shorthand:true,dateFormat:"F Y",altFormat:"F Y"})],onChange:function(selectedDates,dateStr,instance){calendar_resize_monthpicker(instance.input,dateStr);calendar_trigger_ajax(calendar,selectedDates[0].getFullYear(),selectedDates[0].getMonth()+1)}});monthpicker.addClass("select-toggle")}if(calendar.hasClass("preview-tooltips")){var tooltip_vars={theme:"light-border",allowHTML:true,interactive:true,trigger:"mouseenter focus click",content(reference){return document.createElement("div")},onShow(instance){const id=instance.reference.getAttribute("data-event-id");const template=calendar.find('section.em-cal-events-content .em-cal-event-content[data-event-id="'+id+'"]');instance.props.content.append(template.first().clone()[0])},onHide(instance){instance.props.content.innerHTML=""}};if(calendar.data("preview-tooltips-trigger")){tooltip_vars.trigger=calendar.data("preview-tooltips-trigger")}$(document).trigger("em-tippy-cal-event-vars",[tooltip_vars]);tippy(calendar.find(".em-cal-event").toArray(),tooltip_vars)}else if(calendar.hasClass("preview-modal")){calendar.find(".em-cal-event").on("click",function(){const id=this.getAttribute("data-event-id");const modal=calendar.find('section.em-cal-events-content .em-cal-event-content[data-event-id="'+id+'"]');modal.attr("data-calendar-id",calendar.attr("id"));openModal(modal)})}if(calendar.hasClass("responsive-dateclick-modal")){calendar.find(".eventful .em-cal-day-date, .eventful-post .em-cal-day-date, .eventful-pre .em-cal-day-date").on("click",function(e){e.preventDefault();const id=this.getAttribute("data-calendar-date");const modal=calendar.find('.em-cal-date-content[data-calendar-date="'+id+'"]');modal.attr("data-calendar-id",calendar.attr("id"));openModal(modal)})}if(!calendar.hasClass("size-fixed")){EM_ResizeObserver(EM.calendar.breakpoints,[calendar[0],calendar[0]])}calendar.find(".date-day-colors").each(function(){let colors=JSON.parse(this.getAttribute("data-colors"));let day=$(this).siblings(".em-cal-day-date.colored");let sides={1:{1:"--date-border-color",class:"one"},2:{1:"--date-border-color-top",2:"--date-border-color-bottom",class:"two"},3:{1:"--date-border-color-top",2:"--date-border-color-right",3:"--date-border-color-bottom",class:"three"},4:{1:"--date-border-color-top",2:"--date-border-color-right",3:"--date-border-color-bottom",4:"--date-border-color-left",class:"four"}};for(let i=0;i<colors.length;i+=4){const ring_colors=colors.slice(i,i+4);let outer_ring=day.children().first();let new_ring=$('<div class="ring"></div>').prependTo(day);outer_ring.appendTo(new_ring);new_ring.addClass(sides[ring_colors.length].class);for(let it=0;it<ring_colors.length;it++){new_ring.css(sides[ring_colors.length][it+1],ring_colors[it])}}});if(calendar.hasClass("with-advanced")){const trigger=calendar.find(".em-search-advanced-trigger");const search_advanced=$("#"+trigger.attr("data-search-advanced-id"));search_advanced.triggerHandler("update_trigger_count")}};calendar_month_init();$(document).triggerHandler("em_calendar_loaded",[calendar])};$(".em-calendar").each(function(){let calendar=$(this);em_calendar_init(calendar)});$(document).on("em_calendar_load",".em-calendar",function(){em_calendar_init(this)});$(document).on("em_view_loaded_calendar",function(e,view,form){let calendar;if(view.hasClass("em-calendar")){calendar=view}else{calendar=view.find(".em-calendar").first()}em_calendar_init(calendar)})});let EM_View_Updater=function(element,html){let content=jQuery(html);let view=element.hasClass("em-view-container")?element:element.parent(".em-view-container");if(view.length>0){if(content.hasClass("em-view-container")){view.replaceWith(content);view=content}else{view.empty().append(content)}}else{if(content.hasClass("em-view-container")){element.replaceWith(content);view=content}else if(content.attr("data-view-id")){let view=jQuery('<div class="em em-view-container"></div>');let view_id=content.attr("data-view-id");view.attr("data-view-id",view_id);view.attr("id","em-view-"+view_id);view.attr("data-view-type",content.attr("data-view-type"));view.append(content);element.replaceWith(view)}}return view};let EM_ResizeObserver=function(breakpoints,elements){const ro=new ResizeObserver(function(entries){for(let entry of entries){let el=entry.target;for(const[name,breakpoint]of Object.entries(breakpoints)){if(el.offsetWidth<=breakpoint||breakpoint===false){for(let breakpoint_name of Object.keys(breakpoints)){if(breakpoint_name!==name)el.classList.remove("size-"+breakpoint_name)}el.classList.add("size-"+name);break}}}});elements.forEach(function(el){if(typeof el!=="undefined"){ro.observe(el)}});return ro};jQuery(document).ready(function($){let breakpoints={small:600,large:false};const events_ro=EM_ResizeObserver(breakpoints,$(".em-list").toArray());$(document).on("em_page_loaded em_view_loaded",function(e,view){let new_elements=view.find(".em-list").each(function(){events_ro.observe(this)})});breakpoints={small:600,medium:900,large:false};const event_ro=EM_ResizeObserver(breakpoints,$(".em-event-single").toArray());$(document).on("em_view_loaded",function(e,view){let new_elements=view.find(".em-event-single").each(function(){event_ro.observe(this)})});$(document).on("click",".em-event-booking-form .em-login-trigger a",function(e){e.preventDefault();var parent=$(this).closest(".em-event-booking-form");parent.find(".em-login-trigger").hide();parent.find(".em-login-content").fadeIn();let login_form=parent.find(".em-login");login_form[0].scrollIntoView({behavior:"smooth"});login_form.first().find('input[name="log"]').focus()});$(document).on("click",".em-event-booking-form .em-login-cancel",function(e){e.preventDefault();let parent=$(this).closest(".em-event-booking-form");parent.find(".em-login-content").hide();parent.find(".em-login-trigger").show()});EM_ResizeObserver({small:500,large:false},$(".em-login").toArray())});document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("form.em-ajax-form").forEach(function(el){el.addEventListener("submit",function(e){e.preventDefault();let form=e.currentTarget;let formData=new FormData(form);let button=form.querySelector('button[type="submit"]');let loader;if(form.classList.contains("no-overlay-spinner")){form.classList.add("loading")}else{let loader=document.createElement("div");loader.id="em-loading";form.append(loader)}var request=new XMLHttpRequest;if(form.getAttribute("data-api-url")){request.open("POST",form.getAttribute("data-api-url"),true);request.setRequestHeader("X-WP-Nonce",EM.api_nonce)}else{request.open("POST",EM.ajaxurl,true)}request.onload=function(){if(loader)loader.remove();if(this.status>=200&&this.status<400){try{let data=JSON.parse(this.response);let notice;if(!form.classList.contains("no-inline-notice")){notice=form.querySelector(".em-notice");if(!notice){notice=document.createElement("li");form.prepend(notice);if(formData.get("action")){form.dispatchEvent(new CustomEvent("em_ajax_form_success_"+formData.get("action"),{detail:{form:form,notice:notice,response:data}}))}}notice.innerHTML="";notice.setAttribute("class","em-notice")}if(data.result){if(!form.classList.contains("no-inline-notice")){notice.classList.add("em-notice-success");notice.innerHTML=data.message;form.replaceWith(notice)}else{form.classList.add("load-successful");form.classList.remove("loading");if(data.message){EM_Alert(data.message)}}}else{if(!form.classList.contains("no-inline-notice")){notice.classList.add("em-notice-error");notice.innerHTML=data.errors}else{EM_Alert(data.errors)}}}catch(e){alert("Error Encountered : "+e)}}else{alert("Error encountered... please see debug logs or contact support.")}form.classList.remove("loading")};request.onerror=function(){alert("Connection error encountered... please see debug logs or contact support.")};request.send(formData);return false})})});function EM_Alert(content){let modal=document.getElementById("em-alert-modal");if(modal===null){modal=document.createElement("div");modal.setAttribute("class","em pixelbones em-modal");modal.id="em-alert-modal";modal.innerHTML='<div class="em-modal-popup"><header><a class="em-close-modal"></a><div class="em-modal-title"> </div></header><div class="em-modal-content" id="em-alert-modal-content"></div></div>';document.body.append(modal)}document.getElementById("em-alert-modal-content").innerHTML=content;openModal(modal)}(function(){"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj}}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}return target}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _createForOfIteratorHelper(o){if(typeof Symbol==="undefined"||o[Symbol.iterator]==null){if(Array.isArray(o)||(o=_unsupportedIterableToArray(o))){var i=0;var F=function(){};return{s:F,n:function(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var it,normalCompletion=true,didErr=false,err;return{s:function(){it=o[Symbol.iterator]()},n:function(){var step=it.next();normalCompletion=step.done;return step},e:function(e){didErr=true;err=e},f:function(){try{if(!normalCompletion&&it.return!=null)it.return()}finally{if(didErr)throw err}}}}var ONE_DAY=86400;var roundingFunction=function roundingFunction(seconds,settings){if(seconds===null){return null}else if(typeof settings.step!=="number"){return seconds}else{var offset=seconds%(settings.step*60);var start=settings.minTime||0;offset-=start%(settings.step*60);if(offset>=settings.step*30){seconds+=settings.step*60-offset}else{seconds-=offset}return _moduloSeconds(seconds,settings)}};function _moduloSeconds(seconds,settings){if(seconds==ONE_DAY&&settings.show2400){return seconds}return seconds%ONE_DAY}var DEFAULT_SETTINGS={appendTo:"body",className:null,closeOnWindowScroll:false,disableTextInput:false,disableTimeRanges:[],disableTouchKeyboard:false,durationTime:null,forceRoundTime:false,lang:{},listWidth:null,maxTime:null,minTime:null,noneOption:false,orientation:"l",roundingFunction:roundingFunction,scrollDefault:null,selectOnBlur:false,show2400:false,showDuration:false,showOn:["click","focus"],showOnFocus:true,step:30,stopScrollPropagation:false,timeFormat:"g:ia",typeaheadHighlight:true,useSelect:false,wrapHours:true};var DEFAULT_LANG={am:"am",pm:"pm",AM:"AM",PM:"PM",decimal:".",mins:"mins",hr:"hr",hrs:"hrs"};var Timepicker=function(){function Timepicker(targetEl){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Timepicker);this._handleFormatValue=this._handleFormatValue.bind(this);this._handleKeyUp=this._handleKeyUp.bind(this);this.targetEl=targetEl;var attrOptions=Timepicker.extractAttrOptions(targetEl,Object.keys(DEFAULT_SETTINGS));this.settings=this.parseSettings(_objectSpread2(_objectSpread2(_objectSpread2({},DEFAULT_SETTINGS),options),attrOptions))}_createClass(Timepicker,[{key:"hideMe",value:function hideMe(){if(this.settings.useSelect){this.targetEl.blur();return}if(!this.list||!Timepicker.isVisible(this.list)){return}if(this.settings.selectOnBlur){this._selectValue()}this.list.hide();var hideTimepickerEvent=new CustomEvent("hideTimepicker");this.targetEl.dispatchEvent(hideTimepickerEvent)}},{key:"_findRow",value:function _findRow(value){if(!value&&value!==0){return false}var out=false;var value=this.settings.roundingFunction(value,this.settings);if(!this.list){return false}this.list.find("li").each(function(i,obj){var parsed=Number.parseInt(obj.dataset.time);if(Number.isNaN(parsed)){return}if(parsed==value){out=obj;return false}});return out}},{key:"_hideKeyboard",value:function _hideKeyboard(){return(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.settings.disableTouchKeyboard}},{key:"_setTimeValue",value:function _setTimeValue(value,source){if(this.targetEl.nodeName==="INPUT"){if(value!==null||this.targetEl.value!=""){this.targetEl.value=value}var tp=this;var settings=tp.settings;if(settings.useSelect&&source!="select"&&tp.list){tp.list.val(tp._roundAndFormatTime(tp.time2int(value)))}}var selectTimeEvent=new Event("selectTime");if(this.selectedValue!=value){this.selectedValue=value;var changeTimeEvent=new Event("changeTime");var changeEvent=new CustomEvent("change",{detail:"em_timepicker"});if(source=="select"){this.targetEl.dispatchEvent(selectTimeEvent);this.targetEl.dispatchEvent(changeTimeEvent);this.targetEl.dispatchEvent(changeEvent)}else if(["error","initial"].indexOf(source)==-1){this.targetEl.dispatchEvent(changeTimeEvent)}return true}else{if(["error","initial"].indexOf(source)==-1){this.targetEl.dispatchEvent(selectTimeEvent)}return false}}},{key:"_getTimeValue",value:function _getTimeValue(){if(this.targetEl.nodeName==="INPUT"){return this.targetEl.value}else{return this.selectedValue}}},{key:"_selectValue",value:function _selectValue(){var tp=this;var settings=tp.settings;var list=tp.list;var cursor=list.find(".ui-em_timepicker-selected");if(cursor.hasClass("ui-em_timepicker-disabled")){return false}if(!cursor.length){return true}var timeValue=cursor.get(0).dataset.time;if(timeValue){var parsedTimeValue=Number.parseInt(timeValue);if(!Number.isNaN(parsedTimeValue)){timeValue=parsedTimeValue}}if(timeValue!==null){if(typeof timeValue!="string"){timeValue=tp._int2time(timeValue)}tp._setTimeValue(timeValue,"select")}return true}},{key:"time2int",value:function time2int(timeString){if(timeString===""||timeString===null||timeString===undefined)return null;if(timeString instanceof Date){return timeString.getHours()*3600+timeString.getMinutes()*60+timeString.getSeconds()}if(typeof timeString!="string"){return timeString}timeString=timeString.toLowerCase().replace(/[\s\.]/g,"");if(timeString.slice(-1)=="a"||timeString.slice(-1)=="p"){timeString+="m"}var pattern=/^(([^0-9]*))?([0-9]?[0-9])(([0-5][0-9]))?(([0-5][0-9]))?(([^0-9]*))$/;var hasDelimetersMatch=timeString.match(/\W/);if(hasDelimetersMatch){pattern=/^(([^0-9]*))?([0-9]?[0-9])(\W+([0-5][0-9]?))?(\W+([0-5][0-9]))?(([^0-9]*))$/}var time=timeString.match(pattern);if(!time){return null}var hour=parseInt(time[3]*1,10);var ampm=time[2]||time[9];var hours=hour;var minutes=time[5]*1||0;var seconds=time[7]*1||0;if(!ampm&&time[3].length==2&&time[3][0]=="0"){ampm="am"}if(hour<=12&&m){ampm=ampm.trim();var isPm=ampm==this.settings.lang.pm||ampm==this.settings.lang.PM;if(hour==12){hours=isPm?12:0}else{hours=hour+(isPm?12:0)}}else{var t=hour*3600+minutes*60+seconds;if(t>=ONE_DAY+(this.settings.show2400?1:0)){if(this.settings.wrapHours===false){return null}hours=hour%24}}var timeInt=hours*3600+minutes*60+seconds;if(hour<12&&!ampm&&this.settings._twelveHourTime&&this.settings.scrollDefault){var delta=timeInt-this.settings.scrollDefault();if(delta<0&&delta>=ONE_DAY/-2){timeInt=(timeInt+ONE_DAY/2)%ONE_DAY}}return timeInt}},{key:"parseSettings",value:function parseSettings(settings){var _this=this;settings.lang=_objectSpread2(_objectSpread2({},DEFAULT_LANG),settings.lang);this.settings=settings;if(settings.minTime){settings.minTime=this.time2int(settings.minTime)}if(settings.maxTime){settings.maxTime=this.time2int(settings.maxTime)}if(settings.listWidth){settings.listWidth=this.time2int(settings.listWidth)}if(settings.durationTime&&typeof settings.durationTime!=="function"){settings.durationTime=this.time2int(settings.durationTime)}if(settings.scrollDefault=="now"){settings.scrollDefault=function(){return settings.roundingFunction(_this.time2int(new Date),settings)}}else if(settings.scrollDefault&&typeof settings.scrollDefault!="function"){var val=settings.scrollDefault;settings.scrollDefault=function(){return settings.roundingFunction(_this.time2int(val),settings)}}else if(settings.minTime){settings.scrollDefault=function(){return settings.roundingFunction(settings.minTime,settings)}}if(typeof settings.timeFormat==="string"&&settings.timeFormat.match(/[gh]/)){settings._twelveHourTime=true}if(settings.showOnFocus===false&&settings.showOn.indexOf("focus")!=-1){settings.showOn.splice(settings.showOn.indexOf("focus"),1)}if(!settings.disableTimeRanges){settings.disableTimeRanges=[]}if(settings.disableTimeRanges.length>0){for(var i in settings.disableTimeRanges){settings.disableTimeRanges[i]=[this.time2int(settings.disableTimeRanges[i][0]),this.time2int(settings.disableTimeRanges[i][1])]}settings.disableTimeRanges=settings.disableTimeRanges.sort(function(a,b){return a[0]-b[0]});for(var i=settings.disableTimeRanges.length-1;i>0;i--){if(settings.disableTimeRanges[i][0]<=settings.disableTimeRanges[i-1][1]){settings.disableTimeRanges[i-1]=[Math.min(settings.disableTimeRanges[i][0],settings.disableTimeRanges[i-1][0]),Math.max(settings.disableTimeRanges[i][1],settings.disableTimeRanges[i-1][1])];settings.disableTimeRanges.splice(i,1)}}}return settings}},{key:"_disableTextInputHandler",value:function _disableTextInputHandler(e){switch(e.keyCode){case 13:case 9:return;default:e.preventDefault()}}},{key:"_int2duration",value:function _int2duration(seconds,step){seconds=Math.abs(seconds);var minutes=Math.round(seconds/60),duration=[],hours,mins;if(minutes<60){duration=[minutes,this.settings.lang.mins]}else{hours=Math.floor(minutes/60);mins=minutes%60;if(step==30&&mins==30){hours+=this.settings.lang.decimal+5}duration.push(hours);duration.push(hours==1?this.settings.lang.hr:this.settings.lang.hrs);if(step!=30&&mins){duration.push(mins);duration.push(this.settings.lang.mins)}}return duration.join(" ")}},{key:"_roundAndFormatTime",value:function _roundAndFormatTime(seconds){seconds=this.settings.roundingFunction(seconds,this.settings);if(seconds!==null){return this._int2time(seconds)}}},{key:"_int2time",value:function _int2time(timeInt){if(typeof timeInt!="number"){return null}var seconds=parseInt(timeInt%60),minutes=parseInt(timeInt/60%60),hours=parseInt(timeInt/(60*60)%24);var time=new Date(1970,0,2,hours,minutes,seconds,0);if(isNaN(time.getTime())){return null}if(typeof this.settings.timeFormat==="function"){return this.settings.timeFormat(time)}var output="";var hour,code;for(var i=0;i<this.settings.timeFormat.length;i++){code=this.settings.timeFormat.charAt(i);switch(code){case"a":output+=time.getHours()>11?this.settings.lang.pm:this.settings.lang.am;break;case"A":output+=time.getHours()>11?this.settings.lang.PM:this.settings.lang.AM;break;case"g":hour=time.getHours()%12;output+=hour===0?"12":hour;break;case"G":hour=time.getHours();if(timeInt===ONE_DAY)hour=this.settings.show2400?24:0;output+=hour;break;case"h":hour=time.getHours()%12;if(hour!==0&&hour<10){hour="0"+hour}output+=hour===0?"12":hour;break;case"H":hour=time.getHours();if(timeInt===ONE_DAY)hour=this.settings.show2400?24:0;output+=hour>9?hour:"0"+hour;break;case"i":var minutes=time.getMinutes();output+=minutes>9?minutes:"0"+minutes;break;case"s":seconds=time.getSeconds();output+=seconds>9?seconds:"0"+seconds;break;case"\\":i++;output+=this.settings.timeFormat.charAt(i);break;default:output+=code}}return output}},{key:"_setSelected",value:function _setSelected(){var list=this.list;list.find("li").removeClass("ui-em_timepicker-selected");var timeValue=this.time2int(this._getTimeValue());if(timeValue===null){return}var selected=this._findRow(timeValue);if(selected){var selectedRect=selected.getBoundingClientRect();var listRect=list.get(0).getBoundingClientRect();var topDelta=selectedRect.top-listRect.top;if(topDelta+selectedRect.height>listRect.height||topDelta<0){var newScroll=list.scrollTop()+(selectedRect.top-listRect.top)-selectedRect.height;list.scrollTop(newScroll)}var parsed=Number.parseInt(selected.dataset.time);if(this.settings.forceRoundTime||parsed===timeValue){selected.classList.add("ui-em_timepicker-selected")}}}},{key:"_isFocused",value:function _isFocused(el){return el===document.activeElement}},{key:"_handleFormatValue",value:function _handleFormatValue(e){if(e&&e.detail=="em_timepicker"){return}this._formatValue(e)}},{key:"_formatValue",value:function _formatValue(e,origin){if(this.targetEl.value===""){this._setTimeValue(null,origin);return}if(this._isFocused(this.targetEl)&&(!e||e.type!="change")){return}var settings=this.settings;var seconds=this.time2int(this.targetEl.value);if(seconds===null){var timeFormatErrorEvent=new CustomEvent("timeFormatError");this.targetEl.dispatchEvent(timeFormatErrorEvent);return}var rangeError=false;if(settings.minTime!==null&&settings.maxTime!==null&&(seconds<settings.minTime||seconds>settings.maxTime)){rangeError=true}var _iterator=_createForOfIteratorHelper(settings.disableTimeRanges),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var range=_step.value;if(seconds>=range[0]&&seconds<range[1]){rangeError=true;break}}}catch(err){_iterator.e(err)}finally{_iterator.f()}if(settings.forceRoundTime){var roundSeconds=settings.roundingFunction(seconds,settings);if(roundSeconds!=seconds){seconds=roundSeconds;origin=null}}var prettyTime=this._int2time(seconds);if(rangeError){this._setTimeValue(prettyTime);var timeRangeErrorEvent=new CustomEvent("timeRangeError");this.targetEl.dispatchEvent(timeRangeErrorEvent)}else{this._setTimeValue(prettyTime,origin)}}},{key:"_generateNoneElement",value:function _generateNoneElement(optionValue,useSelect){var label,className,value;if(_typeof(optionValue)=="object"){label=optionValue.label;className=optionValue.className;value=optionValue.value}else if(typeof optionValue=="string"){label=optionValue;value=""}else{$.error("Invalid noneOption value")}var el;if(useSelect){el=document.createElement("option");el.value=value}else{el=document.createElement("li");el.dataset.time=String(value)}el.innerText=label;el.classList.add(className);return el}},{key:"_handleKeyUp",value:function _handleKeyUp(e){if(!this.list||!Timepicker.isVisible(this.list)||this.settings.disableTextInput){return true}if(e.type==="paste"||e.type==="cut"){setTimeout(function(){if(this.settings.typeaheadHighlight){this._setSelected()}else{this.list.hide()}},0);return}switch(e.keyCode){case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 77:case 80:case 186:case 8:case 46:if(this.settings.typeaheadHighlight){this._setSelected()}else{this.list.hide()}break}}}],[{key:"extractAttrOptions",value:function extractAttrOptions(element,keys){var output={};var _iterator2=_createForOfIteratorHelper(keys),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var key=_step2.value;if(key in element.dataset){output[key]=element.dataset[key]}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}return output}},{key:"isVisible",value:function isVisible(elem){var el=elem[0];return el.offsetWidth>0&&el.offsetHeight>0}},{key:"hideAll",value:function hideAll(){var _iterator3=_createForOfIteratorHelper(document.getElementsByClassName("ui-em_timepicker-input")),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var el=_step3.value;var tp=el.em_timepickerObj;if(tp){tp.hideMe()}}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}}]);return Timepicker}();(function(factory){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&exports&&(typeof module==="undefined"?"undefined":_typeof(module))==="object"&&module&&module.exports===exports){factory(require("jquery"))}else if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){var _lang={};var methods={init:function init(options){return this.each(function(){var self=$(this);var tp=new Timepicker(this,options);var settings=tp.settings;_lang=settings.lang;this.em_timepickerObj=tp;self.addClass("ui-em_timepicker-input");if(settings.useSelect){_render(self)}else{self.prop("autocomplete","off");if(settings.showOn){for(var i in settings.showOn){self.on(settings.showOn[i]+".em_timepicker",methods.show)}}self.on("change.em_timepicker",tp._handleFormatValue);self.on("keydown.em_timepicker",_keydownhandler);self.on("keyup.em_timepicker",tp._handleKeyUp);if(settings.disableTextInput){self.on("keydown.em_timepicker",tp._disableTextInputHandler)}self.on("cut.em_timepicker",tp._handleKeyUp);self.on("paste.em_timepicker",tp._handleKeyUp);tp._formatValue(null,"initial")}})},show:function show(e){var self=$(this);var tp=self[0].em_timepickerObj;var settings=tp.settings;if(e){e.preventDefault()}if(settings.useSelect){tp.list.trigger("focus");return}if(tp._hideKeyboard()){self.trigger("blur")}var list=tp.list;if(self.prop("readonly")){return}if(!list||list.length===0||typeof settings.durationTime==="function"){_render(self);list=tp.list}if(Timepicker.isVisible(list)){return}if(self.is("input")){tp.selectedValue=self.val()}tp._setSelected();Timepicker.hideAll();if(typeof settings.listWidth=="number"){list.width(self.outerWidth()*settings.listWidth)}list.show();var listOffset={};if(settings.orientation.match(/r/)){listOffset.left=self.offset().left+self.outerWidth()-list.outerWidth()+parseInt(list.css("marginLeft").replace("px",""),10)}else if(settings.orientation.match(/l/)){listOffset.left=self.offset().left+parseInt(list.css("marginLeft").replace("px",""),10)}else if(settings.orientation.match(/c/)){listOffset.left=self.offset().left+(self.outerWidth()-list.outerWidth())/2+parseInt(list.css("marginLeft").replace("px",""),10)}var verticalOrientation;if(settings.orientation.match(/t/)){verticalOrientation="t"}else if(settings.orientation.match(/b/)){verticalOrientation="b"}else if(self.offset().top+self.outerHeight(true)+list.outerHeight()>$(window).height()+$(window).scrollTop()){verticalOrientation="t"}else{verticalOrientation="b"}if(verticalOrientation=="t"){list.addClass("ui-em_timepicker-positioned-top");listOffset.top=self.offset().top-list.outerHeight()+parseInt(list.css("marginTop").replace("px",""),10)}else{list.removeClass("ui-em_timepicker-positioned-top");listOffset.top=self.offset().top+self.outerHeight()+parseInt(list.css("marginTop").replace("px",""),10)}list.offset(listOffset);var selected=list.find(".ui-em_timepicker-selected");if(!selected.length){var timeInt=tp.time2int(tp._getTimeValue());if(timeInt!==null){selected=$(tp._findRow(timeInt))}else if(settings.scrollDefault){selected=$(tp._findRow(settings.scrollDefault()))}}if(!selected.length||selected.hasClass("ui-em_timepicker-disabled")){selected=list.find("li:not(.ui-em_timepicker-disabled):first")}if(selected&&selected.length){var topOffset=list.scrollTop()+selected.position().top-selected.outerHeight();list.scrollTop(topOffset)}else{list.scrollTop(0)}if(settings.stopScrollPropagation){$(document).on("wheel.ui-em_timepicker",".ui-em_timepicker-wrapper",function(e){e.preventDefault();var currentScroll=$(this).scrollTop();$(this).scrollTop(currentScroll+e.originalEvent.deltaY)})}$(document).on("mousedown.ui-em_timepicker",_closeHandler);$(window).on("resize.ui-em_timepicker",_closeHandler);if(settings.closeOnWindowScroll){$(document).on("scroll.ui-em_timepicker",_closeHandler)}self.trigger("showTimepicker");return this},hide:function hide(e){var tp=this[0].em_timepickerObj;if(tp){tp.hideMe()}Timepicker.hideAll();return this},option:function option(key,value){if(typeof key=="string"&&typeof value=="undefined"){var tp=this[0].em_timepickerObj;return tp.settings[key]}return this.each(function(){var self=$(this);var tp=self[0].em_timepickerObj;var settings=tp.settings;var list=tp.list;if(_typeof(key)=="object"){settings=$.extend(settings,key)}else if(typeof key=="string"){settings[key]=value}settings=tp.parseSettings(settings);tp.settings=settings;tp._formatValue({type:"change"},"initial");if(list){list.remove();tp.list=null}if(settings.useSelect){_render(self)}})},getSecondsFromMidnight:function getSecondsFromMidnight(){var tp=this[0].em_timepickerObj;return tp.time2int(tp._getTimeValue())},getTime:function getTime(relative_date){var tp=this[0].em_timepickerObj;var time_string=tp._getTimeValue();if(!time_string){return null}var offset=tp.time2int(time_string);if(offset===null){return null}if(!relative_date){relative_date=new Date}var time=new Date(relative_date);time.setHours(offset/3600);time.setMinutes(offset%3600/60);time.setSeconds(offset%60);time.setMilliseconds(0);return time},isVisible:function isVisible(){var tp=this[0].em_timepickerObj;return!!(tp&&tp.list&&Timepicker.isVisible(tp.list))},setTime:function setTime(value){var tp=this[0].em_timepickerObj;var settings=tp.settings;if(settings.forceRoundTime){var prettyTime=tp._roundAndFormatTime(tp.time2int(value))}else{var prettyTime=tp._int2time(tp.time2int(value))}if(value&&prettyTime===null&&settings.noneOption){prettyTime=value}tp._setTimeValue(prettyTime,"initial");tp._formatValue({type:"change"},"initial");if(tp&&tp.list){tp._setSelected()}return this},remove:function remove(){var self=this;if(!self.hasClass("ui-em_timepicker-input")){return}var tp=self[0].em_timepickerObj;var settings=tp.settings;self.removeAttr("autocomplete","off");self.removeClass("ui-em_timepicker-input");self.removeData("em_timepicker-obj");self.off(".em_timepicker");if(tp.list){tp.list.remove()}if(settings.useSelect){self.show()}tp.list=null;return this}};function _render(self){var tp=self[0].em_timepickerObj;var list=tp.list;var settings=tp.settings;if(list&&list.length){list.remove();tp.list=null}if(settings.useSelect){list=$("<select></select>",{class:"ui-em_timepicker-select"});if(self.attr("name")){list.attr("name","ui-em_timepicker-"+self.attr("name"))}var wrapped_list=list}else{list=$("<ul></ul>",{class:"ui-em_timepicker-list"});var wrapped_list=$("<div></div>",{class:"ui-em_timepicker-wrapper",tabindex:-1});wrapped_list.css({display:"none",position:"absolute"}).append(list)}if(settings.noneOption){if(settings.noneOption===true){settings.noneOption=settings.useSelect?"Time...":"None"}if($.isArray(settings.noneOption)){for(var i in settings.noneOption){if(parseInt(i,10)==i){var noneElement=tp._generateNoneElement(settings.noneOption[i],settings.useSelect);list.append(noneElement)}}}else{var noneElement=tp._generateNoneElement(settings.noneOption,settings.useSelect);list.append(noneElement)}}if(settings.className){wrapped_list.addClass(settings.className)}if((settings.minTime!==null||settings.durationTime!==null)&&settings.showDuration){var stepval=typeof settings.step=="function"?"function":settings.step;wrapped_list.addClass("ui-em_timepicker-with-duration");wrapped_list.addClass("ui-em_timepicker-step-"+settings.step)}var durStart=settings.minTime;if(typeof settings.durationTime==="function"){durStart=tp.time2int(settings.durationTime())}else if(settings.durationTime!==null){durStart=settings.durationTime}var start=settings.minTime!==null?settings.minTime:0;var end=settings.maxTime!==null?settings.maxTime:start+ONE_DAY-1;if(end<start){end+=ONE_DAY}if(end===ONE_DAY-1&&$.type(settings.timeFormat)==="string"&&settings.show2400){end=ONE_DAY}var dr=settings.disableTimeRanges;var drCur=0;var drLen=dr.length;var stepFunc=settings.step;if(typeof stepFunc!="function"){stepFunc=function stepFunc(){return settings.step}}for(var i=start,j=0;i<=end;j++,i+=stepFunc(j)*60){var timeInt=i;var timeString=tp._int2time(timeInt);if(settings.useSelect){var row=$("<option></option>",{value:timeString});row.text(timeString)}else{var row=$("<li></li>");row.addClass(timeInt%ONE_DAY<ONE_DAY/2?"ui-em_timepicker-am":"ui-em_timepicker-pm");row.attr("data-time",roundingFunction(timeInt,settings));row.text(timeString)}if((settings.minTime!==null||settings.durationTime!==null)&&settings.showDuration){var durationString=tp._int2duration(i-durStart,settings.step);if(settings.useSelect){row.text(row.text()+" ("+durationString+")")}else{var duration=$("<span></span>",{class:"ui-em_timepicker-duration"});duration.text(" ("+durationString+")");row.append(duration)}}if(drCur<drLen){if(timeInt>=dr[drCur][1]){drCur+=1}if(dr[drCur]&&timeInt>=dr[drCur][0]&&timeInt<dr[drCur][1]){if(settings.useSelect){row.prop("disabled",true)}else{row.addClass("ui-em_timepicker-disabled")}}}list.append(row)}wrapped_list.data("em_timepicker-input",self);tp.list=wrapped_list;if(settings.useSelect){if(self.val()){list.val(tp._roundAndFormatTime(tp.time2int(self.val())))}list.on("focus",function(){$(this).data("em_timepicker-input").trigger("showTimepicker")});list.on("blur",function(){$(this).data("em_timepicker-input").trigger("hideTimepicker")});list.on("change",function(){tp._setTimeValue($(this).val(),"select")});tp._setTimeValue(list.val(),"initial");self.hide().after(list)}else{var appendTo=settings.appendTo;if(typeof appendTo==="string"){appendTo=$(appendTo)}else if(typeof appendTo==="function"){appendTo=appendTo(self)}appendTo.append(wrapped_list);tp._setSelected();list.on("mousedown click","li",function(e){self.off("focus.em_timepicker");self.on("focus.em_timepicker-ie-hack",function(){self.off("focus.em_timepicker-ie-hack");self.on("focus.em_timepicker",methods.show)});if(!tp._hideKeyboard()){self[0].focus()}list.find("li").removeClass("ui-em_timepicker-selected");$(this).addClass("ui-em_timepicker-selected");if(tp._selectValue()){self.trigger("hideTimepicker");list.on("mouseup.em_timepicker click.em_timepicker","li",function(e){list.off("mouseup.em_timepicker click.em_timepicker");wrapped_list.hide()})}})}}function _closeHandler(e){if(e.target==window){return}var target=$(e.target);if(target.closest(".ui-em_timepicker-input").length||target.closest(".ui-em_timepicker-wrapper").length){return}Timepicker.hideAll();$(document).off(".ui-em_timepicker");$(window).off(".ui-em_timepicker")}function _keydownhandler(e){var self=$(this);var tp=self[0].em_timepickerObj;var list=tp.list;if(!list||!Timepicker.isVisible(list)){if(e.keyCode==40){methods.show.call(self.get(0));list=tp.list;if(!tp._hideKeyboard()){self.trigger("focus")}}else{return true}}switch(e.keyCode){case 13:if(tp._selectValue()){tp._formatValue({type:"change"});tp.hideMe()}e.preventDefault();return false;case 38:var selected=list.find(".ui-em_timepicker-selected");if(!selected.length){list.find("li").each(function(i,obj){if($(obj).position().top>0){selected=$(obj);return false}});selected.addClass("ui-em_timepicker-selected")}else if(!selected.is(":first-child")){selected.removeClass("ui-em_timepicker-selected");selected.prev().addClass("ui-em_timepicker-selected");if(selected.prev().position().top<selected.outerHeight()){list.scrollTop(list.scrollTop()-selected.outerHeight())}}return false;case 40:selected=list.find(".ui-em_timepicker-selected");if(selected.length===0){list.find("li").each(function(i,obj){if($(obj).position().top>0){selected=$(obj);return false}});selected.addClass("ui-em_timepicker-selected")}else if(!selected.is(":last-child")){selected.removeClass("ui-em_timepicker-selected");selected.next().addClass("ui-em_timepicker-selected");if(selected.next().position().top+2*selected.outerHeight()>list.outerHeight()){list.scrollTop(list.scrollTop()+selected.outerHeight())}}return false;case 27:list.find("li").removeClass("ui-em_timepicker-selected");tp.hideMe();break;case 9:tp.hideMe();break;default:return true}}$.fn.em_timepicker=function(method){if(!this.length)return this;if(methods[method]){if(!this.hasClass("ui-em_timepicker-input")){return this}return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(_typeof(method)==="object"||!method){return methods.init.apply(this,arguments)}else{$.error("Method "+method+" does not exist on jQuery.em_timepicker")}};$.fn.em_timepicker.defaults=DEFAULT_SETTINGS})})();!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).flatpickr=n()}(this,function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function n(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var a=Array(e),i=0;for(n=0;n<t;n++)for(var o=arguments[n],r=0,l=o.length;r<l;r++,i++)a[i]=o[r];return a}var t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],a={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var n=new Date(e.getTime());n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7);var t=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n){var t;return function(){var a=this,i=arguments;clearTimeout(t),t=setTimeout(function(){return e.apply(a,i)},n)}}var c=function(e){return e instanceof Array?e:[e]};function s(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function d(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){return n(e)?e:e.parentNode?f(e.parentNode,n):void 0}function m(e,n){var t=d("div","numInputWrapper"),a=d("input","numInput "+e),i=d("span","arrowUp"),o=d("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function g(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var p=function(){},h=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},v={D:p,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:p,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:p,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},D={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},w={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[w.w(e,n,t)]},F:function(e,n,t){return h(w.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(w.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return h(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map(function(n,a,o){return w[n]&&"\\"!==o[a-1]?w[n](e,i,t):"\\"!==n?n:""}).join(""):t.formatDate(e,n,i)}},C=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,s=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var d=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(t&&t.parseDate)l=t.parseDate(e,d);else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else{for(var f=void 0,m=[],g=0,p=0,h="";g<d.length;g++){var w=d[g],b="\\"===w,C="\\"===d[g-1]||b;if(D[w]&&!C){h+=D[w];var M=new RegExp(h).exec(e);M&&(f=!0)&&m["Y"!==w?"push":"unshift"]({fn:v[w],val:M[++p]})}else b||(h+=".")}l=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),m.forEach(function(e){var n=e.fn,t=e.val;return l=n(l,t,c)||l}),l=f?l:void 0}}if(l instanceof Date&&!isNaN(l.getTime()))return!0===i&&l.setHours(0,0,0,0),l;t.errorHandler(new Error("Invalid date provided: "+s))}}};function M(e,n,t){return void 0===t&&(t=!0),!1!==t?new Date(e.getTime()).setHours(0,0,0,0)-new Date(n.getTime()).setHours(0,0,0,0):e.getTime()-n.getTime()}var y=function(e,n,t){return 3600*e+60*n+t},x=864e5;function E(e){var n=e.defaultHour,t=e.defaultMinute,a=e.defaultSeconds;if(void 0!==e.minDate){var i=e.minDate.getHours(),o=e.minDate.getMinutes(),r=e.minDate.getSeconds();n<i&&(n=i),n===i&&t<o&&(t=o),n===i&&t===o&&a<r&&(a=e.minDate.getSeconds())}if(void 0!==e.maxDate){var l=e.maxDate.getHours(),c=e.maxDate.getMinutes();(n=Math.min(n,l))===l&&(t=Math.min(c,t)),n===l&&t===c&&(a=e.maxDate.getSeconds())}return{hours:n,minutes:t,seconds:a}}"function"!=typeof Object.assign&&(Object.assign=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var a=function(n){n&&Object.keys(n).forEach(function(t){return e[t]=n[t]})},i=0,o=n;i<o.length;i++){var r=o[i];a(r)}return e});function k(p,v){var w={config:e(e({},a),I.defaultConfig),l10n:i};function k(){var e;return(null===(e=w.calendarContainer)||void 0===e?void 0:e.getRootNode()).activeElement||document.activeElement}function T(e){return e.bind(w)}function S(){var e=w.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame(function(){if(void 0!==w.calendarContainer&&(w.calendarContainer.style.visibility="hidden",w.calendarContainer.style.display="block"),void 0!==w.daysContainer){var n=(w.days.offsetWidth+1)*e.showMonths;w.daysContainer.style.width=n+"px",w.calendarContainer.style.width=n+(void 0!==w.weekWrapper?w.weekWrapper.offsetWidth:0)+"px",w.calendarContainer.style.removeProperty("visibility"),w.calendarContainer.style.removeProperty("display")}})}function _(e){if(0===w.selectedDates.length){var n=void 0===w.config.minDate||M(new Date,w.config.minDate)>=0?new Date:new Date(w.config.minDate.getTime()),t=E(w.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),w.selectedDates=[n],w.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=g(e),a=t;void 0!==w.amPM&&t===w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]);var i=parseFloat(a.getAttribute("min")),l=parseFloat(a.getAttribute("max")),c=parseFloat(a.getAttribute("step")),s=parseInt(a.value,10),d=e.delta||(n?38===e.which?1:-1:0),u=s+c*d;if(void 0!==a.value&&2===a.value.length){var f=a===w.hourElement,m=a===w.minuteElement;u<i?(u=l+u+r(!f)+(r(f)&&r(!w.amPM)),m&&L(void 0,-1,w.hourElement)):u>l&&(u=a===w.hourElement?u-l-r(!w.amPM):i,m&&L(void 0,1,w.hourElement)),w.amPM&&f&&(1===c?u+s===23:Math.abs(u-s)>c)&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]),a.value=o(u)}}(e);var a=w._input.value;O(),ye(),w._input.value!==a&&w._debouncedChange()}function O(){if(void 0!==w.hourElement&&void 0!==w.minuteElement){var e,n,t=(parseInt(w.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(w.minuteElement.value,10)||0)%60,i=void 0!==w.secondElement?(parseInt(w.secondElement.value,10)||0)%60:0;void 0!==w.amPM&&(e=t,n=w.amPM.textContent,t=e%12+12*r(n===w.l10n.amPM[1]));var o=void 0!==w.config.minTime||w.config.minDate&&w.minDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.minDate,!0),l=void 0!==w.config.maxTime||w.config.maxDate&&w.maxDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.maxDate,!0);if(void 0!==w.config.maxTime&&void 0!==w.config.minTime&&w.config.minTime>w.config.maxTime){var c=y(w.config.minTime.getHours(),w.config.minTime.getMinutes(),w.config.minTime.getSeconds()),s=y(w.config.maxTime.getHours(),w.config.maxTime.getMinutes(),w.config.maxTime.getSeconds()),d=y(t,a,i);if(d>s&&d<c){var u=function(e){var n=Math.floor(e/3600),t=(e-3600*n)/60;return[n,t,e-3600*n-60*t]}(c);t=u[0],a=u[1],i=u[2]}}else{if(l){var f=void 0!==w.config.maxTime?w.config.maxTime:w.config.maxDate;(t=Math.min(t,f.getHours()))===f.getHours()&&(a=Math.min(a,f.getMinutes())),a===f.getMinutes()&&(i=Math.min(i,f.getSeconds()))}if(o){var m=void 0!==w.config.minTime?w.config.minTime:w.config.minDate;(t=Math.max(t,m.getHours()))===m.getHours()&&a<m.getMinutes()&&(a=m.getMinutes()),a===m.getMinutes()&&(i=Math.max(i,m.getSeconds()))}}A(t,a,i)}}function F(e){var n=e||w.latestSelectedDateObj;n&&n instanceof Date&&A(n.getHours(),n.getMinutes(),n.getSeconds())}function A(e,n,t){void 0!==w.latestSelectedDateObj&&w.latestSelectedDateObj.setHours(e%24,n,t||0,0),w.hourElement&&w.minuteElement&&!w.isMobile&&(w.hourElement.value=o(w.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),w.minuteElement.value=o(n),void 0!==w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(e>=12)]),void 0!==w.secondElement&&(w.secondElement.value=o(t)))}function N(e){var n=g(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&ee(t)}function P(e,n,t,a){return n instanceof Array?n.forEach(function(n){return P(e,n,t,a)}):e instanceof Array?e.forEach(function(e){return P(e,n,t,a)}):(e.addEventListener(n,t,a),void w._handlers.push({remove:function(){return e.removeEventListener(n,t,a)}}))}function Y(){De("onChange")}function j(e,n){var t=void 0!==e?w.parseDate(e):w.latestSelectedDateObj||(w.config.minDate&&w.config.minDate>w.now?w.config.minDate:w.config.maxDate&&w.config.maxDate<w.now?w.config.maxDate:w.now),a=w.currentYear,i=w.currentMonth;try{void 0!==t&&(w.currentYear=t.getFullYear(),w.currentMonth=t.getMonth())}catch(e){e.message="Invalid date supplied: "+t,w.config.errorHandler(e)}n&&w.currentYear!==a&&(De("onYearChange"),q()),!n||w.currentYear===a&&w.currentMonth===i||De("onMonthChange"),w.redraw()}function H(e){var n=g(e);~n.className.indexOf("arrow")&&L(e,n.classList.contains("arrowUp")?1:-1)}function L(e,n,t){var a=e&&g(e),i=t||a&&a.parentNode&&a.parentNode.firstChild,o=we("increment");o.delta=n,i&&i.dispatchEvent(o)}function R(e,n,t,a){var i=ne(n,!0),o=d("span",e,n.getDate().toString());return o.dateObj=n,o.$i=a,o.setAttribute("aria-label",w.formatDate(n,w.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===M(n,w.now)&&(w.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,be(n)&&(o.classList.add("selected"),w.selectedDateElem=o,"range"===w.config.mode&&(s(o,"startRange",w.selectedDates[0]&&0===M(n,w.selectedDates[0],!0)),s(o,"endRange",w.selectedDates[1]&&0===M(n,w.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===w.config.mode&&function(e){return!("range"!==w.config.mode||w.selectedDates.length<2)&&(M(e,w.selectedDates[0])>=0&&M(e,w.selectedDates[1])<=0)}(n)&&!be(n)&&o.classList.add("inRange"),w.weekNumbers&&1===w.config.showMonths&&"prevMonthDay"!==e&&a%7==6&&w.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+w.config.getWeek(n)+"</span>"),De("onDayCreate",o),o}function W(e){e.focus(),"range"===w.config.mode&&oe(e)}function B(e){for(var n=e>0?0:w.config.showMonths-1,t=e>0?w.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=w.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&ne(c.dateObj))return c}}function J(e,n){var t=k(),a=te(t||document.body),i=void 0!==e?e:a?t:void 0!==w.selectedDateElem&&te(w.selectedDateElem)?w.selectedDateElem:void 0!==w.todayDateElem&&te(w.todayDateElem)?w.todayDateElem:B(n>0?1:-1);void 0===i?w._input.focus():a?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():w.currentMonth,a=n>0?w.config.showMonths:-1,i=n>0?1:-1,o=t-w.currentMonth;o!=a;o+=i)for(var r=w.daysContainer.children[o],l=t-w.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,s=l;s>=0&&s<c&&s!=(n>0?c:-1);s+=i){var d=r.children[s];if(-1===d.className.indexOf("hidden")&&ne(d.dateObj)&&Math.abs(e.$i-s)>=Math.abs(n))return W(d)}w.changeMonth(i),J(B(i),0)}(i,n):W(i)}function K(e,n){for(var t=(new Date(e,n,1).getDay()-w.l10n.firstDayOfWeek+7)%7,a=w.utils.getDaysInMonth((n-1+12)%12,e),i=w.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=w.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",s=a+1-t,u=0;s<=a;s++,u++)o.appendChild(R("flatpickr-day "+l,new Date(e,n-1,s),0,u));for(s=1;s<=i;s++,u++)o.appendChild(R("flatpickr-day",new Date(e,n,s),0,u));for(var f=i+1;f<=42-t&&(1===w.config.showMonths||u%7!=0);f++,u++)o.appendChild(R("flatpickr-day "+c,new Date(e,n+1,f%i),0,u));var m=d("div","dayContainer");return m.appendChild(o),m}function U(){if(void 0!==w.daysContainer){u(w.daysContainer),w.weekNumbers&&u(w.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n<w.config.showMonths;n++){var t=new Date(w.currentYear,w.currentMonth,1);t.setMonth(w.currentMonth+n),e.appendChild(K(t.getFullYear(),t.getMonth()))}w.daysContainer.appendChild(e),w.days=w.daysContainer.firstChild,"range"===w.config.mode&&1===w.selectedDates.length&&oe()}}function q(){if(!(w.config.showMonths>1||"dropdown"!==w.config.monthSelectorType)){var e=function(e){return!(void 0!==w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&e<w.config.minDate.getMonth())&&!(void 0!==w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()&&e>w.config.maxDate.getMonth())};w.monthsDropdownContainer.tabIndex=-1,w.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=d("option","flatpickr-monthDropdown-month");t.value=new Date(w.currentYear,n).getMonth().toString(),t.textContent=h(n,w.config.shorthandCurrentMonth,w.l10n),t.tabIndex=-1,w.currentMonth===n&&(t.selected=!0),w.monthsDropdownContainer.appendChild(t)}}}function $(){var e,n=d("div","flatpickr-month"),t=window.document.createDocumentFragment();w.config.showMonths>1||"static"===w.config.monthSelectorType?e=d("span","cur-month"):(w.monthsDropdownContainer=d("select","flatpickr-monthDropdown-months"),w.monthsDropdownContainer.setAttribute("aria-label",w.l10n.monthAriaLabel),P(w.monthsDropdownContainer,"change",function(e){var n=g(e),t=parseInt(n.value,10);w.changeMonth(t-w.currentMonth),De("onMonthChange")}),q(),e=w.monthsDropdownContainer);var a=m("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",w.l10n.yearAriaLabel),w.config.minDate&&i.setAttribute("min",w.config.minDate.getFullYear().toString()),w.config.maxDate&&(i.setAttribute("max",w.config.maxDate.getFullYear().toString()),i.disabled=!!w.config.minDate&&w.config.minDate.getFullYear()===w.config.maxDate.getFullYear());var o=d("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function V(){u(w.monthNav),w.monthNav.appendChild(w.prevMonthNav),w.config.showMonths&&(w.yearElements=[],w.monthElements=[]);for(var e=w.config.showMonths;e--;){var n=$();w.yearElements.push(n.yearElement),w.monthElements.push(n.monthElement),w.monthNav.appendChild(n.container)}w.monthNav.appendChild(w.nextMonthNav)}function z(){w.weekdayContainer?u(w.weekdayContainer):w.weekdayContainer=d("div","flatpickr-weekdays");for(var e=w.config.showMonths;e--;){var n=d("div","flatpickr-weekdaycontainer");w.weekdayContainer.appendChild(n)}return G(),w.weekdayContainer}function G(){if(w.weekdayContainer){var e=w.l10n.firstDayOfWeek,t=n(w.l10n.weekdays.shorthand);e>0&&e<t.length&&(t=n(t.splice(e,t.length),t.splice(0,e)));for(var a=w.config.showMonths;a--;)w.weekdayContainer.children[a].innerHTML="\n <span class='flatpickr-weekday'>\n "+t.join("</span><span class='flatpickr-weekday'>")+"\n </span>\n "}}function Z(e,n){void 0===n&&(n=!0);var t=n?e:e-w.currentMonth;t<0&&!0===w._hidePrevMonthArrow||t>0&&!0===w._hideNextMonthArrow||(w.currentMonth+=t,(w.currentMonth<0||w.currentMonth>11)&&(w.currentYear+=w.currentMonth>11?1:-1,w.currentMonth=(w.currentMonth+12)%12,De("onYearChange"),q()),U(),De("onMonthChange"),Ce())}function Q(e){return w.calendarContainer.contains(e)}function X(e){if(w.isOpen&&!w.config.inline){var n=g(e),t=Q(n),a=!(n===w.input||n===w.altInput||w.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(w.input)||~e.path.indexOf(w.altInput)))&&!t&&!Q(e.relatedTarget),i=!w.config.ignoredFocusElements.some(function(e){return e.contains(n)});a&&i&&(w.config.allowInput&&w.setDate(w._input.value,!1,w.config.altInput?w.config.altFormat:w.config.dateFormat),void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement&&""!==w.input.value&&void 0!==w.input.value&&_(),w.close(),w.config&&"range"===w.config.mode&&1===w.selectedDates.length&&w.clear(!1))}}function ee(e){if(!(!e||w.config.minDate&&e<w.config.minDate.getFullYear()||w.config.maxDate&&e>w.config.maxDate.getFullYear())){var n=e,t=w.currentYear!==n;w.currentYear=n||w.currentYear,w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth=Math.min(w.config.maxDate.getMonth(),w.currentMonth):w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&(w.currentMonth=Math.max(w.config.minDate.getMonth(),w.currentMonth)),t&&(w.redraw(),De("onYearChange"),q())}}function ne(e,n){var t;void 0===n&&(n=!0);var a=w.parseDate(e,void 0,n);if(w.config.minDate&&a&&M(a,w.config.minDate,void 0!==n?n:!w.minDateHasTime)<0||w.config.maxDate&&a&&M(a,w.config.maxDate,void 0!==n?n:!w.maxDateHasTime)>0)return!1;if(!w.config.enable&&0===w.config.disable.length)return!0;if(void 0===a)return!1;for(var i=!!w.config.enable,o=null!==(t=w.config.enable)&&void 0!==t?t:w.config.disable,r=0,l=void 0;r<o.length;r++){if("function"==typeof(l=o[r])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l){var c=w.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.getTime()<=l.to.getTime())return i}return!i}function te(e){return void 0!==w.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&w.daysContainer.contains(e))}function ae(e){var n=e.target===w._input,t=w._input.value.trimEnd()!==Me();!n||!t||e.relatedTarget&&Q(e.relatedTarget)||w.setDate(w._input.value,!0,e.target===w.altInput?w.config.altFormat:w.config.dateFormat)}function ie(e){var n=g(e),t=w.config.wrap?p.contains(n):n===w._input,a=w.config.allowInput,i=w.isOpen&&(!a||!t),o=w.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return w.setDate(w._input.value,!0,n===w.altInput?w.config.altFormat:w.config.dateFormat),w.close(),n.blur();w.open()}else if(Q(n)||i||o){var r=!!w.timeContainer&&w.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),_(),fe()):me(e);break;case 27:e.preventDefault(),fe();break;case 8:case 46:t&&!w.config.allowInput&&(e.preventDefault(),w.clear());break;case 37:case 39:if(r||t)w.hourElement&&w.hourElement.focus();else{e.preventDefault();var l=k();if(void 0!==w.daysContainer&&(!1===a||l&&te(l))){var c=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),Z(c),J(B(1),0)):J(void 0,c)}}break;case 38:case 40:e.preventDefault();var s=40===e.keyCode?1:-1;w.daysContainer&&void 0!==n.$i||n===w.input||n===w.altInput?e.ctrlKey?(e.stopPropagation(),ee(w.currentYear-s),J(B(1),0)):r||J(void 0,7*s):n===w.currentYearElement?ee(w.currentYear-s):w.config.enableTime&&(!r&&w.hourElement&&w.hourElement.focus(),_(e),w._debouncedChange());break;case 9:if(r){var d=[w.hourElement,w.minuteElement,w.secondElement,w.amPM].concat(w.pluginElements).filter(function(e){return e}),u=d.indexOf(n);if(-1!==u){var f=d[u+(e.shiftKey?-1:1)];e.preventDefault(),(f||w._input).focus()}}else!w.config.noCalendar&&w.daysContainer&&w.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),w._input.focus())}}if(void 0!==w.amPM&&n===w.amPM)switch(e.key){case w.l10n.amPM[0].charAt(0):case w.l10n.amPM[0].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[0],O(),ye();break;case w.l10n.amPM[1].charAt(0):case w.l10n.amPM[1].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[1],O(),ye()}(t||Q(n))&&De("onKeyDown",e)}function oe(e,n){if(void 0===n&&(n="flatpickr-day"),1===w.selectedDates.length&&(!e||e.classList.contains(n)&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():w.days.firstElementChild.dateObj.getTime(),a=w.parseDate(w.selectedDates[0],void 0,!0).getTime(),i=Math.min(t,w.selectedDates[0].getTime()),o=Math.max(t,w.selectedDates[0].getTime()),r=!1,l=0,c=0,s=i;s<o;s+=x)ne(new Date(s),!0)||(r=r||s>i&&s<o,s<a&&(!l||s>l)?l=s:s>a&&(!c||s<c)&&(c=s));Array.from(w.rContainer.querySelectorAll("*:nth-child(-n+"+w.config.showMonths+") > ."+n)).forEach(function(n){var i,o,s,d=n.dateObj.getTime(),u=l>0&&d<l||c>0&&d>c;if(u)return n.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach(function(e){n.classList.remove(e)});r&&!u||(["startRange","inRange","endRange","notAllowed"].forEach(function(e){n.classList.remove(e)}),void 0!==e&&(e.classList.add(t<=w.selectedDates[0].getTime()?"startRange":"endRange"),a<t&&d===a?n.classList.add("startRange"):a>t&&d===a&&n.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=a,s=t,(i=d)>Math.min(o,s)&&i<Math.max(o,s))&&n.classList.add("inRange")))})}}function re(){!w.isOpen||w.config.static||w.config.inline||de()}function le(e){return function(n){var t=w.config["_"+e+"Date"]=w.parseDate(n,w.config.dateFormat),a=w.config["_"+("min"===e?"max":"min")+"Date"];void 0!==t&&(w["min"===e?"minDateHasTime":"maxDateHasTime"]=t.getHours()>0||t.getMinutes()>0||t.getSeconds()>0),w.selectedDates&&(w.selectedDates=w.selectedDates.filter(function(e){return ne(e)}),w.selectedDates.length||"min"!==e||F(t),ye()),w.daysContainer&&(ue(),void 0!==t?w.currentYearElement[e]=t.getFullYear().toString():w.currentYearElement.removeAttribute(e),w.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function ce(){return w.config.wrap?p.querySelector("[data-input]"):p}function se(){"object"!=typeof w.config.locale&&void 0===I.l10ns[w.config.locale]&&w.config.errorHandler(new Error("flatpickr: invalid locale "+w.config.locale)),w.l10n=e(e({},I.l10ns.default),"object"==typeof w.config.locale?w.config.locale:"default"!==w.config.locale?I.l10ns[w.config.locale]:void 0),D.D="("+w.l10n.weekdays.shorthand.join("|")+")",D.l="("+w.l10n.weekdays.longhand.join("|")+")",D.M="("+w.l10n.months.shorthand.join("|")+")",D.F="("+w.l10n.months.longhand.join("|")+")",D.K="("+w.l10n.amPM[0]+"|"+w.l10n.amPM[1]+"|"+w.l10n.amPM[0].toLowerCase()+"|"+w.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},v),JSON.parse(JSON.stringify(p.dataset||{}))).time_24hr&&void 0===I.defaultConfig.time_24hr&&(w.config.time_24hr=w.l10n.time_24hr),w.formatDate=b(w),w.parseDate=C({config:w.config,l10n:w.l10n})}function de(e){if("function"!=typeof w.config.position){if(void 0!==w.calendarContainer){De("onPreCalendarPosition");var n=e||w._positionElement,t=Array.prototype.reduce.call(w.calendarContainer.children,function(e,n){return e+n.offsetHeight},0),a=w.calendarContainer.offsetWidth,i=w.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,d="above"===o||"below"!==o&&c<t&&l.top>t,u=window.pageYOffset+l.top+(d?-t-2:n.offsetHeight+2);if(s(w.calendarContainer,"arrowTop",!d),s(w.calendarContainer,"arrowBottom",d),!w.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),s(w.calendarContainer,"arrowLeft",!m&&!g),s(w.calendarContainer,"arrowCenter",m),s(w.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(s(w.calendarContainer,"rightMost",h),!w.config.static)if(w.calendarContainer.style.top=u+"px",h)if(v){var D=function(){for(var e=null,n=0;n<document.styleSheets.length;n++){var t=document.styleSheets[n];if(t.cssRules){try{t.cssRules}catch(e){continue}e=t;break}}return null!=e?e:(a=document.createElement("style"),document.head.appendChild(a),a.sheet);var a}();if(void 0===D)return;var b=window.document.body.offsetWidth,C=Math.max(0,b/2-a/2),M=D.cssRules.length,y="{left:"+l.left+"px;right:auto;}";s(w.calendarContainer,"rightMost",!1),s(w.calendarContainer,"centerMost",!0),D.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+y,M),w.calendarContainer.style.left=C+"px",w.calendarContainer.style.right="auto"}else w.calendarContainer.style.left="auto",w.calendarContainer.style.right=p+"px";else w.calendarContainer.style.left=f+"px",w.calendarContainer.style.right="auto"}}}else w.config.position(w,e)}function ue(){w.config.noCalendar||w.isMobile||(q(),Ce(),U())}function fe(){w._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(w.close,0):w.close()}function me(e){e.preventDefault(),e.stopPropagation();var n=f(g(e),function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")});if(void 0!==n){var t=n,a=w.latestSelectedDateObj=new Date(t.dateObj.getTime()),i=(a.getMonth()<w.currentMonth||a.getMonth()>w.currentMonth+w.config.showMonths-1)&&"range"!==w.config.mode;if(w.selectedDateElem=t,"single"===w.config.mode)w.selectedDates=[a];else if("multiple"===w.config.mode){var o=be(a);o?w.selectedDates.splice(parseInt(o),1):w.selectedDates.push(a)}else"range"===w.config.mode&&(2===w.selectedDates.length&&w.clear(!1,!1),w.latestSelectedDateObj=a,w.selectedDates.push(a),0!==M(a,w.selectedDates[0],!0)&&w.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()}));if(O(),i){var r=w.currentYear!==a.getFullYear();w.currentYear=a.getFullYear(),w.currentMonth=a.getMonth(),r&&(De("onYearChange"),q()),De("onMonthChange")}if(Ce(),U(),ye(),i||"range"===w.config.mode||1!==w.config.showMonths?void 0!==w.selectedDateElem&&void 0===w.hourElement&&w.selectedDateElem&&w.selectedDateElem.focus():W(t),void 0!==w.hourElement&&void 0!==w.hourElement&&w.hourElement.focus(),w.config.closeOnSelect){var l="single"===w.config.mode&&!w.config.enableTime,c="range"===w.config.mode&&2===w.selectedDates.length&&!w.config.enableTime;(l||c)&&fe()}Y()}}w.parseDate=C({config:w.config,l10n:w.l10n}),w._handlers=[],w.pluginElements=[],w.loadedPlugins=[],w._bind=P,w._setHoursFromDate=F,w._positionCalendar=de,w.changeMonth=Z,w.changeYear=ee,w.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);w.input.value="",void 0!==w.altInput&&(w.altInput.value="");void 0!==w.mobileInput&&(w.mobileInput.value="");w.selectedDates=[],w.latestSelectedDateObj=void 0,!0===n&&(w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth());if(!0===w.config.enableTime){var t=E(w.config),a=t.hours,i=t.minutes,o=t.seconds;A(a,i,o)}w.redraw(),e&&De("onChange")},w.close=function(){w.isOpen=!1,w.isMobile||(void 0!==w.calendarContainer&&w.calendarContainer.classList.remove("open"),void 0!==w._input&&w._input.classList.remove("active"));De("onClose")},w.onMouseOver=oe,w._createElement=d,w.createDay=R,w.destroy=function(){void 0!==w.config&&De("onDestroy");for(var e=w._handlers.length;e--;)w._handlers[e].remove();if(w._handlers=[],w.mobileInput)w.mobileInput.parentNode&&w.mobileInput.parentNode.removeChild(w.mobileInput),w.mobileInput=void 0;else if(w.calendarContainer&&w.calendarContainer.parentNode)if(w.config.static&&w.calendarContainer.parentNode){var n=w.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else w.calendarContainer.parentNode.removeChild(w.calendarContainer);w.altInput&&(w.input.type="text",w.altInput.parentNode&&w.altInput.parentNode.removeChild(w.altInput),delete w.altInput);w.input&&(w.input.type=w.input._type,w.input.classList.remove("flatpickr-input"),w.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete w[e]}catch(e){}})},w.isEnabled=ne,w.jumpToDate=j,w.updateValue=ye,w.open=function(e,n){void 0===n&&(n=w._positionElement);if(!0===w.isMobile){if(e){e.preventDefault();var t=g(e);t&&t.blur()}return void 0!==w.mobileInput&&(w.mobileInput.focus(),w.mobileInput.click()),void De("onOpen")}if(w._input.disabled||w.config.inline)return;var a=w.isOpen;w.isOpen=!0,a||(w.calendarContainer.classList.add("open"),w._input.classList.add("active"),De("onOpen"),de(n));!0===w.config.enableTime&&!0===w.config.noCalendar&&(!1!==w.config.allowInput||void 0!==e&&w.timeContainer.contains(e.relatedTarget)||setTimeout(function(){return w.hourElement.select()},50))},w.redraw=ue,w.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(w.config,e),e)void 0!==ge[a]&&ge[a].forEach(function(e){return e()});else w.config[e]=n,void 0!==ge[e]?ge[e].forEach(function(e){return e()}):t.indexOf(e)>-1&&(w.config[e]=c(n));w.redraw(),ye(!0)},w.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=w.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return w.clear(n);pe(e,t),w.latestSelectedDateObj=w.selectedDates[w.selectedDates.length-1],w.redraw(),j(void 0,n),F(),0===w.selectedDates.length&&w.clear(!1);ye(n),n&&De("onChange")},w.toggle=function(e){if(!0===w.isOpen)return w.close();w.open(e)};var ge={locale:[se,G],showMonths:[V,S,z],minDate:[j],maxDate:[j],positionElement:[ve],clickOpens:[function(){!0===w.config.clickOpens?(P(w._input,"focus",w.open),P(w._input,"click",w.open)):(w._input.removeEventListener("focus",w.open),w._input.removeEventListener("click",w.open))}]};function pe(e,n){var t=[];if(e instanceof Array)t=e.map(function(e){return w.parseDate(e,n)});else if(e instanceof Date||"number"==typeof e)t=[w.parseDate(e,n)];else if("string"==typeof e)switch(w.config.mode){case"single":case"time":t=[w.parseDate(e,n)];break;case"multiple":t=e.split(w.config.conjunction).map(function(e){return w.parseDate(e,n)});break;case"range":t=e.split(w.l10n.rangeSeparator).map(function(e){return w.parseDate(e,n)})}else w.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));w.selectedDates=w.config.allowInvalidPreload?t:t.filter(function(e){return e instanceof Date&&ne(e,!1)}),"range"===w.config.mode&&w.selectedDates.sort(function(e,n){return e.getTime()-n.getTime()})}function he(e){return e.slice().map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?w.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:w.parseDate(e.from,void 0),to:w.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function ve(){w._positionElement=w.config.positionElement||w._input}function De(e,n){if(void 0!==w.config){var t=w.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a<t.length;a++)t[a](w.selectedDates,w.input.value,w,n);"onChange"===e&&(w.input.dispatchEvent(we("change")),w.input.dispatchEvent(we("input")))}}function we(e){var n=document.createEvent("Event");return n.initEvent(e,!0,!0),n}function be(e){for(var n=0;n<w.selectedDates.length;n++){var t=w.selectedDates[n];if(t instanceof Date&&0===M(t,e))return""+n}return!1}function Ce(){w.config.noCalendar||w.isMobile||!w.monthNav||(w.yearElements.forEach(function(e,n){var t=new Date(w.currentYear,w.currentMonth,1);t.setMonth(w.currentMonth+n),w.config.showMonths>1||"static"===w.config.monthSelectorType?w.monthElements[n].textContent=h(t.getMonth(),w.config.shorthandCurrentMonth,w.l10n)+" ":w.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()}),w._hidePrevMonthArrow=void 0!==w.config.minDate&&(w.currentYear===w.config.minDate.getFullYear()?w.currentMonth<=w.config.minDate.getMonth():w.currentYear<w.config.minDate.getFullYear()),w._hideNextMonthArrow=void 0!==w.config.maxDate&&(w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth+1>w.config.maxDate.getMonth():w.currentYear>w.config.maxDate.getFullYear()))}function Me(e){var n=e||(w.config.altInput?w.config.altFormat:w.config.dateFormat);return w.selectedDates.map(function(e){return w.formatDate(e,n)}).filter(function(e,n,t){return"range"!==w.config.mode||w.config.enableTime||t.indexOf(e)===n}).join("range"!==w.config.mode?w.config.conjunction:w.l10n.rangeSeparator)}function ye(e){void 0===e&&(e=!0),void 0!==w.mobileInput&&w.mobileFormatStr&&(w.mobileInput.value=void 0!==w.latestSelectedDateObj?w.formatDate(w.latestSelectedDateObj,w.mobileFormatStr):""),w.input.value=Me(w.config.dateFormat),void 0!==w.altInput&&(w.altInput.value=Me(w.config.altFormat)),!1!==e&&De("onValueUpdate")}function xe(e){var n=g(e),t=w.prevMonthNav.contains(n),a=w.nextMonthNav.contains(n);t||a?Z(t?-1:1):w.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?w.changeYear(w.currentYear+1):n.classList.contains("arrowDown")&&w.changeYear(w.currentYear-1)}return function(){w.element=w.input=p,w.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(p.dataset||{}))),v),o={};w.config.parseDate=i.parseDate,w.config.formatDate=i.formatDate,Object.defineProperty(w.config,"enable",{get:function(){return w.config._enable},set:function(e){w.config._enable=he(e)}}),Object.defineProperty(w.config,"disable",{get:function(){return w.config._disable},set:function(e){w.config._disable=he(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=I.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var s=I.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):s+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(w.config,"minDate",{get:function(){return w.config._minDate},set:le("min")}),Object.defineProperty(w.config,"maxDate",{get:function(){return w.config._maxDate},set:le("max")});var d=function(e){return function(n){w.config["min"===e?"_minTime":"_maxTime"]=w.parseDate(n,"H:i:S")}};Object.defineProperty(w.config,"minTime",{get:function(){return w.config._minTime},set:d("min")}),Object.defineProperty(w.config,"maxTime",{get:function(){return w.config._maxTime},set:d("max")}),"time"===i.mode&&(w.config.noCalendar=!0,w.config.enableTime=!0);Object.assign(w.config,o,i);for(var u=0;u<n.length;u++)w.config[n[u]]=!0===w.config[n[u]]||"true"===w.config[n[u]];t.filter(function(e){return void 0!==w.config[e]}).forEach(function(e){w.config[e]=c(w.config[e]||[]).map(T)}),w.isMobile=!w.config.disableMobile&&!w.config.inline&&"single"===w.config.mode&&!w.config.disable.length&&!w.config.enable&&!w.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(u=0;u<w.config.plugins.length;u++){var f=w.config.plugins[u](w)||{};for(var m in f)t.indexOf(m)>-1?w.config[m]=c(f[m]).map(T).concat(w.config[m]):void 0===i[m]&&(w.config[m]=f[m])}i.altInputClass||(w.config.altInputClass=ce().className+" "+w.config.altInputClass);De("onParseConfig")}(),se(),function(){if(w.input=ce(),!w.input)return void w.config.errorHandler(new Error("Invalid input element specified"));w.input._type=w.input.type,w.input.type="text",w.input.classList.add("flatpickr-input"),w._input=w.input,w.config.altInput&&(w.altInput=d(w.input.nodeName,w.config.altInputClass),w._input=w.altInput,w.altInput.placeholder=w.input.placeholder,w.altInput.disabled=w.input.disabled,w.altInput.required=w.input.required,w.altInput.tabIndex=w.input.tabIndex,w.altInput.type="text",w.input.setAttribute("type","hidden"),!w.config.static&&w.input.parentNode&&w.input.parentNode.insertBefore(w.altInput,w.input.nextSibling));w.config.allowInput||w._input.setAttribute("readonly","readonly");ve()}(),function(){w.selectedDates=[],w.now=w.parseDate(w.config.now)||new Date;var e=w.config.defaultDate||("INPUT"!==w.input.nodeName&&"TEXTAREA"!==w.input.nodeName||!w.input.placeholder||w.input.value!==w.input.placeholder?w.input.value:null);e&&pe(e,w.config.dateFormat);w._initialDate=w.selectedDates.length>0?w.selectedDates[0]:w.config.minDate&&w.config.minDate.getTime()>w.now.getTime()?w.config.minDate:w.config.maxDate&&w.config.maxDate.getTime()<w.now.getTime()?w.config.maxDate:w.now,w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth(),w.selectedDates.length>0&&(w.latestSelectedDateObj=w.selectedDates[0]);void 0!==w.config.minTime&&(w.config.minTime=w.parseDate(w.config.minTime,"H:i"));void 0!==w.config.maxTime&&(w.config.maxTime=w.parseDate(w.config.maxTime,"H:i"));w.minDateHasTime=!!w.config.minDate&&(w.config.minDate.getHours()>0||w.config.minDate.getMinutes()>0||w.config.minDate.getSeconds()>0),w.maxDateHasTime=!!w.config.maxDate&&(w.config.maxDate.getHours()>0||w.config.maxDate.getMinutes()>0||w.config.maxDate.getSeconds()>0)}(),w.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=w.currentMonth),void 0===n&&(n=w.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:w.l10n.daysInMonth[e]}},w.isMobile||function(){var e=window.document.createDocumentFragment();if(w.calendarContainer=d("div","flatpickr-calendar"),w.calendarContainer.tabIndex=-1,!w.config.noCalendar){if(e.appendChild((w.monthNav=d("div","flatpickr-months"),w.yearElements=[],w.monthElements=[],w.prevMonthNav=d("span","flatpickr-prev-month"),w.prevMonthNav.innerHTML=w.config.prevArrow,w.nextMonthNav=d("span","flatpickr-next-month"),w.nextMonthNav.innerHTML=w.config.nextArrow,V(),Object.defineProperty(w,"_hidePrevMonthArrow",{get:function(){return w.__hidePrevMonthArrow},set:function(e){w.__hidePrevMonthArrow!==e&&(s(w.prevMonthNav,"flatpickr-disabled",e),w.__hidePrevMonthArrow=e)}}),Object.defineProperty(w,"_hideNextMonthArrow",{get:function(){return w.__hideNextMonthArrow},set:function(e){w.__hideNextMonthArrow!==e&&(s(w.nextMonthNav,"flatpickr-disabled",e),w.__hideNextMonthArrow=e)}}),w.currentYearElement=w.yearElements[0],Ce(),w.monthNav)),w.innerContainer=d("div","flatpickr-innerContainer"),w.config.weekNumbers){var n=function(){w.calendarContainer.classList.add("hasWeeks");var e=d("div","flatpickr-weekwrapper");e.appendChild(d("span","flatpickr-weekday",w.l10n.weekAbbreviation));var n=d("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;w.innerContainer.appendChild(t),w.weekNumbers=a,w.weekWrapper=t}w.rContainer=d("div","flatpickr-rContainer"),w.rContainer.appendChild(z()),w.daysContainer||(w.daysContainer=d("div","flatpickr-days"),w.daysContainer.tabIndex=-1),U(),w.rContainer.appendChild(w.daysContainer),w.innerContainer.appendChild(w.rContainer),e.appendChild(w.innerContainer)}w.config.enableTime&&e.appendChild(function(){w.calendarContainer.classList.add("hasTime"),w.config.noCalendar&&w.calendarContainer.classList.add("noCalendar");var e=E(w.config);w.timeContainer=d("div","flatpickr-time"),w.timeContainer.tabIndex=-1;var n=d("span","flatpickr-time-separator",":"),t=m("flatpickr-hour",{"aria-label":w.l10n.hourAriaLabel});w.hourElement=t.getElementsByTagName("input")[0];var a=m("flatpickr-minute",{"aria-label":w.l10n.minuteAriaLabel});w.minuteElement=a.getElementsByTagName("input")[0],w.hourElement.tabIndex=w.minuteElement.tabIndex=-1,w.hourElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getHours():w.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),w.minuteElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getMinutes():e.minutes),w.hourElement.setAttribute("step",w.config.hourIncrement.toString()),w.minuteElement.setAttribute("step",w.config.minuteIncrement.toString()),w.hourElement.setAttribute("min",w.config.time_24hr?"0":"1"),w.hourElement.setAttribute("max",w.config.time_24hr?"23":"12"),w.hourElement.setAttribute("maxlength","2"),w.minuteElement.setAttribute("min","0"),w.minuteElement.setAttribute("max","59"),w.minuteElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(t),w.timeContainer.appendChild(n),w.timeContainer.appendChild(a),w.config.time_24hr&&w.timeContainer.classList.add("time24hr");if(w.config.enableSeconds){w.timeContainer.classList.add("hasSeconds");var i=m("flatpickr-second");w.secondElement=i.getElementsByTagName("input")[0],w.secondElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getSeconds():e.seconds),w.secondElement.setAttribute("step",w.minuteElement.getAttribute("step")),w.secondElement.setAttribute("min","0"),w.secondElement.setAttribute("max","59"),w.secondElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(d("span","flatpickr-time-separator",":")),w.timeContainer.appendChild(i)}w.config.time_24hr||(w.amPM=d("span","flatpickr-am-pm",w.l10n.amPM[r((w.latestSelectedDateObj?w.hourElement.value:w.config.defaultHour)>11)]),w.amPM.title=w.l10n.toggleTitle,w.amPM.tabIndex=-1,w.timeContainer.appendChild(w.amPM));return w.timeContainer}());s(w.calendarContainer,"rangeMode","range"===w.config.mode),s(w.calendarContainer,"animate",!0===w.config.animate),s(w.calendarContainer,"multiMonth",w.config.showMonths>1),w.calendarContainer.appendChild(e);var i=void 0!==w.config.appendTo&&void 0!==w.config.appendTo.nodeType;if((w.config.inline||w.config.static)&&(w.calendarContainer.classList.add(w.config.inline?"inline":"static"),w.config.inline&&(!i&&w.element.parentNode?w.element.parentNode.insertBefore(w.calendarContainer,w._input.nextSibling):void 0!==w.config.appendTo&&w.config.appendTo.appendChild(w.calendarContainer)),w.config.static)){var l=d("div","flatpickr-wrapper");w.element.parentNode&&w.element.parentNode.insertBefore(l,w.element),l.appendChild(w.element),w.altInput&&l.appendChild(w.altInput),l.appendChild(w.calendarContainer)}w.config.static||w.config.inline||(void 0!==w.config.appendTo?w.config.appendTo:window.document.body).appendChild(w.calendarContainer)}(),function(){w.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(w.element.querySelectorAll("[data-"+e+"]"),function(n){return P(n,"click",w[e])})});if(w.isMobile)return void function(){var e=w.config.enableTime?w.config.noCalendar?"time":"datetime-local":"date";w.mobileInput=d("input",w.input.className+" flatpickr-mobile"),w.mobileInput.tabIndex=1,w.mobileInput.type=e,w.mobileInput.disabled=w.input.disabled,w.mobileInput.required=w.input.required,w.mobileInput.placeholder=w.input.placeholder,w.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",w.selectedDates.length>0&&(w.mobileInput.defaultValue=w.mobileInput.value=w.formatDate(w.selectedDates[0],w.mobileFormatStr));w.config.minDate&&(w.mobileInput.min=w.formatDate(w.config.minDate,"Y-m-d"));w.config.maxDate&&(w.mobileInput.max=w.formatDate(w.config.maxDate,"Y-m-d"));w.input.getAttribute("step")&&(w.mobileInput.step=String(w.input.getAttribute("step")));w.input.type="hidden",void 0!==w.altInput&&(w.altInput.type="hidden");try{w.input.parentNode&&w.input.parentNode.insertBefore(w.mobileInput,w.input.nextSibling)}catch(e){}P(w.mobileInput,"change",function(e){w.setDate(g(e).value,!1,w.mobileFormatStr),De("onChange"),De("onClose")})}();var e=l(re,50);w._debouncedChange=l(Y,300),w.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&P(w.daysContainer,"mouseover",function(e){"range"===w.config.mode&&oe(g(e))});P(w._input,"keydown",ie),void 0!==w.calendarContainer&&P(w.calendarContainer,"keydown",ie);w.config.inline||w.config.static||P(window,"resize",e);void 0!==window.ontouchstart?P(window.document,"touchstart",X):P(window.document,"mousedown",X);P(window.document,"focus",X,{capture:!0}),!0===w.config.clickOpens&&(P(w._input,"focus",w.open),P(w._input,"click",w.open));void 0!==w.daysContainer&&(P(w.monthNav,"click",xe),P(w.monthNav,["keyup","increment"],N),P(w.daysContainer,"click",me));if(void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement){var n=function(e){return g(e).select()};P(w.timeContainer,["increment"],_),P(w.timeContainer,"blur",_,{capture:!0}),P(w.timeContainer,"click",H),P([w.hourElement,w.minuteElement],["focus","click"],n),void 0!==w.secondElement&&P(w.secondElement,"focus",function(){return w.secondElement&&w.secondElement.select()}),void 0!==w.amPM&&P(w.amPM,"click",function(e){_(e)})}w.config.allowInput&&P(w._input,"blur",ae)}(),(w.selectedDates.length||w.config.noCalendar)&&(w.config.enableTime&&F(w.config.noCalendar?w.latestSelectedDateObj:void 0),ye(!1)),S();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!w.isMobile&&n&&de(),De("onReady")}(),w}function T(e,n){for(var t=Array.prototype.slice.call(e).filter(function(e){return e instanceof HTMLElement}),a=[],i=0;i<t.length;i++){var o=t[i];try{if(null!==o.getAttribute("data-fp-omit"))continue;void 0!==o._flatpickr&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=k(o,n||{}),a.push(o._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return T(this,e)},HTMLElement.prototype.flatpickr=function(e){return T([this],e)});var I=function(e,n){return"string"==typeof e?T(window.document.querySelectorAll(e),n):e instanceof Node?T([e],n):T(e,n)};return I.defaultConfig={},I.l10ns={en:e({},i),default:e({},i)},I.localize=function(n){I.l10ns.default=e(e({},I.l10ns.default),n)},I.setDefaults=function(n){I.defaultConfig=e(e({},I.defaultConfig),n)},I.parseDate=C({}),I.formatDate=b({}),I.compareDates=M,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return T(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=I),I});(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.monthSelectPlugin=factory())})(this,function(){"use strict";var __assign=function(){__assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};return __assign.apply(this,arguments)};var monthToStr=function(monthNumber,shorthand,locale){return locale.months[shorthand?"shorthand":"longhand"][monthNumber]};function clearNode(node){while(node.firstChild)node.removeChild(node.firstChild)}function getEventTarget(event){try{if(typeof event.composedPath==="function"){var path=event.composedPath();return path[0]}return event.target}catch(error){return event.target}}var defaultConfig={shorthand:false,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function monthSelectPlugin(pluginConfig){var config=__assign(__assign({},defaultConfig),pluginConfig);return function(fp){fp.config.dateFormat=config.dateFormat;fp.config.altFormat=config.altFormat;var self={monthsContainer:null};function clearUnnecessaryDOMElements(){if(!fp.rContainer)return;clearNode(fp.rContainer);for(var index=0;index<fp.monthElements.length;index++){var element=fp.monthElements[index];if(!element.parentNode)continue;element.parentNode.removeChild(element)}}function build(){if(!fp.rContainer)return;self.monthsContainer=fp._createElement("div","flatpickr-monthSelect-months");self.monthsContainer.tabIndex=-1;buildMonths();fp.rContainer.appendChild(self.monthsContainer);fp.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+config.theme)}function buildMonths(){if(!self.monthsContainer)return;clearNode(self.monthsContainer);var frag=document.createDocumentFragment();for(var i=0;i<12;i++){var month=fp.createDay("flatpickr-monthSelect-month",new Date(fp.currentYear,i),0,i);if(month.dateObj.getMonth()===(new Date).getMonth()&&month.dateObj.getFullYear()===(new Date).getFullYear())month.classList.add("today");month.textContent=monthToStr(i,config.shorthand,fp.l10n);month.addEventListener("click",selectMonth);frag.appendChild(month)}self.monthsContainer.appendChild(frag);if(fp.config.minDate&&fp.currentYear===fp.config.minDate.getFullYear())fp.prevMonthNav.classList.add("flatpickr-disabled");else fp.prevMonthNav.classList.remove("flatpickr-disabled");if(fp.config.maxDate&&fp.currentYear===fp.config.maxDate.getFullYear())fp.nextMonthNav.classList.add("flatpickr-disabled");else fp.nextMonthNav.classList.remove("flatpickr-disabled")}function bindEvents(){fp._bind(fp.prevMonthNav,"click",function(e){e.preventDefault();e.stopPropagation();fp.changeYear(fp.currentYear-1);selectYear();buildMonths()});fp._bind(fp.nextMonthNav,"click",function(e){e.preventDefault();e.stopPropagation();fp.changeYear(fp.currentYear+1);selectYear();buildMonths()});fp._bind(self.monthsContainer,"mouseover",function(e){if(fp.config.mode==="range")fp.onMouseOver(getEventTarget(e),"flatpickr-monthSelect-month")})}function setCurrentlySelected(){if(!fp.rContainer)return;if(!fp.selectedDates.length)return;var currentlySelected=fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected");for(var index=0;index<currentlySelected.length;index++){currentlySelected[index].classList.remove("selected")}var targetMonth=fp.selectedDates[0].getMonth();var month=fp.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(targetMonth+1)+")");if(month){month.classList.add("selected")}}function selectYear(){var selectedDate=fp.selectedDates[0];if(selectedDate){selectedDate=new Date(selectedDate);selectedDate.setFullYear(fp.currentYear);if(fp.config.minDate&&selectedDate<fp.config.minDate){selectedDate=fp.config.minDate}if(fp.config.maxDate&&selectedDate>fp.config.maxDate){selectedDate=fp.config.maxDate}fp.currentYear=selectedDate.getFullYear()}fp.currentYearElement.value=String(fp.currentYear);if(fp.rContainer){var months=fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month");months.forEach(function(month){month.dateObj.setFullYear(fp.currentYear);if(fp.config.minDate&&month.dateObj<fp.config.minDate||fp.config.maxDate&&month.dateObj>fp.config.maxDate){month.classList.add("flatpickr-disabled")}else{month.classList.remove("flatpickr-disabled")}})}setCurrentlySelected()}function selectMonth(e){e.preventDefault();e.stopPropagation();var eventTarget=getEventTarget(e);if(!(eventTarget instanceof Element))return;if(eventTarget.classList.contains("flatpickr-disabled"))return;if(eventTarget.classList.contains("notAllowed"))return;setMonth(eventTarget.dateObj);if(fp.config.closeOnSelect){var single=fp.config.mode==="single";var range=fp.config.mode==="range"&&fp.selectedDates.length===2;if(single||range)fp.close()}}function setMonth(date){var selectedDate=new Date(fp.currentYear,date.getMonth(),date.getDate());var selectedDates=[];switch(fp.config.mode){case"single":selectedDates=[selectedDate];break;case"multiple":selectedDates.push(selectedDate);break;case"range":if(fp.selectedDates.length===2){selectedDates=[selectedDate]}else{selectedDates=fp.selectedDates.concat([selectedDate]);selectedDates.sort(function(a,b){return a.getTime()-b.getTime()})}break}fp.setDate(selectedDates,true);setCurrentlySelected()}var shifts={37:-1,39:1,40:3,38:-3};function onKeyDown(_,__,___,e){var shouldMove=shifts[e.keyCode]!==undefined;if(!shouldMove&&e.keyCode!==13){return}if(!fp.rContainer||!self.monthsContainer)return;var currentlySelected=fp.rContainer.querySelector(".flatpickr-monthSelect-month.selected");var index=Array.prototype.indexOf.call(self.monthsContainer.children,document.activeElement);if(index===-1){var target=currentlySelected||self.monthsContainer.firstElementChild;target.focus();index=target.$i}if(shouldMove){self.monthsContainer.children[(12+index+shifts[e.keyCode])%12].focus()}else if(e.keyCode===13&&self.monthsContainer.contains(document.activeElement)){setMonth(document.activeElement.dateObj)}}function closeHook(){var _a;if(((_a=fp.config)===null||_a===void 0?void 0:_a.mode)==="range"&&fp.selectedDates.length===1)fp.clear(false);if(!fp.selectedDates.length)buildMonths()}function stubCurrentMonth(){config._stubbedCurrentMonth=fp._initialDate.getMonth();fp._initialDate.setMonth(config._stubbedCurrentMonth);fp.currentMonth=config._stubbedCurrentMonth}function unstubCurrentMonth(){if(!config._stubbedCurrentMonth)return;fp._initialDate.setMonth(config._stubbedCurrentMonth);fp.currentMonth=config._stubbedCurrentMonth;delete config._stubbedCurrentMonth}function destroyPluginInstance(){if(self.monthsContainer!==null){var months=self.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month");for(var index=0;index<months.length;index++){months[index].removeEventListener("click",selectMonth)}}}return{onParseConfig:function(){fp.config.enableTime=false},onValueUpdate:setCurrentlySelected,onKeyDown:onKeyDown,onReady:[stubCurrentMonth,clearUnnecessaryDOMElements,build,bindEvents,setCurrentlySelected,function(){fp.config.onClose.push(closeHook);fp.loadedPlugins.push("monthSelect")}],onDestroy:[unstubCurrentMonth,destroyPluginInstance,function(){fp.config.onClose=fp.config.onClose.filter(function(hook){return hook!==closeHook})}]}}}return monthSelectPlugin});!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,function(e){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function n(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function o(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var i=Math.max,a=Math.min,s=Math.round;function f(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect(),o=1,i=1;if(r(e)&&t){var a=e.offsetHeight,f=e.offsetWidth;f>0&&(o=s(n.width)/f||1),a>0&&(i=s(n.height)/a||1)}return{width:n.width/o,height:n.height/i,top:n.top/i,right:n.right/o,bottom:n.bottom/i,left:n.left/o,x:n.left/o,y:n.top/i}}function c(e){var n=t(e);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function p(e){return e?(e.nodeName||"").toLowerCase():null}function u(e){return((n(e)?e.ownerDocument:e.document)||window.document).documentElement}function l(e){return f(u(e)).left+c(e).scrollLeft}function d(e){return t(e).getComputedStyle(e)}function h(e){var t=d(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function m(e,n,o){void 0===o&&(o=!1);var i,a,d=r(n),m=r(n)&&function(e){var t=e.getBoundingClientRect(),n=s(t.width)/e.offsetWidth||1,r=s(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(n),v=u(n),g=f(e,m),y={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(d||!d&&!o)&&(("body"!==p(n)||h(v))&&(y=(i=n)!==t(i)&&r(i)?{scrollLeft:(a=i).scrollLeft,scrollTop:a.scrollTop}:c(i)),r(n)?((b=f(n,!0)).x+=n.clientLeft,b.y+=n.clientTop):v&&(b.x=l(v))),{x:g.left+y.scrollLeft-b.x,y:g.top+y.scrollTop-b.y,width:g.width,height:g.height}}function v(e){var t=f(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function g(e){return"html"===p(e)?e:e.assignedSlot||e.parentNode||(o(e)?e.host:null)||u(e)}function y(e){return["html","body","#document"].indexOf(p(e))>=0?e.ownerDocument.body:r(e)&&h(e)?e:y(g(e))}function b(e,n){var r;void 0===n&&(n=[]);var o=y(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=t(o),s=i?[a].concat(a.visualViewport||[],h(o)?o:[]):o,f=n.concat(s);return i?f:f.concat(b(g(s)))}function x(e){return["table","td","th"].indexOf(p(e))>=0}function w(e){return r(e)&&"fixed"!==d(e).position?e.offsetParent:null}function O(e){for(var n=t(e),i=w(e);i&&x(i)&&"static"===d(i).position;)i=w(i);return i&&("html"===p(i)||"body"===p(i)&&"static"===d(i).position)?n:i||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&r(e)&&"fixed"===d(e).position)return null;var n=g(e);for(o(n)&&(n=n.host);r(n)&&["html","body"].indexOf(p(n))<0;){var i=d(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||n}var j="top",E="bottom",D="right",A="left",L="auto",P=[j,E,D,A],M="start",k="end",W="viewport",B="popper",H=P.reduce(function(e,t){return e.concat([t+"-"+M,t+"-"+k])},[]),T=[].concat(P,[L]).reduce(function(e,t){return e.concat([t,t+"-"+M,t+"-"+k])},[]),R=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function S(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}}),r.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){n.has(e.name)||o(e)}),r}function C(e){return e.split("-")[0]}function q(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&o(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function V(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function N(e,r){return r===W?V(function(e){var n=t(e),r=u(e),o=n.visualViewport,i=r.clientWidth,a=r.clientHeight,s=0,f=0;return o&&(i=o.width,a=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=o.offsetLeft,f=o.offsetTop)),{width:i,height:a,x:s+l(e),y:f}}(e)):n(r)?function(e){var t=f(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(r):V(function(e){var t,n=u(e),r=c(e),o=null==(t=e.ownerDocument)?void 0:t.body,a=i(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=i(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),f=-r.scrollLeft+l(e),p=-r.scrollTop;return"rtl"===d(o||n).direction&&(f+=i(n.clientWidth,o?o.clientWidth:0)-a),{width:a,height:s,x:f,y:p}}(u(e)))}function I(e,t,o){var s="clippingParents"===t?function(e){var t=b(g(e)),o=["absolute","fixed"].indexOf(d(e).position)>=0&&r(e)?O(e):e;return n(o)?t.filter(function(e){return n(e)&&q(e,o)&&"body"!==p(e)}):[]}(e):[].concat(t),f=[].concat(s,[o]),c=f[0],u=f.reduce(function(t,n){var r=N(e,n);return t.top=i(r.top,t.top),t.right=a(r.right,t.right),t.bottom=a(r.bottom,t.bottom),t.left=i(r.left,t.left),t},N(e,c));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function _(e){return e.split("-")[1]}function F(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function U(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?C(o):null,a=o?_(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case j:t={x:s,y:n.y-r.height};break;case E:t={x:s,y:n.y+n.height};break;case D:t={x:n.x+n.width,y:f};break;case A:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?F(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case M:t[c]=t[c]-(n[p]/2-r[p]/2);break;case k:t[c]=t[c]+(n[p]/2-r[p]/2)}}return t}function z(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function X(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}function Y(e,t){void 0===t&&(t={});var r=t,o=r.placement,i=void 0===o?e.placement:o,a=r.boundary,s=void 0===a?"clippingParents":a,c=r.rootBoundary,p=void 0===c?W:c,l=r.elementContext,d=void 0===l?B:l,h=r.altBoundary,m=void 0!==h&&h,v=r.padding,g=void 0===v?0:v,y=z("number"!=typeof g?g:X(g,P)),b=d===B?"reference":B,x=e.rects.popper,w=e.elements[m?b:d],O=I(n(w)?w:w.contextElement||u(e.elements.popper),s,p),A=f(e.elements.reference),L=U({reference:A,element:x,strategy:"absolute",placement:i}),M=V(Object.assign({},x,L)),k=d===B?M:A,H={top:O.top-k.top+y.top,bottom:k.bottom-O.bottom+y.bottom,left:O.left-k.left+y.left,right:k.right-O.right+y.right},T=e.modifiersData.offset;if(d===B&&T){var R=T[i];Object.keys(H).forEach(function(e){var t=[D,E].indexOf(e)>=0?1:-1,n=[j,E].indexOf(e)>=0?"y":"x";H[e]+=R[n]*t})}return H}var G={placement:"bottom",modifiers:[],strategy:"absolute"};function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}function K(e){void 0===e&&(e={});var t=e,r=t.defaultModifiers,o=void 0===r?[]:r,i=t.defaultOptions,a=void 0===i?G:i;return function(e,t,r){void 0===r&&(r=a);var i,s,f={placement:"bottom",orderedModifiers:[],options:Object.assign({},G,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},c=[],p=!1,u={state:f,setOptions:function(r){var i="function"==typeof r?r(f.options):r;l(),f.options=Object.assign({},a,f.options,i),f.scrollParents={reference:n(e)?b(e):e.contextElement?b(e.contextElement):[],popper:b(t)};var s,p,d=function(e){var t=S(e);return R.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}((s=[].concat(o,f.options.modifiers),p=s.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{}),Object.keys(p).map(function(e){return p[e]})));return f.orderedModifiers=d.filter(function(e){return e.enabled}),f.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,o=e.effect;if("function"==typeof o){var i=o({state:f,name:t,instance:u,options:r}),a=function(){};c.push(i||a)}}),u.update()},forceUpdate:function(){if(!p){var e=f.elements,t=e.reference,n=e.popper;if(J(t,n)){f.rects={reference:m(t,O(n),"fixed"===f.options.strategy),popper:v(n)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(e){return f.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<f.orderedModifiers.length;r++)if(!0!==f.reset){var o=f.orderedModifiers[r],i=o.fn,a=o.options,s=void 0===a?{}:a,c=o.name;"function"==typeof i&&(f=i({state:f,options:s,name:c,instance:u})||f)}else f.reset=!1,r=-1}}},update:(i=function(){return new Promise(function(e){u.forceUpdate(),e(f)})},function(){return s||(s=new Promise(function(e){Promise.resolve().then(function(){s=void 0,e(i())})})),s}),destroy:function(){l(),p=!0}};if(!J(e,t))return u;function l(){c.forEach(function(e){return e()}),c=[]}return u.setOptions(r).then(function(e){!p&&r.onFirstUpdate&&r.onFirstUpdate(e)}),u}}var Q={passive:!0};var Z={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var n=e.state,r=e.instance,o=e.options,i=o.scroll,a=void 0===i||i,s=o.resize,f=void 0===s||s,c=t(n.elements.popper),p=[].concat(n.scrollParents.reference,n.scrollParents.popper);return a&&p.forEach(function(e){e.addEventListener("scroll",r.update,Q)}),f&&c.addEventListener("resize",r.update,Q),function(){a&&p.forEach(function(e){e.removeEventListener("scroll",r.update,Q)}),f&&c.removeEventListener("resize",r.update,Q)}},data:{}};var $={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=U({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},ee={top:"auto",right:"auto",bottom:"auto",left:"auto"};function te(e){var n,r=e.popper,o=e.popperRect,i=e.placement,a=e.variation,f=e.offsets,c=e.position,p=e.gpuAcceleration,l=e.adaptive,h=e.roundOffsets,m=e.isFixed,v=f.x,g=void 0===v?0:v,y=f.y,b=void 0===y?0:y,x="function"==typeof h?h({x:g,y:b}):{x:g,y:b};g=x.x,b=x.y;var w=f.hasOwnProperty("x"),L=f.hasOwnProperty("y"),P=A,M=j,W=window;if(l){var B=O(r),H="clientHeight",T="clientWidth";if(B===t(r)&&"static"!==d(B=u(r)).position&&"absolute"===c&&(H="scrollHeight",T="scrollWidth"),B=B,i===j||(i===A||i===D)&&a===k)M=E,b-=(m&&B===W&&W.visualViewport?W.visualViewport.height:B[H])-o.height,b*=p?1:-1;if(i===A||(i===j||i===E)&&a===k)P=D,g-=(m&&B===W&&W.visualViewport?W.visualViewport.width:B[T])-o.width,g*=p?1:-1}var R,S=Object.assign({position:c},l&&ee),C=!0===h?function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:s(t*r)/r||0,y:s(n*r)/r||0}}({x:g,y:b}):{x:g,y:b};return g=C.x,b=C.y,p?Object.assign({},S,((R={})[M]=L?"0":"",R[P]=w?"0":"",R.transform=(W.devicePixelRatio||1)<=1?"translate("+g+"px, "+b+"px)":"translate3d("+g+"px, "+b+"px, 0)",R)):Object.assign({},S,((n={})[M]=L?b+"px":"",n[P]=w?g+"px":"",n.transform="",n))}var ne={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,f=void 0===s||s,c={placement:C(t.placement),variation:_(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,te(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:f})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,te(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}};var re={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},o=t.attributes[e]||{},i=t.elements[e];r(i)&&p(i)&&(Object.assign(i.style,n),Object.keys(o).forEach(function(e){var t=o[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var o=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});r(o)&&p(o)&&(Object.assign(o.style,a),Object.keys(i).forEach(function(e){o.removeAttribute(e)}))})}},requires:["computeStyles"]};var oe={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=T.reduce(function(e,n){return e[n]=function(e,t,n){var r=C(e),o=[A,j].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[A,D].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e},{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},ie={left:"right",right:"left",bottom:"top",top:"bottom"};function ae(e){return e.replace(/left|right|bottom|top/g,function(e){return ie[e]})}var se={start:"end",end:"start"};function fe(e){return e.replace(/start|end/g,function(e){return se[e]})}function ce(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?T:f,p=_(r),u=p?s?H:H.filter(function(e){return _(e)===p}):P,l=u.filter(function(e){return c.indexOf(e)>=0});0===l.length&&(l=u);var d=l.reduce(function(t,n){return t[n]=Y(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[C(n)],t},{});return Object.keys(d).sort(function(e,t){return d[e]-d[t]})}var pe={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,f=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,v=t.options.placement,g=C(v),y=f||(g===v||!h?[ae(v)]:function(e){if(C(e)===L)return[];var t=ae(e);return[fe(e),t,fe(t)]}(v)),b=[v].concat(y).reduce(function(e,n){return e.concat(C(n)===L?ce(t,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)},[]),x=t.rects.reference,w=t.rects.popper,O=new Map,P=!0,k=b[0],W=0;W<b.length;W++){var B=b[W],H=C(B),T=_(B)===M,R=[j,E].indexOf(H)>=0,S=R?"width":"height",q=Y(t,{placement:B,boundary:p,rootBoundary:u,altBoundary:l,padding:c}),V=R?T?D:A:T?E:j;x[S]>w[S]&&(V=ae(V));var N=ae(V),I=[];if(i&&I.push(q[H]<=0),s&&I.push(q[V]<=0,q[N]<=0),I.every(function(e){return e})){k=B,P=!1;break}O.set(B,I)}if(P)for(var F=function(e){var t=b.find(function(t){var n=O.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return k=t,"break"},U=h?3:1;U>0;U--){if("break"===F(U))break}t.placement!==k&&(t.modifiersData[r]._skip=!0,t.placement=k,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ue(e,t,n){return i(e,a(t,n))}var le={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=void 0===o||o,f=n.altAxis,c=void 0!==f&&f,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,h=n.tether,m=void 0===h||h,g=n.tetherOffset,y=void 0===g?0:g,b=Y(t,{boundary:p,rootBoundary:u,padding:d,altBoundary:l}),x=C(t.placement),w=_(t.placement),L=!w,P=F(x),k="x"===P?"y":"x",W=t.modifiersData.popperOffsets,B=t.rects.reference,H=t.rects.popper,T="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,R="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,q={x:0,y:0};if(W){if(s){var V,N="y"===P?j:A,I="y"===P?E:D,U="y"===P?"height":"width",z=W[P],X=z+b[N],G=z-b[I],J=m?-H[U]/2:0,K=w===M?B[U]:H[U],Q=w===M?-H[U]:-B[U],Z=t.elements.arrow,$=m&&Z?v(Z):{width:0,height:0},ee=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},te=ee[N],ne=ee[I],re=ue(0,B[U],$[U]),oe=L?B[U]/2-J-re-te-R.mainAxis:K-re-te-R.mainAxis,ie=L?-B[U]/2+J+re+ne+R.mainAxis:Q+re+ne+R.mainAxis,ae=t.elements.arrow&&O(t.elements.arrow),se=ae?"y"===P?ae.clientTop||0:ae.clientLeft||0:0,fe=null!=(V=null==S?void 0:S[P])?V:0,ce=z+ie-fe,pe=ue(m?a(X,z+oe-fe-se):X,z,m?i(G,ce):G);W[P]=pe,q[P]=pe-z}if(c){var le,de="x"===P?j:A,he="x"===P?E:D,me=W[k],ve="y"===k?"height":"width",ge=me+b[de],ye=me-b[he],be=-1!==[j,A].indexOf(x),xe=null!=(le=null==S?void 0:S[k])?le:0,we=be?ge:me-B[ve]-H[ve]-xe+R.altAxis,Oe=be?me+B[ve]+H[ve]-xe-R.altAxis:ye,je=m&&be?function(e,t,n){var r=ue(e,t,n);return r>n?n:r}(we,me,Oe):ue(m?we:ge,me,m?Oe:ye);W[k]=je,q[k]=je-me}t.modifiersData[r]=q}},requiresIfExists:["offset"]};var de={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=C(n.placement),f=F(s),c=[A,D].indexOf(s)>=0?"height":"width";if(i&&a){var p=function(e,t){return z("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:X(e,P))}(o.padding,n),u=v(i),l="y"===f?j:A,d="y"===f?E:D,h=n.rects.reference[c]+n.rects.reference[f]-a[f]-n.rects.popper[c],m=a[f]-n.rects.reference[f],g=O(i),y=g?"y"===f?g.clientHeight||0:g.clientWidth||0:0,b=h/2-m/2,x=p[l],w=y-u[c]-p[d],L=y/2-u[c]/2+b,M=ue(x,L,w),k=f;n.modifiersData[r]=((t={})[k]=M,t.centerOffset=M-L,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&q(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function he(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function me(e){return[j,D,E,A].some(function(t){return e[t]>=0})}var ve={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=Y(t,{elementContext:"reference"}),s=Y(t,{altBoundary:!0}),f=he(a,r),c=he(s,o,i),p=me(f),u=me(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}},ge=K({defaultModifiers:[Z,$,ne,re]}),ye=[Z,$,ne,re,oe,pe,le,de,ve],be=K({defaultModifiers:ye});e.applyStyles=re,e.arrow=de,e.computeStyles=ne,e.createPopper=be,e.createPopperLite=ge,e.defaultModifiers=ye,e.detectOverflow=Y,e.eventListeners=Z,e.flip=pe,e.hide=ve,e.offset=oe,e.popperGenerator=K,e.popperOffsets=$,e.preventOverflow=le,Object.defineProperty(e,"__esModule",{value:!0})});!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t=t||self).tippy=e(t.Popper)}(this,function(t){"use strict";var e="undefined"!=typeof window&&"undefined"!=typeof document,n=!!e&&!!window.msCrypto,r={passive:!0,capture:!0},o=function(){return document.body};function i(t,e,n){if(Array.isArray(t)){var r=t[e];return null==r?Array.isArray(n)?n[e]:n:r}return t}function a(t,e){var n={}.toString.call(t);return 0===n.indexOf("[object")&&n.indexOf(e+"]")>-1}function s(t,e){return"function"==typeof t?t.apply(void 0,e):t}function u(t,e){return 0===e?t:function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)};var n}function p(t,e){var n=Object.assign({},t);return e.forEach(function(t){delete n[t]}),n}function c(t){return[].concat(t)}function f(t,e){-1===t.indexOf(e)&&t.push(e)}function l(t){return t.split("-")[0]}function d(t){return[].slice.call(t)}function v(t){return Object.keys(t).reduce(function(e,n){return void 0!==t[n]&&(e[n]=t[n]),e},{})}function m(){return document.createElement("div")}function g(t){return["Element","Fragment"].some(function(e){return a(t,e)})}function h(t){return a(t,"MouseEvent")}function b(t){return!(!t||!t._tippy||t._tippy.reference!==t)}function y(t){return g(t)?[t]:function(t){return a(t,"NodeList")}(t)?d(t):Array.isArray(t)?t:d(document.querySelectorAll(t))}function w(t,e){t.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function x(t,e){t.forEach(function(t){t&&t.setAttribute("data-state",e)})}function E(t){var e,n=c(t)[0];return null!=n&&null!=(e=n.ownerDocument)&&e.body?n.ownerDocument:document}function O(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(e){t[r](e,n)})}function C(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var T={isTouch:!1},A=0;function L(){T.isTouch||(T.isTouch=!0,window.performance&&document.addEventListener("mousemove",D))}function D(){var t=performance.now();t-A<20&&(T.isTouch=!1,document.removeEventListener("mousemove",D)),A=t}function k(){var t=document.activeElement;if(b(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}var R=Object.assign({appendTo:o,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),P=Object.keys(R);function j(t){var e=(t.plugins||[]).reduce(function(e,n){var r,o=n.name,i=n.defaultValue;o&&(e[o]=void 0!==t[o]?t[o]:null!=(r=R[o])?r:i);return e},{});return Object.assign({},t,e)}function M(t,e){var n=Object.assign({},e,{content:s(e.content,[t])},e.ignoreAttributes?{}:function(t,e){return(e?Object.keys(j(Object.assign({},R,{plugins:e}))):P).reduce(function(e,n){var r=(t.getAttribute("data-tippy-"+n)||"").trim();if(!r)return e;if("content"===n)e[n]=r;else try{e[n]=JSON.parse(r)}catch(t){e[n]=r}return e},{})}(t,e.plugins));return n.aria=Object.assign({},R.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?e.interactive:n.aria.expanded,content:"auto"===n.aria.content?e.interactive?null:"describedby":n.aria.content},n}function V(t,e){t.innerHTML=e}function I(t){var e=m();return!0===t?e.className="tippy-arrow":(e.className="tippy-svg-arrow",g(t)?e.appendChild(t):V(e,t)),e}function S(t,e){g(e.content)?(V(t,""),t.appendChild(e.content)):"function"!=typeof e.content&&(e.allowHTML?V(t,e.content):t.textContent=e.content)}function B(t){var e=t.firstElementChild,n=d(e.children);return{box:e,content:n.find(function(t){return t.classList.contains("tippy-content")}),arrow:n.find(function(t){return t.classList.contains("tippy-arrow")||t.classList.contains("tippy-svg-arrow")}),backdrop:n.find(function(t){return t.classList.contains("tippy-backdrop")})}}function N(t){var e=m(),n=m();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=m();function o(n,r){var o=B(e),i=o.box,a=o.content,s=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||S(a,t.props),r.arrow?s?n.arrow!==r.arrow&&(i.removeChild(s),i.appendChild(I(r.arrow))):i.appendChild(I(r.arrow)):s&&i.removeChild(s)}return r.className="tippy-content",r.setAttribute("data-state","hidden"),S(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props),{popper:e,onUpdate:o}}N.$$tippy=!0;var H=1,U=[],_=[];function z(e,a){var p,g,b,y,A,L,D,k,P=M(e,Object.assign({},R,j(v(a)))),V=!1,I=!1,S=!1,N=!1,z=[],F=u(wt,P.interactiveDebounce),W=H++,X=(k=P.plugins).filter(function(t,e){return k.indexOf(t)===e}),Y={id:W,reference:e,popper:m(),popperInstance:null,props:P,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:X,clearDelayTimeouts:function(){clearTimeout(p),clearTimeout(g),cancelAnimationFrame(b)},setProps:function(t){if(Y.state.isDestroyed)return;at("onBeforeUpdate",[Y,t]),bt();var n=Y.props,r=M(e,Object.assign({},n,v(t),{ignoreAttributes:!0}));Y.props=r,ht(),n.interactiveDebounce!==r.interactiveDebounce&&(pt(),F=u(wt,r.interactiveDebounce));n.triggerTarget&&!r.triggerTarget?c(n.triggerTarget).forEach(function(t){t.removeAttribute("aria-expanded")}):r.triggerTarget&&e.removeAttribute("aria-expanded");ut(),it(),J&&J(n,r);Y.popperInstance&&(Ct(),At().forEach(function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)}));at("onAfterUpdate",[Y,t])},setContent:function(t){Y.setProps({content:t})},show:function(){var t=Y.state.isVisible,e=Y.state.isDestroyed,n=!Y.state.isEnabled,r=T.isTouch&&!Y.props.touch,a=i(Y.props.duration,0,R.duration);if(t||e||n||r)return;if(et().hasAttribute("disabled"))return;if(at("onShow",[Y],!1),!1===Y.props.onShow(Y))return;Y.state.isVisible=!0,tt()&&($.style.visibility="visible");it(),dt(),Y.state.isMounted||($.style.transition="none");if(tt()){var u=rt(),p=u.box,c=u.content;w([p,c],0)}L=function(){var t;if(Y.state.isVisible&&!N){if(N=!0,$.offsetHeight,$.style.transition=Y.props.moveTransition,tt()&&Y.props.animation){var e=rt(),n=e.box,r=e.content;w([n,r],a),x([n,r],"visible")}st(),ut(),f(_,Y),null==(t=Y.popperInstance)||t.forceUpdate(),at("onMount",[Y]),Y.props.animation&&tt()&&function(t,e){mt(t,e)}(a,function(){Y.state.isShown=!0,at("onShown",[Y])})}},function(){var t,e=Y.props.appendTo,n=et();t=Y.props.interactive&&e===o||"parent"===e?n.parentNode:s(e,[n]);t.contains($)||t.appendChild($);Y.state.isMounted=!0,Ct()}()},hide:function(){var t=!Y.state.isVisible,e=Y.state.isDestroyed,n=!Y.state.isEnabled,r=i(Y.props.duration,1,R.duration);if(t||e||n)return;if(at("onHide",[Y],!1),!1===Y.props.onHide(Y))return;Y.state.isVisible=!1,Y.state.isShown=!1,N=!1,V=!1,tt()&&($.style.visibility="hidden");if(pt(),vt(),it(!0),tt()){var o=rt(),a=o.box,s=o.content;Y.props.animation&&(w([a,s],r),x([a,s],"hidden"))}st(),ut(),Y.props.animation?tt()&&function(t,e){mt(t,function(){!Y.state.isVisible&&$.parentNode&&$.parentNode.contains($)&&e()})}(r,Y.unmount):Y.unmount()},hideWithInteractivity:function(t){nt().addEventListener("mousemove",F),f(U,F),F(t)},enable:function(){Y.state.isEnabled=!0},disable:function(){Y.hide(),Y.state.isEnabled=!1},unmount:function(){Y.state.isVisible&&Y.hide();if(!Y.state.isMounted)return;Tt(),At().forEach(function(t){t._tippy.unmount()}),$.parentNode&&$.parentNode.removeChild($);_=_.filter(function(t){return t!==Y}),Y.state.isMounted=!1,at("onHidden",[Y])},destroy:function(){if(Y.state.isDestroyed)return;Y.clearDelayTimeouts(),Y.unmount(),bt(),delete e._tippy,Y.state.isDestroyed=!0,at("onDestroy",[Y])}};if(!P.render)return Y;var q=P.render(Y),$=q.popper,J=q.onUpdate;$.setAttribute("data-tippy-root",""),$.id="tippy-"+Y.id,Y.popper=$,e._tippy=Y,$._tippy=Y;var G=X.map(function(t){return t.fn(Y)}),K=e.hasAttribute("aria-expanded");return ht(),ut(),it(),at("onCreate",[Y]),P.showOnCreate&&Lt(),$.addEventListener("mouseenter",function(){Y.props.interactive&&Y.state.isVisible&&Y.clearDelayTimeouts()}),$.addEventListener("mouseleave",function(){Y.props.interactive&&Y.props.trigger.indexOf("mouseenter")>=0&&nt().addEventListener("mousemove",F)}),Y;function Q(){var t=Y.props.touch;return Array.isArray(t)?t:[t,0]}function Z(){return"hold"===Q()[0]}function tt(){var t;return!(null==(t=Y.props.render)||!t.$$tippy)}function et(){return D||e}function nt(){var t=et().parentNode;return t?E(t):document}function rt(){return B($)}function ot(t){return Y.state.isMounted&&!Y.state.isVisible||T.isTouch||y&&"focus"===y.type?0:i(Y.props.delay,t?0:1,R.delay)}function it(t){void 0===t&&(t=!1),$.style.pointerEvents=Y.props.interactive&&!t?"":"none",$.style.zIndex=""+Y.props.zIndex}function at(t,e,n){var r;(void 0===n&&(n=!0),G.forEach(function(n){n[t]&&n[t].apply(n,e)}),n)&&(r=Y.props)[t].apply(r,e)}function st(){var t=Y.props.aria;if(t.content){var n="aria-"+t.content,r=$.id;c(Y.props.triggerTarget||e).forEach(function(t){var e=t.getAttribute(n);if(Y.state.isVisible)t.setAttribute(n,e?e+" "+r:r);else{var o=e&&e.replace(r,"").trim();o?t.setAttribute(n,o):t.removeAttribute(n)}})}}function ut(){!K&&Y.props.aria.expanded&&c(Y.props.triggerTarget||e).forEach(function(t){Y.props.interactive?t.setAttribute("aria-expanded",Y.state.isVisible&&t===et()?"true":"false"):t.removeAttribute("aria-expanded")})}function pt(){nt().removeEventListener("mousemove",F),U=U.filter(function(t){return t!==F})}function ct(t){if(!T.isTouch||!S&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!Y.props.interactive||!C($,n)){if(c(Y.props.triggerTarget||e).some(function(t){return C(t,n)})){if(T.isTouch)return;if(Y.state.isVisible&&Y.props.trigger.indexOf("click")>=0)return}else at("onClickOutside",[Y,t]);!0===Y.props.hideOnClick&&(Y.clearDelayTimeouts(),Y.hide(),I=!0,setTimeout(function(){I=!1}),Y.state.isMounted||vt())}}}function ft(){S=!0}function lt(){S=!1}function dt(){var t=nt();t.addEventListener("mousedown",ct,!0),t.addEventListener("touchend",ct,r),t.addEventListener("touchstart",lt,r),t.addEventListener("touchmove",ft,r)}function vt(){var t=nt();t.removeEventListener("mousedown",ct,!0),t.removeEventListener("touchend",ct,r),t.removeEventListener("touchstart",lt,r),t.removeEventListener("touchmove",ft,r)}function mt(t,e){var n=rt().box;function r(t){t.target===n&&(O(n,"remove",r),e())}if(0===t)return e();O(n,"remove",A),O(n,"add",r),A=r}function gt(t,n,r){void 0===r&&(r=!1),c(Y.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),z.push({node:e,eventType:t,handler:n,options:r})})}function ht(){var t;Z()&&(gt("touchstart",yt,{passive:!0}),gt("touchend",xt,{passive:!0})),(t=Y.props.trigger,t.split(/\s+/).filter(Boolean)).forEach(function(t){if("manual"!==t)switch(gt(t,yt),t){case"mouseenter":gt("mouseleave",xt);break;case"focus":gt(n?"focusout":"blur",Et);break;case"focusin":gt("focusout",Et)}})}function bt(){z.forEach(function(t){var e=t.node,n=t.eventType,r=t.handler,o=t.options;e.removeEventListener(n,r,o)}),z=[]}function yt(t){var e,n=!1;if(Y.state.isEnabled&&!Ot(t)&&!I){var r="focus"===(null==(e=y)?void 0:e.type);y=t,D=t.currentTarget,ut(),!Y.state.isVisible&&h(t)&&U.forEach(function(e){return e(t)}),"click"===t.type&&(Y.props.trigger.indexOf("mouseenter")<0||V)&&!1!==Y.props.hideOnClick&&Y.state.isVisible?n=!0:Lt(t),"click"===t.type&&(V=!n),n&&!r&&Dt(t)}}function wt(t){var e=t.target,n=et().contains(e)||$.contains(e);"mousemove"===t.type&&n||function(t,e){var n=e.clientX,r=e.clientY;return t.every(function(t){var e=t.popperRect,o=t.popperState,i=t.props.interactiveBorder,a=l(o.placement),s=o.modifiersData.offset;if(!s)return!0;var u="bottom"===a?s.top.y:0,p="top"===a?s.bottom.y:0,c="right"===a?s.left.x:0,f="left"===a?s.right.x:0,d=e.top-r+u>i,v=r-e.bottom-p>i,m=e.left-n+c>i,g=n-e.right-f>i;return d||v||m||g})}(At().concat($).map(function(t){var e,n=null==(e=t._tippy.popperInstance)?void 0:e.state;return n?{popperRect:t.getBoundingClientRect(),popperState:n,props:P}:null}).filter(Boolean),t)&&(pt(),Dt(t))}function xt(t){Ot(t)||Y.props.trigger.indexOf("click")>=0&&V||(Y.props.interactive?Y.hideWithInteractivity(t):Dt(t))}function Et(t){Y.props.trigger.indexOf("focusin")<0&&t.target!==et()||Y.props.interactive&&t.relatedTarget&&$.contains(t.relatedTarget)||Dt(t)}function Ot(t){return!!T.isTouch&&Z()!==t.type.indexOf("touch")>=0}function Ct(){Tt();var n=Y.props,r=n.popperOptions,o=n.placement,i=n.offset,a=n.getReferenceClientRect,s=n.moveTransition,u=tt()?B($).arrow:null,p=a?{getBoundingClientRect:a,contextElement:a.contextElement||et()}:e,c=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var e=t.state;if(tt()){var n=rt().box;["placement","reference-hidden","escaped"].forEach(function(t){"placement"===t?n.setAttribute("data-placement",e.placement):e.attributes.popper["data-popper-"+t]?n.setAttribute("data-"+t,""):n.removeAttribute("data-"+t)}),e.attributes.popper={}}}}];tt()&&u&&c.push({name:"arrow",options:{element:u,padding:3}}),c.push.apply(c,(null==r?void 0:r.modifiers)||[]),Y.popperInstance=t.createPopper(p,$,Object.assign({},r,{placement:o,onFirstUpdate:L,modifiers:c}))}function Tt(){Y.popperInstance&&(Y.popperInstance.destroy(),Y.popperInstance=null)}function At(){return d($.querySelectorAll("[data-tippy-root]"))}function Lt(t){Y.clearDelayTimeouts(),t&&at("onTrigger",[Y,t]),dt();var e=ot(!0),n=Q(),r=n[0],o=n[1];T.isTouch&&"hold"===r&&o&&(e=o),e?p=setTimeout(function(){Y.show()},e):Y.show()}function Dt(t){if(Y.clearDelayTimeouts(),at("onUntrigger",[Y,t]),Y.state.isVisible){if(!(Y.props.trigger.indexOf("mouseenter")>=0&&Y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&V)){var e=ot(!1);e?g=setTimeout(function(){Y.state.isVisible&&Y.hide()},e):b=requestAnimationFrame(function(){Y.hide()})}}else vt()}}function F(t,e){void 0===e&&(e={});var n=R.plugins.concat(e.plugins||[]);document.addEventListener("touchstart",L,r),window.addEventListener("blur",k);var o=Object.assign({},e,{plugins:n}),i=y(t).reduce(function(t,e){var n=e&&z(e,o);return n&&t.push(n),t},[]);return g(t)?i[0]:i}F.defaultProps=R,F.setDefaultProps=function(t){Object.keys(t).forEach(function(e){R[e]=t[e]})},F.currentInput=T;var W=Object.assign({},t.applyStyles,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}}),X={mouseover:"mouseenter",focusin:"focus",click:"click"};var Y={name:"animateFill",defaultValue:!1,fn:function(t){var e;if(null==(e=t.props.render)||!e.$$tippy)return{};var n=B(t.popper),r=n.box,o=n.content,i=t.props.animateFill?function(){var t=m();return t.className="tippy-backdrop",x([t],"hidden"),t}():null;return{onCreate:function(){i&&(r.insertBefore(i,r.firstElementChild),r.setAttribute("data-animatefill",""),r.style.overflow="hidden",t.setProps({arrow:!1,animation:"shift-away"}))},onMount:function(){if(i){var t=r.style.transitionDuration,e=Number(t.replace("ms",""));o.style.transitionDelay=Math.round(e/10)+"ms",i.style.transitionDuration=t,x([i],"visible")}},onShow:function(){i&&(i.style.transitionDuration="0ms")},onHide:function(){i&&x([i],"hidden")}}}};var q={clientX:0,clientY:0},$=[];function J(t){var e=t.clientX,n=t.clientY;q={clientX:e,clientY:n}}var G={name:"followCursor",defaultValue:!1,fn:function(t){var e=t.reference,n=E(t.props.triggerTarget||e),r=!1,o=!1,i=!0,a=t.props;function s(){return"initial"===t.props.followCursor&&t.state.isVisible}function u(){n.addEventListener("mousemove",f)}function p(){n.removeEventListener("mousemove",f)}function c(){r=!0,t.setProps({getReferenceClientRect:null}),r=!1}function f(n){var r=!n.target||e.contains(n.target),o=t.props.followCursor,i=n.clientX,a=n.clientY,s=e.getBoundingClientRect(),u=i-s.left,p=a-s.top;!r&&t.props.interactive||t.setProps({getReferenceClientRect:function(){var t=e.getBoundingClientRect(),n=i,r=a;"initial"===o&&(n=t.left+u,r=t.top+p);var s="horizontal"===o?t.top:r,c="vertical"===o?t.right:n,f="horizontal"===o?t.bottom:r,l="vertical"===o?t.left:n;return{width:c-l,height:f-s,top:s,right:c,bottom:f,left:l}}})}function l(){t.props.followCursor&&($.push({instance:t,doc:n}),function(t){t.addEventListener("mousemove",J)}(n))}function d(){0===($=$.filter(function(e){return e.instance!==t})).filter(function(t){return t.doc===n}).length&&function(t){t.removeEventListener("mousemove",J)}(n)}return{onCreate:l,onDestroy:d,onBeforeUpdate:function(){a=t.props},onAfterUpdate:function(e,n){var i=n.followCursor;r||void 0!==i&&a.followCursor!==i&&(d(),i?(l(),!t.state.isMounted||o||s()||u()):(p(),c()))},onMount:function(){t.props.followCursor&&!o&&(i&&(f(q),i=!1),s()||u())},onTrigger:function(t,e){h(e)&&(q={clientX:e.clientX,clientY:e.clientY}),o="focus"===e.type},onHidden:function(){t.props.followCursor&&(c(),p(),i=!0)}}}};var K={name:"inlinePositioning",defaultValue:!1,fn:function(t){var e,n=t.reference;var r=-1,o=!1,i=[],a={name:"tippyInlinePositioning",enabled:!0,phase:"afterWrite",fn:function(o){var a=o.state;t.props.inlinePositioning&&(-1!==i.indexOf(a.placement)&&(i=[]),e!==a.placement&&-1===i.indexOf(a.placement)&&(i.push(a.placement),t.setProps({getReferenceClientRect:function(){return function(t){return function(t,e,n,r){if(n.length<2||null===t)return e;if(2===n.length&&r>=0&&n[0].left>n[1].right)return n[r]||e;switch(t){case"top":case"bottom":var o=n[0],i=n[n.length-1],a="top"===t,s=o.top,u=i.bottom,p=a?o.left:i.left,c=a?o.right:i.right;return{top:s,bottom:u,left:p,right:c,width:c-p,height:u-s};case"left":case"right":var f=Math.min.apply(Math,n.map(function(t){return t.left})),l=Math.max.apply(Math,n.map(function(t){return t.right})),d=n.filter(function(e){return"left"===t?e.left===f:e.right===l}),v=d[0].top,m=d[d.length-1].bottom;return{top:v,bottom:m,left:f,right:l,width:l-f,height:m-v};default:return e}}(l(t),n.getBoundingClientRect(),d(n.getClientRects()),r)}(a.placement)}})),e=a.placement)}};function s(){var e;o||(e=function(t,e){var n;return{popperOptions:Object.assign({},t.popperOptions,{modifiers:[].concat(((null==(n=t.popperOptions)?void 0:n.modifiers)||[]).filter(function(t){return t.name!==e.name}),[e])})}}(t.props,a),o=!0,t.setProps(e),o=!1)}return{onCreate:s,onAfterUpdate:s,onTrigger:function(e,n){if(h(n)){var o=d(t.reference.getClientRects()),i=o.find(function(t){return t.left-2<=n.clientX&&t.right+2>=n.clientX&&t.top-2<=n.clientY&&t.bottom+2>=n.clientY}),a=o.indexOf(i);r=a>-1?a:r}},onHidden:function(){r=-1}}}};var Q={name:"sticky",defaultValue:!1,fn:function(t){var e=t.reference,n=t.popper;function r(e){return!0===t.props.sticky||t.props.sticky===e}var o=null,i=null;function a(){var s=r("reference")?(t.popperInstance?t.popperInstance.state.elements.reference:e).getBoundingClientRect():null,u=r("popper")?n.getBoundingClientRect():null;(s&&Z(o,s)||u&&Z(i,u))&&t.popperInstance&&t.popperInstance.update(),o=s,i=u,t.state.isMounted&&requestAnimationFrame(a)}return{onMount:function(){t.props.sticky&&a()}}}};function Z(t,e){return!t||!e||(t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left)}return e&&function(t){var e=document.createElement("style");e.textContent=t,e.setAttribute("data-tippy-stylesheet","");var n=document.head,r=document.querySelector("head>style,head>link");r?n.insertBefore(e,r):n.appendChild(e)}('.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}'),F.setDefaultProps({plugins:[Y,G,K,Q],render:N}),F.createSingleton=function(t,e){var n;void 0===e&&(e={});var r,o=t,i=[],a=[],s=e.overrides,u=[],f=!1;function l(){a=o.map(function(t){return c(t.props.triggerTarget||t.reference)}).reduce(function(t,e){return t.concat(e)},[])}function d(){i=o.map(function(t){return t.reference})}function v(t){o.forEach(function(e){t?e.enable():e.disable()})}function g(t){return o.map(function(e){var n=e.setProps;return e.setProps=function(o){n(o),e.reference===r&&t.setProps(o)},function(){e.setProps=n}})}function h(t,e){var n=a.indexOf(e);if(e!==r){r=e;var u=(s||[]).concat("content").reduce(function(t,e){return t[e]=o[n].props[e],t},{});t.setProps(Object.assign({},u,{getReferenceClientRect:"function"==typeof u.getReferenceClientRect?u.getReferenceClientRect:function(){var t;return null==(t=i[n])?void 0:t.getBoundingClientRect()}}))}}v(!1),d(),l();var b={fn:function(){return{onDestroy:function(){v(!0)},onHidden:function(){r=null},onClickOutside:function(t){t.props.showOnCreate&&!f&&(f=!0,r=null)},onShow:function(t){t.props.showOnCreate&&!f&&(f=!0,h(t,i[0]))},onTrigger:function(t,e){h(t,e.currentTarget)}}}},y=F(m(),Object.assign({},p(e,["overrides"]),{plugins:[b].concat(e.plugins||[]),triggerTarget:a,popperOptions:Object.assign({},e.popperOptions,{modifiers:[].concat((null==(n=e.popperOptions)?void 0:n.modifiers)||[],[W])})})),w=y.show;y.show=function(t){if(w(),!r&&null==t)return h(y,i[0]);if(!r||null!=t){if("number"==typeof t)return i[t]&&h(y,i[t]);if(o.indexOf(t)>=0){var e=t.reference;return h(y,e)}return i.indexOf(t)>=0?h(y,t):void 0}},y.showNext=function(){var t=i[0];if(!r)return y.show(0);var e=i.indexOf(r);y.show(i[e+1]||t)},y.showPrevious=function(){var t=i[i.length-1];if(!r)return y.show(t);var e=i.indexOf(r),n=i[e-1]||t;y.show(n)};var x=y.setProps;return y.setProps=function(t){s=t.overrides||s,x(t)},y.setInstances=function(t){v(!0),u.forEach(function(t){return t()}),o=t,v(!1),d(),l(),u=g(y),y.setProps({triggerTarget:a})},u=g(y),y},F.delegate=function(t,e){var n=[],o=[],i=!1,a=e.target,s=p(e,["target"]),u=Object.assign({},s,{trigger:"manual",touch:!1}),f=Object.assign({touch:R.touch},s,{showOnCreate:!0}),l=F(t,u);function d(t){if(t.target&&!i){var n=t.target.closest(a);if(n){var r=n.getAttribute("data-tippy-trigger")||e.trigger||R.trigger;if(!n._tippy&&!("touchstart"===t.type&&"boolean"==typeof f.touch||"touchstart"!==t.type&&r.indexOf(X[t.type])<0)){var s=F(n,f);s&&(o=o.concat(s))}}}}function v(t,e,r,o){void 0===o&&(o=!1),t.addEventListener(e,r,o),n.push({node:t,eventType:e,handler:r,options:o})}return c(l).forEach(function(t){var e=t.destroy,a=t.enable,s=t.disable;t.destroy=function(t){void 0===t&&(t=!0),t&&o.forEach(function(t){t.destroy()}),o=[],n.forEach(function(t){var e=t.node,n=t.eventType,r=t.handler,o=t.options;e.removeEventListener(n,r,o)}),n=[],e()},t.enable=function(){a(),o.forEach(function(t){return t.enable()}),i=!1},t.disable=function(){s(),o.forEach(function(t){return t.disable()}),i=!0},function(t){var e=t.reference;v(e,"touchstart",d,r),v(e,"mouseover",d),v(e,"focusin",d),v(e,"click",d)}(t)}),l},F.hideAll=function(t){var e=void 0===t?{}:t,n=e.exclude,r=e.duration;_.forEach(function(t){var e=!1;if(n&&(e=b(n)?t.reference===n:t.popper===n.popper),!e){var o=t.props.duration;t.setProps({duration:r}),t.hide(),t.state.isDestroyed||t.setProps({duration:o})}})},F.roundArrow='<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>',F});!function(root,factory){"function"==typeof define&&define.amd?define("sifter",factory):"object"==typeof exports?module.exports=factory():root.Sifter=factory()}(this,function(){function Sifter(items,settings){this.items=items,this.settings=settings||{diacritics:!0}}Sifter.prototype.tokenize=function(query,respect_word_boundaries){if(!(query=trim(String(query||"").toLowerCase()))||!query.length)return[];for(var regex,letter,tokens=[],words=query.split(/ +/),i=0,n=words.length;i<n;i++){if(regex=escape_regex(words[i]),this.settings.diacritics)for(letter in DIACRITICS)DIACRITICS.hasOwnProperty(letter)&&(regex=regex.replace(new RegExp(letter,"g"),DIACRITICS[letter]));respect_word_boundaries&&(regex="\\b"+regex),tokens.push({string:words[i],regex:new RegExp(regex,"i")})}return tokens},Sifter.prototype.iterator=function(object,callback){var iterator=is_array(object)?Array.prototype.forEach||function(callback){for(var i=0,n=this.length;i<n;i++)callback(this[i],i,this)}:function(callback){for(var key in this)this.hasOwnProperty(key)&&callback(this[key],key,this)};iterator.apply(object,[callback])},Sifter.prototype.getScoreFunction=function(search,options){function scoreValue(value,token){var pos;return!value||-1===(pos=(value=String(value||"")).search(token.regex))?0:(token=token.string.length/value.length,0===pos&&(token+=.5),token)}var field_count,tokens=(search=this.prepareSearch(search,options)).tokens,fields=search.options.fields,token_count=tokens.length,nesting=search.options.nesting,scoreObject=(field_count=fields.length)?1===field_count?function(token,data){return scoreValue(getattr(data,fields[0],nesting),token)}:function(token,data){for(var i=0,sum=0;i<field_count;i++)sum+=scoreValue(getattr(data,fields[i],nesting),token);return sum/field_count}:function(){return 0};return token_count?1===token_count?function(data){return scoreObject(tokens[0],data)}:"and"===search.options.conjunction?function(data){for(var score,i=0,sum=0;i<token_count;i++){if((score=scoreObject(tokens[i],data))<=0)return 0;sum+=score}return sum/token_count}:function(data){for(var i=0,sum=0;i<token_count;i++)sum+=scoreObject(tokens[i],data);return sum/token_count}:function(){return 0}},Sifter.prototype.getSortFunction=function(search,options){var i,n,field,fields_count,multiplier,multipliers,implicit_score,self=this,sort=!(search=self.prepareSearch(search,options)).query&&options.sort_empty||options.sort,get_field=function(name,result){return"$score"===name?result.score:getattr(self.items[result.id],name,options.nesting)},fields=[];if(sort)for(i=0,n=sort.length;i<n;i++)!search.query&&"$score"===sort[i].field||fields.push(sort[i]);if(search.query){for(implicit_score=!0,i=0,n=fields.length;i<n;i++)if("$score"===fields[i].field){implicit_score=!1;break}implicit_score&&fields.unshift({field:"$score",direction:"desc"})}else for(i=0,n=fields.length;i<n;i++)if("$score"===fields[i].field){fields.splice(i,1);break}for(multipliers=[],i=0,n=fields.length;i<n;i++)multipliers.push("desc"===fields[i].direction?-1:1);return(fields_count=fields.length)?1===fields_count?(field=fields[0].field,multiplier=multipliers[0],function(a,b){return multiplier*cmp(get_field(field,a),get_field(field,b))}):function(a,b){for(var field,i=0;i<fields_count;i++)if(field=fields[i].field,field=multipliers[i]*cmp(get_field(field,a),get_field(field,b)))return field;return 0}:null},Sifter.prototype.prepareSearch=function(query,options){if("object"==typeof query)return query;var option_fields=(options=extend({},options)).fields,option_sort=options.sort,option_sort_empty=options.sort_empty;return option_fields&&!is_array(option_fields)&&(options.fields=[option_fields]),option_sort&&!is_array(option_sort)&&(options.sort=[option_sort]),option_sort_empty&&!is_array(option_sort_empty)&&(options.sort_empty=[option_sort_empty]),{options:options,query:String(query||"").toLowerCase(),tokens:this.tokenize(query,options.respect_word_boundaries),total:0,items:[]}},Sifter.prototype.search=function(query,options){var score,fn_score,search=this.prepareSearch(query,options);return options=search.options,query=search.query,fn_score=options.score||this.getScoreFunction(search),query.length?this.iterator(this.items,function(item,id){score=fn_score(item),(!1===options.filter||0<score)&&search.items.push({score:score,id:id})}):this.iterator(this.items,function(item,id){search.items.push({score:1,id:id})}),(query=this.getSortFunction(search,options))&&search.items.sort(query),search.total=search.items.length,"number"==typeof options.limit&&(search.items=search.items.slice(0,options.limit)),search};var cmp=function(a,b){return"number"==typeof a&&"number"==typeof b?b<a?1:a<b?-1:0:(a=asciifold(String(a||"")),(b=asciifold(String(b||"")))<a?1:a<b?-1:0)},extend=function(a,b){for(var k,object,i=1,n=arguments.length;i<n;i++)if(object=arguments[i])for(k in object)object.hasOwnProperty(k)&&(a[k]=object[k]);return a},getattr=function(obj,name,nesting){if(obj&&name){if(!nesting)return obj[name];for(var names=name.split(".");names.length&&(obj=obj[names.shift()]););return obj}},trim=function(str){return(str+"").replace(/^\s+|\s+$|/g,"")},escape_regex=function(str){return(str+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},is_array=Array.isArray||"undefined"!=typeof $&&$.isArray||function(object){return"[object Array]"===Object.prototype.toString.call(object)},DIACRITICS={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},asciifold=function(){var i,n,k,chunk,foreignletters="",lookup={};for(k in DIACRITICS)if(DIACRITICS.hasOwnProperty(k))for(foreignletters+=chunk=DIACRITICS[k].substring(2,DIACRITICS[k].length-1),i=0,n=chunk.length;i<n;i++)lookup[chunk.charAt(i)]=k;var regexp=new RegExp("["+foreignletters+"]","g");return function(str){return str.replace(regexp,function(foreignletter){return lookup[foreignletter]}).toLowerCase()}}();return Sifter}),function(root,factory){"function"==typeof define&&define.amd?define("microplugin",factory):"object"==typeof exports?module.exports=factory():root.MicroPlugin=factory()}(this,function(){var MicroPlugin={mixin:function(Interface){Interface.plugins={},Interface.prototype.initializePlugins=function(plugins){var i,n,key,queue=[];if(this.plugins={names:[],settings:{},requested:{},loaded:{}},utils.isArray(plugins))for(i=0,n=plugins.length;i<n;i++)"string"==typeof plugins[i]?queue.push(plugins[i]):(this.plugins.settings[plugins[i].name]=plugins[i].options,queue.push(plugins[i].name));else if(plugins)for(key in plugins)plugins.hasOwnProperty(key)&&(this.plugins.settings[key]=plugins[key],queue.push(key));for(;queue.length;)this.require(queue.shift())},Interface.prototype.loadPlugin=function(name){var plugins=this.plugins,plugin=Interface.plugins[name];if(!Interface.plugins.hasOwnProperty(name))throw new Error('Unable to find "'+name+'" plugin');plugins.requested[name]=!0,plugins.loaded[name]=plugin.fn.apply(this,[this.plugins.settings[name]||{}]),plugins.names.push(name)},Interface.prototype.require=function(name){var plugins=this.plugins;if(!this.plugins.loaded.hasOwnProperty(name)){if(plugins.requested[name])throw new Error('Plugin has circular dependency ("'+name+'")');this.loadPlugin(name)}return plugins.loaded[name]},Interface.define=function(name,fn){Interface.plugins[name]={name:name,fn:fn}}}},utils={isArray:Array.isArray||function(vArg){return"[object Array]"===Object.prototype.toString.call(vArg)}};return MicroPlugin}),function(root,factory){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],factory):"object"==typeof module&&"object"==typeof module.exports?module.exports=factory(require("jquery"),require("sifter"),require("microplugin")):root.Selectize=factory(root.jQuery,root.Sifter,root.MicroPlugin)}(this,function($,Sifter,MicroPlugin){"use strict";function MicroEvent(){}$.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var parent=this.parentNode;parent.replaceChild(this.firstChild,this),parent.normalize()}).end()};function isset(object){return void 0!==object}function hash_key(value){return null==value?null:"boolean"==typeof value?value?"1":"0":value+""}function escape_html(str){return(str+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function debounce_events(self,types,fn){var type,trigger=self.trigger,event_args={};for(type in self.trigger=function(){var type=arguments[0];if(-1===types.indexOf(type))return trigger.apply(self,arguments);event_args[type]=arguments},fn.apply(self,[]),self.trigger=trigger,event_args)event_args.hasOwnProperty(type)&&trigger.apply(self,event_args[type])}function getSelection(input){var sel,selLen,result={};return void 0===input?console.warn("WARN getSelection cannot locate input control"):"selectionStart"in input?(result.start=input.selectionStart,result.length=input.selectionEnd-result.start):document.selection&&(input.focus(),sel=document.selection.createRange(),selLen=document.selection.createRange().text.length,sel.moveStart("character",-input.value.length),result.start=sel.text.length-selLen,result.length=selLen),result}function measureString(str,$parent){return str?(Selectize.$testInput||(Selectize.$testInput=$("<span />").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),$("<div />").css({position:"absolute",width:0,height:0,overflow:"hidden"}).append(Selectize.$testInput).appendTo("body")),Selectize.$testInput.text(str),transferStyles($parent,Selectize.$testInput,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),Selectize.$testInput.width()):0}function autoGrow($input){function update(e,options){var printable,keyCode,selection;options=options||{},(e=e||window.event||{}).metaKey||e.altKey||!options.force&&!1===$input.data("grow")||(options=$input.val(),e.type&&"keydown"===e.type.toLowerCase()&&(printable=48<=(keyCode=e.keyCode)&&keyCode<=57||65<=keyCode&&keyCode<=90||96<=keyCode&&keyCode<=111||186<=keyCode&&keyCode<=222||32===keyCode,46===keyCode||8===keyCode?(selection=getSelection($input[0])).length?options=options.substring(0,selection.start)+options.substring(selection.start+selection.length):8===keyCode&&selection.start?options=options.substring(0,selection.start-1)+options.substring(selection.start+1):46===keyCode&&void 0!==selection.start&&(options=options.substring(0,selection.start)+options.substring(selection.start+1)):printable&&(keyCode=e.shiftKey,selection=String.fromCharCode(e.keyCode),options+=selection=keyCode?selection.toUpperCase():selection.toLowerCase())),e=(printable=$input.attr("placeholder"))?measureString(printable,$input)+4:0,(keyCode=Math.max(measureString(options,$input),e)+4)!==currentWidth&&(currentWidth=keyCode,$input.width(keyCode),$input.triggerHandler("resize")))}var currentWidth=null;$input.on("keydown keyup update blur",update),update()}MicroEvent.prototype={on:function(event,fct){this._events=this._events||{},this._events[event]=this._events[event]||[],this._events[event].push(fct)},off:function(event,fct){var n=arguments.length;return 0===n?delete this._events:1===n?delete this._events[event]:(this._events=this._events||{},void(event in this._events!=!1&&this._events[event].splice(this._events[event].indexOf(fct),1)))},trigger:function(event){if(this._events=this._events||{},event in this._events!=!1)for(var i=0;i<this._events[event].length;i++)this._events[event][i].apply(this,Array.prototype.slice.call(arguments,1))}},MicroEvent.mixin=function(destObject){for(var props=["on","off","trigger"],i=0;i<props.length;i++)destObject.prototype[props[i]]=MicroEvent.prototype[props[i]]};var options,IS_MAC=/Mac/.test(navigator.userAgent),KEY_CMD=IS_MAC?91:17,KEY_CTRL=IS_MAC?18:17,SUPPORTS_VALIDITY_API=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,hook={before:function(self,method,fn){var original=self[method];self[method]=function(){return fn.apply(self,arguments),original.apply(self,arguments)}},after:function(self,method,fn){var original=self[method];self[method]=function(){var result=original.apply(self,arguments);return fn.apply(self,arguments),result}}},transferStyles=function($from,$to,properties){var i,n,styles={};if(properties)for(i=0,n=properties.length;i<n;i++)styles[properties[i]]=$from.css(properties[i]);else styles=$from.css();$to.css(styles)},Selectize=function($input,settings){var i,n,fn,delay,timeout,input=$input[0],computedStyle=(input.selectize=this,window.getComputedStyle&&window.getComputedStyle(input,null));if(computedStyle=(computedStyle?computedStyle.getPropertyValue("direction"):input.currentStyle&&input.currentStyle.direction)||$input.parents("[dir]:first").attr("dir")||"",$.extend(this,{order:0,settings:settings,$input:$input,tabIndex:$input.attr("tabindex")||"",tagType:"select"===input.tagName.toLowerCase()?1:2,rtl:/rtl/i.test(computedStyle),eventNS:".selectize"+ ++Selectize.count,highlightedValue:null,isBlurring:!1,isOpen:!1,isDisabled:!1,isRequired:$input.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",lastValidValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===settings.loadThrottle?this.onSearchChange:(fn=this.onSearchChange,delay=settings.loadThrottle,function(){var self=this,args=arguments;window.clearTimeout(timeout),timeout=window.setTimeout(function(){fn.apply(self,args)},delay)})}),this.sifter=new Sifter(this.options,{diacritics:settings.diacritics}),this.settings.options){for(i=0,n=this.settings.options.length;i<n;i++)this.registerOption(this.settings.options[i]);delete this.settings.options}if(this.settings.optgroups){for(i=0,n=this.settings.optgroups.length;i<n;i++)this.registerOptionGroup(this.settings.optgroups[i]);delete this.settings.optgroups}this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),"boolean"!=typeof this.settings.hideSelected&&(this.settings.hideSelected="multi"===this.settings.mode),this.initializePlugins(this.settings.plugins),this.setupCallbacks(),this.setupTemplates(),this.setup()};return MicroEvent.mixin(Selectize),void 0!==MicroPlugin?MicroPlugin.mixin(Selectize):(MicroPlugin="Dependency MicroPlugin is missing",options=(options={explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'})||{},console.error("Selectize: "+MicroPlugin),options.explanation&&(console.group&&console.group(),console.error(options.explanation),console.group&&console.groupEnd())),$.extend(Selectize.prototype,{setup:function(){var $parent,inputId,fn,self=this,settings=self.settings,eventNS=self.eventNS,$window=$(window),$document=$(document),$input=self.$input,inputMode=self.settings.mode,classes=$input.attr("class")||"",$wrapper=$("<div>").addClass(settings.wrapperClass).addClass(classes).addClass(inputMode),$control=$("<div>").addClass(settings.inputClass).addClass("items").appendTo($wrapper),$control_input=$('<input type="text" autocomplete="new-password" autofill="no" />').appendTo($control).attr("tabindex",$input.is(":disabled")?"-1":self.tabIndex),$dropdown_parent=$(settings.dropdownParent||$wrapper),inputMode=$("<div>").addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent),$dropdown_parent=$("<div>").addClass(settings.dropdownContentClass).attr("tabindex","-1").appendTo(inputMode);(inputId=$input.attr("id"))&&($control_input.attr("id",inputId+"-selectized"),$("label[for='"+inputId+"']").attr("for",inputId+"-selectized")),self.settings.copyClassesToDropdown&&inputMode.addClass(classes),$wrapper.css({width:$input[0].style.width}),self.plugins.names.length&&(inputId="plugin-"+self.plugins.names.join(" plugin-"),$wrapper.addClass(inputId),inputMode.addClass(inputId)),(null===settings.maxItems||1<settings.maxItems)&&1===self.tagType&&$input.attr("multiple","multiple"),self.settings.placeholder&&$control_input.attr("placeholder",settings.placeholder),!self.settings.splitOn&&self.settings.delimiter&&(classes=self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),self.settings.splitOn=new RegExp("\\s*"+classes+"+\\s*")),$input.attr("autocorrect")&&$control_input.attr("autocorrect",$input.attr("autocorrect")),$input.attr("autocapitalize")&&$control_input.attr("autocapitalize",$input.attr("autocapitalize")),$input.is("input")&&($control_input[0].type=$input[0].type),self.$wrapper=$wrapper,self.$control=$control,self.$control_input=$control_input,self.$dropdown=inputMode,self.$dropdown_content=$dropdown_parent,inputMode.on("mouseenter mousedown click","[data-disabled]>[data-selectable]",function(e){e.stopImmediatePropagation()}),inputMode.on("mouseenter","[data-selectable]",function(){return self.onOptionHover.apply(self,arguments)}),inputMode.on("mousedown click","[data-selectable]",function(){return self.onOptionSelect.apply(self,arguments)}),inputId="mousedown",classes="*:not(input)",fn=function(){return self.onItemSelect.apply(self,arguments)},($parent=$control).on(inputId,classes,function(e){for(var child=e.target;child&&child.parentNode!==$parent[0];)child=child.parentNode;return e.currentTarget=child,fn.apply(this,[e])}),autoGrow($control_input),$control.on({mousedown:function(){return self.onMouseDown.apply(self,arguments)},click:function(){return self.onClick.apply(self,arguments)}}),$control_input.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return self.onKeyDown.apply(self,arguments)},keypress:function(){return self.onKeyPress.apply(self,arguments)},input:function(){return self.onInput.apply(self,arguments)},resize:function(){self.positionDropdown.apply(self,[])},blur:function(){return self.onBlur.apply(self,arguments)},focus:function(){return self.ignoreBlur=!1,self.onFocus.apply(self,arguments)},paste:function(){return self.onPaste.apply(self,arguments)}}),$document.on("keydown"+eventNS,function(e){self.isCmdDown=e[IS_MAC?"metaKey":"ctrlKey"],self.isCtrlDown=e[IS_MAC?"altKey":"ctrlKey"],self.isShiftDown=e.shiftKey}),$document.on("keyup"+eventNS,function(e){e.keyCode===KEY_CTRL&&(self.isCtrlDown=!1),16===e.keyCode&&(self.isShiftDown=!1),e.keyCode===KEY_CMD&&(self.isCmdDown=!1)}),$document.on("mousedown"+eventNS,function(e){if(self.isFocused){if(e.target===self.$dropdown[0]||e.target.parentNode===self.$dropdown[0])return!1;self.$control.has(e.target).length||e.target===self.$control[0]||self.blur(e.target)}}),$window.on(["scroll"+eventNS,"resize"+eventNS].join(" "),function(){self.isOpen&&self.positionDropdown.apply(self,arguments)}),$window.on("mousemove"+eventNS,function(){self.ignoreHover=!1}),this.revertSettings={$children:$input.children().detach(),tabindex:$input.attr("tabindex")},$input.attr("tabindex",-1).hide().after(self.$wrapper),Array.isArray(settings.items)&&(self.lastValidValue=settings.items,self.setValue(settings.items),delete settings.items),SUPPORTS_VALIDITY_API&&$input.on("invalid"+eventNS,function(e){e.preventDefault(),self.isInvalid=!0,self.refreshState()}),self.updateOriginalInput(),self.refreshItems(),self.refreshState(),self.updatePlaceholder(),self.isSetup=!0,$input.is(":disabled")&&self.disable(),self.on("change",this.onChange),$input.data("selectize",self),$input.addClass("selectized"),self.trigger("initialize"),!0===settings.preload&&self.onSearchChange("")},setupTemplates:function(){var field_label=this.settings.labelField,field_value=this.settings.valueField,field_optgroup=this.settings.optgroupLabelField;this.settings.render=$.extend({},{optgroup:function(data){return'<div class="optgroup">'+data.html+"</div>"},optgroup_header:function(data,escape){return'<div class="optgroup-header">'+escape(data[field_optgroup])+"</div>"},option:function(data,escape){return'<div class="option '+(""===data[field_value]?"selectize-dropdown-emptyoptionlabel":"")+'">'+escape(data[field_label])+"</div>"},item:function(data,escape){return'<div class="item">'+escape(data[field_label])+"</div>"},option_create:function(data,escape){return'<div class="create">Add <strong>'+escape(data.input)+"</strong>…</div>"}},this.settings.render)},setupCallbacks:function(){var key,fn,callbacks={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(key in callbacks)callbacks.hasOwnProperty(key)&&(fn=this.settings[callbacks[key]])&&this.on(key,fn)},onClick:function(e){this.isFocused&&this.isOpen||(this.focus(),e.preventDefault())},onMouseDown:function(e){var self=this,defaultPrevented=e.isDefaultPrevented();$(e.target);if(self.isFocused){if(e.target!==self.$control_input[0])return"single"===self.settings.mode?self.isOpen?self.close():self.open():defaultPrevented||self.setActiveItem(null),!1}else defaultPrevented||window.setTimeout(function(){self.focus()},0)},onChange:function(){""!==this.getValue()&&(this.lastValidValue=this.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(e){var self=this;self.isFull()||self.isInputHidden||self.isLocked?e.preventDefault():self.settings.splitOn&&setTimeout(function(){var pastedText=self.$control_input.val();if(pastedText.match(self.settings.splitOn))for(var splitInput=pastedText.trim().split(self.settings.splitOn),i=0,n=splitInput.length;i<n;i++)self.createItem(splitInput[i])},0)},onKeyPress:function(e){if(this.isLocked)return e&&e.preventDefault();var character=String.fromCharCode(e.keyCode||e.which);return this.settings.create&&"multi"===this.settings.mode&&character===this.settings.delimiter?(this.createItem(),e.preventDefault(),!1):void 0},onKeyDown:function(e){var $next;e.target,this.$control_input[0];if(this.isLocked)9!==e.keyCode&&e.preventDefault();else{switch(e.keyCode){case 65:if(this.isCmdDown)return void this.selectAll();break;case 27:return void(this.isOpen&&(e.preventDefault(),e.stopPropagation(),this.close()));case 78:if(!e.ctrlKey||e.altKey)break;case 40:return!this.isOpen&&this.hasOptions?this.open():this.$activeOption&&(this.ignoreHover=!0,($next=this.getAdjacentOption(this.$activeOption,1)).length&&this.setActiveOption($next,!0,!0)),void e.preventDefault();case 80:if(!e.ctrlKey||e.altKey)break;case 38:return this.$activeOption&&(this.ignoreHover=!0,($next=this.getAdjacentOption(this.$activeOption,-1)).length&&this.setActiveOption($next,!0,!0)),void e.preventDefault();case 13:return void(this.isOpen&&this.$activeOption&&(this.onOptionSelect({currentTarget:this.$activeOption}),e.preventDefault()));case 37:return void this.advanceSelection(-1,e);case 39:return void this.advanceSelection(1,e);case 9:return this.settings.selectOnTab&&this.isOpen&&this.$activeOption&&(this.onOptionSelect({currentTarget:this.$activeOption}),this.isFull()||e.preventDefault()),void(this.settings.create&&this.createItem()&&this.settings.showAddOptionOnCreate&&e.preventDefault());case 8:case 46:return void this.deleteSelection(e)}!this.isFull()&&!this.isInputHidden||(IS_MAC?e.metaKey:e.ctrlKey)||e.preventDefault()}},onInput:function(e){var value=this.$control_input.val()||"";this.lastValue!==value&&(this.lastValue=value,this.onSearchChange(value),this.refreshOptions(),this.trigger("type",value))},onSearchChange:function(value){var self=this,fn=self.settings.load;fn&&!self.loadedSearches.hasOwnProperty(value)&&(self.loadedSearches[value]=!0,self.load(function(callback){fn.apply(self,[value,callback])}))},onFocus:function(e){var wasFocused=this.isFocused;if(this.isDisabled)return this.blur(),e&&e.preventDefault(),!1;this.ignoreFocus||(this.isFocused=!0,"focus"===this.settings.preload&&this.onSearchChange(""),wasFocused||this.trigger("focus"),this.$activeItems.length||(this.showInput(),this.setActiveItem(null),this.refreshOptions(!!this.settings.openOnFocus)),this.refreshState())},onBlur:function(e,dest){var self=this;if(self.isFocused&&(self.isFocused=!1,!self.ignoreFocus)){if(!self.ignoreBlur&&document.activeElement===self.$dropdown_content[0])return self.ignoreBlur=!0,void self.onFocus(e);e=function(){self.close(),self.setTextboxValue(""),self.setActiveItem(null),self.setActiveOption(null),self.setCaret(self.items.length),self.refreshState(),dest&&dest.focus&&dest.focus(),self.isBlurring=!1,self.ignoreFocus=!1,self.trigger("blur")};self.isBlurring=!0,self.ignoreFocus=!0,self.settings.create&&self.settings.createOnBlur?self.createItem(null,!1,e):e()}},onOptionHover:function(e){this.ignoreHover||this.setActiveOption(e.currentTarget,!1)},onOptionSelect:function(e){var $target,self=this;e.preventDefault&&(e.preventDefault(),e.stopPropagation()),($target=$(e.currentTarget)).hasClass("create")?self.createItem(null,function(){self.settings.closeAfterSelect&&self.close()}):void 0!==($target=$target.attr("data-value"))&&(self.lastQuery=null,self.setTextboxValue(""),self.addItem($target),self.settings.closeAfterSelect?self.close():!self.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&self.setActiveOption(self.getOption($target)))},onItemSelect:function(e){this.isLocked||"multi"===this.settings.mode&&(e.preventDefault(),this.setActiveItem(e.currentTarget,e))},load:function(fn){var self=this,$wrapper=self.$wrapper.addClass(self.settings.loadingClass);self.loading++,fn.apply(self,[function(results){self.loading=Math.max(self.loading-1,0),results&&results.length&&(self.addOption(results),self.refreshOptions(self.isFocused&&!self.isInputHidden)),self.loading||$wrapper.removeClass(self.settings.loadingClass),self.trigger("load",results)}])},getTextboxValue:function(){return this.$control_input.val()},setTextboxValue:function(value){var $input=this.$control_input;$input.val()!==value&&($input.val(value).triggerHandler("update"),this.lastValue=value)},getValue:function(){return 1===this.tagType&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(value,silent){debounce_events(this,silent?[]:["change"],function(){this.clear(silent),this.addItems(value,silent)})},setMaxItems:function(value){this.settings.maxItems=value=0===value?null:value,this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),this.refreshState()},setActiveItem:function($item,e){var eventName,i,end,item,swap,$last;if("single"!==this.settings.mode){if(!($item=$($item)).length)return $(this.$activeItems).removeClass("active"),this.$activeItems=[],void(this.isFocused&&this.showInput());if("mousedown"===(eventName=e&&e.type.toLowerCase())&&this.isShiftDown&&this.$activeItems.length){for($last=this.$control.children(".active:last"),$last=Array.prototype.indexOf.apply(this.$control[0].childNodes,[$last[0]]),(end=Array.prototype.indexOf.apply(this.$control[0].childNodes,[$item[0]]))<$last&&(swap=$last,$last=end,end=swap),i=$last;i<=end;i++)item=this.$control[0].childNodes[i],-1===this.$activeItems.indexOf(item)&&($(item).addClass("active"),this.$activeItems.push(item));e.preventDefault()}else"mousedown"===eventName&&this.isCtrlDown||"keydown"===eventName&&this.isShiftDown?$item.hasClass("active")?(swap=this.$activeItems.indexOf($item[0]),this.$activeItems.splice(swap,1),$item.removeClass("active")):this.$activeItems.push($item.addClass("active")[0]):($(this.$activeItems).removeClass("active"),this.$activeItems=[$item.addClass("active")[0]]);this.hideInput(),this.isFocused||this.focus()}},setActiveOption:function($option,scroll,animate){var height_item,y,scroll_top,scroll_bottom;this.$activeOption&&(this.$activeOption.removeClass("active"),this.trigger("dropdown_item_deactivate",this.$activeOption.attr("data-value"))),this.$activeOption=null,($option=$($option)).length&&(this.$activeOption=$option.addClass("active"),this.isOpen&&this.trigger("dropdown_item_activate",this.$activeOption.attr("data-value")),!scroll&&isset(scroll)||($option=this.$dropdown_content.height(),height_item=this.$activeOption.outerHeight(!0),scroll=this.$dropdown_content.scrollTop()||0,scroll_bottom=(scroll_top=y=this.$activeOption.offset().top-this.$dropdown_content.offset().top+scroll)-$option+height_item,$option+scroll<y+height_item?this.$dropdown_content.stop().animate({scrollTop:scroll_bottom},animate?this.settings.scrollDuration:0):y<scroll&&this.$dropdown_content.stop().animate({scrollTop:scroll_top},animate?this.settings.scrollDuration:0)))},selectAll:function(){"single"!==this.settings.mode&&(this.$activeItems=Array.prototype.slice.apply(this.$control.children(":not(input)").addClass("active")),this.$activeItems.length&&(this.hideInput(),this.close()),this.focus())},hideInput:function(){this.setTextboxValue(""),this.$control_input.css({opacity:0,position:"absolute",left:this.rtl?1e4:-1e4}),this.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var self=this;return self.isDisabled||(self.ignoreFocus=!0,self.$control_input[0].focus(),window.setTimeout(function(){self.ignoreFocus=!1,self.onFocus()},0)),self},blur:function(dest){return this.$control_input[0].blur(),this.onBlur(null,dest),this},getScoreFunction:function(query){return this.sifter.getScoreFunction(query,this.getSearchOptions())},getSearchOptions:function(){var settings=this.settings,sort=settings.sortField;return{fields:settings.searchField,conjunction:settings.searchConjunction,sort:sort="string"==typeof sort?[{field:sort}]:sort,nesting:settings.nesting}},search:function(query){var i,result,calculateScore,settings=this.settings,options=this.getSearchOptions();if(settings.score&&"function"!=typeof(calculateScore=this.settings.score.apply(this,[query])))throw new Error('Selectize "score" setting must be a function that returns a function');if(query!==this.lastQuery?(this.lastQuery=query,result=this.sifter.search(query,$.extend(options,{score:calculateScore})),this.currentResults=result):result=$.extend(!0,{},this.currentResults),settings.hideSelected)for(i=result.items.length-1;0<=i;i--)-1!==this.items.indexOf(hash_key(result.items[i].id))&&result.items.splice(i,1);return result},refreshOptions:function(triggerDropdown){void 0===triggerDropdown&&(triggerDropdown=!0);var i,j,k,groups,groups_order,option,option_html,optgroup,optgroups,html,html_children,has_create_option,$active,$create,d,tmp,self=this,query=self.$control_input.val().trim(),results=self.search(query),$dropdown_content=self.$dropdown_content,active_before=self.$activeOption&&hash_key(self.$activeOption.attr("data-value")),n=results.items.length;for("number"==typeof self.settings.maxOptions&&(n=Math.min(n,self.settings.maxOptions)),groups={},groups_order=[],i=0;i<n;i++)for(option=self.options[results.items[i].id],option_html=self.render("option",option),optgroup=option[self.settings.optgroupField]||"",j=0,k=(optgroups=Array.isArray(optgroup)?optgroup:[optgroup])&&optgroups.length;j<k;j++)optgroup=optgroups[j],self.optgroups.hasOwnProperty(optgroup)||(optgroup=""),groups.hasOwnProperty(optgroup)||(groups[optgroup]=document.createDocumentFragment(),groups_order.push(optgroup)),groups[optgroup].appendChild(option_html);for(this.settings.lockOptgroupOrder&&groups_order.sort(function(a,b){return(self.optgroups[a]&&self.optgroups[a].$order||0)-(self.optgroups[b]&&self.optgroups[b].$order||0)}),html=document.createDocumentFragment(),i=0,n=groups_order.length;i<n;i++)optgroup=groups_order[i],self.optgroups.hasOwnProperty(optgroup)&&groups[optgroup].childNodes.length?((html_children=document.createDocumentFragment()).appendChild(self.render("optgroup_header",self.optgroups[optgroup])),html_children.appendChild(groups[optgroup]),html.appendChild(self.render("optgroup",$.extend({},self.optgroups[optgroup],{html:(d=html_children,tmp=void 0,(tmp=document.createElement("div")).appendChild(d.cloneNode(!0)),tmp.innerHTML),dom:html_children})))):html.appendChild(groups[optgroup]);if($dropdown_content.html(html),self.settings.highlight&&($dropdown_content.removeHighlight(),results.query.length&&results.tokens.length))for(i=0,n=results.tokens.length;i<n;i++)!function($element,pattern){var regex,highlight;if("string"!=typeof pattern||pattern.length)regex="string"==typeof pattern?new RegExp(pattern,"i"):pattern,highlight=function(node){var skip=0;if(3===node.nodeType){var spannode,match,pos=node.data.search(regex);0<=pos&&0<node.data.length&&(match=node.data.match(regex),(spannode=document.createElement("span")).className="highlight",(pos=node.splitText(pos)).splitText(match[0].length),match=pos.cloneNode(!0),spannode.appendChild(match),pos.parentNode.replaceChild(spannode,pos),skip=1)}else if(1===node.nodeType&&node.childNodes&&!/(script|style)/i.test(node.tagName)&&("highlight"!==node.className||"SPAN"!==node.tagName))for(var i=0;i<node.childNodes.length;++i)i+=highlight(node.childNodes[i]);return skip},$element.each(function(){highlight(this)})}($dropdown_content,results.tokens[i].regex);if(!self.settings.hideSelected)for(self.$dropdown.find(".selected").removeClass("selected"),i=0,n=self.items.length;i<n;i++)self.getOption(self.items[i]).addClass("selected");(has_create_option=self.canCreate(query))&&self.settings.showAddOptionOnCreate&&($dropdown_content.prepend(self.render("option_create",{input:query})),$create=$($dropdown_content[0].childNodes[0])),self.hasOptions=0<results.items.length||has_create_option&&self.settings.showAddOptionOnCreate,self.hasOptions?(0<results.items.length?(query=active_before&&self.getOption(active_before),""!==results.query&&query&&query.length?$active=query:"single"===self.settings.mode&&self.items.length&&($active=self.getOption(self.items[0])),$active&&$active.length||($active=$create&&!self.settings.addPrecedence?self.getAdjacentOption($create,1):$dropdown_content.find("[data-selectable]:first"))):$active=$create,self.setActiveOption($active),triggerDropdown&&!self.isOpen&&self.open()):(self.setActiveOption(null),triggerDropdown&&self.isOpen&&self.close())},addOption:function(data){var i,n,value;if(Array.isArray(data))for(i=0,n=data.length;i<n;i++)this.addOption(data[i]);else(value=this.registerOption(data))&&(this.userOptions[value]=!0,this.lastQuery=null,this.trigger("option_add",value,data))},registerOption:function(data){var key=hash_key(data[this.settings.valueField]);return null!=key&&!this.options.hasOwnProperty(key)&&(data.$order=data.$order||++this.order,this.options[key]=data,key)},registerOptionGroup:function(data){var key=hash_key(data[this.settings.optgroupValueField]);return!!key&&(data.$order=data.$order||++this.order,this.optgroups[key]=data,key)},addOptionGroup:function(id,data){data[this.settings.optgroupValueField]=id,(id=this.registerOptionGroup(data))&&this.trigger("optgroup_add",id,data)},removeOptionGroup:function(id){this.optgroups.hasOwnProperty(id)&&(delete this.optgroups[id],this.renderCache={},this.trigger("optgroup_remove",id))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(value,data){var value_new,index_item,order_old;if(value=hash_key(value),value_new=hash_key(data[this.settings.valueField]),null!==value&&this.options.hasOwnProperty(value)){if("string"!=typeof value_new)throw new Error("Value must be set in option data");order_old=this.options[value].$order,value_new!==value&&(delete this.options[value],-1!==(index_item=this.items.indexOf(value))&&this.items.splice(index_item,1,value_new)),data.$order=data.$order||order_old,this.options[value_new]=data,index_item=this.renderCache.item,order_old=this.renderCache.option,index_item&&(delete index_item[value],delete index_item[value_new]),order_old&&(delete order_old[value],delete order_old[value_new]),-1!==this.items.indexOf(value_new)&&(index_item=this.getItem(value),order_old=$(this.render("item",data)),index_item.hasClass("active")&&order_old.addClass("active"),index_item.replaceWith(order_old)),this.lastQuery=null,this.isOpen&&this.refreshOptions(!1)}},removeOption:function(value,silent){value=hash_key(value);var cache_items=this.renderCache.item,cache_options=this.renderCache.option;cache_items&&delete cache_items[value],cache_options&&delete cache_options[value],delete this.userOptions[value],delete this.options[value],this.lastQuery=null,this.trigger("option_remove",value),this.removeItem(value,silent)},clearOptions:function(silent){var self=this,options=(self.loadedSearches={},self.userOptions={},self.renderCache={},self.options);$.each(self.options,function(key,value){-1==self.items.indexOf(key)&&delete options[key]}),self.options=self.sifter.items=options,self.lastQuery=null,self.trigger("option_clear"),self.clear(silent)},getOption:function(value){return this.getElementWithValue(value,this.$dropdown_content.find("[data-selectable]"))},getFirstOption:function(){var $options=this.$dropdown.find("[data-selectable]");return 0<$options.length?$options.eq(0):$()},getAdjacentOption:function($option,direction){var $options=this.$dropdown.find("[data-selectable]"),$option=$options.index($option)+direction;return 0<=$option&&$option<$options.length?$options.eq($option):$()},getElementWithValue:function(value,$els){if(null!=(value=hash_key(value)))for(var i=0,n=$els.length;i<n;i++)if($els[i].getAttribute("data-value")===value)return $($els[i]);return $()},getElementWithTextContent:function(textContent,ignoreCase,$els){if(null!=(textContent=hash_key(textContent)))for(var i=0,n=$els.length;i<n;i++){var eleTextContent=$els[i].textContent;if(1==ignoreCase&&(eleTextContent=null!==eleTextContent?eleTextContent.toLowerCase():null,textContent=textContent.toLowerCase()),eleTextContent===textContent)return $($els[i])}return $()},getItem:function(value){return this.getElementWithValue(value,this.$control.children())},getFirstItemMatchedByTextContent:function(textContent,ignoreCase){return this.getElementWithTextContent(textContent,ignoreCase=null!==ignoreCase&&!0===ignoreCase,this.$dropdown_content.find("[data-selectable]"))},addItems:function(values,silent){this.buffer=document.createDocumentFragment();for(var childNodes=this.$control[0].childNodes,i=0;i<childNodes.length;i++)this.buffer.appendChild(childNodes[i]);for(var items=Array.isArray(values)?values:[values],i=0,n=items.length;i<n;i++)this.isPending=i<n-1,this.addItem(items[i],silent);values=this.$control[0];values.insertBefore(this.buffer,values.firstChild),this.buffer=null},addItem:function(value,silent){debounce_events(this,silent?[]:["change"],function(){var $item,$option,wasFull,inputMode=this.settings.mode;value=hash_key(value),-1!==this.items.indexOf(value)?"single"===inputMode&&this.close():this.options.hasOwnProperty(value)&&("single"===inputMode&&this.clear(silent),"multi"===inputMode&&this.isFull()||($item=$(this.render("item",this.options[value])),wasFull=this.isFull(),this.items.splice(this.caretPos,0,value),this.insertAtCaret($item),this.isPending&&(wasFull||!this.isFull())||this.refreshState(),this.isSetup&&(wasFull=this.$dropdown_content.find("[data-selectable]"),this.isPending||($option=this.getOption(value),$option=this.getAdjacentOption($option,1).attr("data-value"),this.refreshOptions(this.isFocused&&"single"!==inputMode),$option&&this.setActiveOption(this.getOption($option))),!wasFull.length||this.isFull()?this.close():this.isPending||this.positionDropdown(),this.updatePlaceholder(),this.trigger("item_add",value,$item),this.isPending||this.updateOriginalInput({silent:silent}))))})},removeItem:function(value,silent){var i,idx,$item=value instanceof $?value:this.getItem(value);value=hash_key($item.attr("data-value")),-1!==(i=this.items.indexOf(value))&&(this.trigger("item_before_remove",value,$item),$item.remove(),$item.hasClass("active")&&(idx=this.$activeItems.indexOf($item[0]),this.$activeItems.splice(idx,1)),this.items.splice(i,1),this.lastQuery=null,!this.settings.persist&&this.userOptions.hasOwnProperty(value)&&this.removeOption(value,silent),i<this.caretPos&&this.setCaret(this.caretPos-1),this.refreshState(),this.updatePlaceholder(),this.updateOriginalInput({silent:silent}),this.positionDropdown(),this.trigger("item_remove",value,$item))},createItem:function(input,triggerDropdown){var self=this,caret=self.caretPos,callback=(input=input||(self.$control_input.val()||"").trim(),arguments[arguments.length-1]);if("function"!=typeof callback&&(callback=function(){}),"boolean"!=typeof triggerDropdown&&(triggerDropdown=!0),!self.canCreate(input))return callback(),!1;self.lock();var fn,called,setup="function"==typeof self.settings.create?this.settings.create:function(input){var data={},input=data[self.settings.labelField]=input;if(!self.settings.formatValueToKey||"function"!=typeof self.settings.formatValueToKey||null!=(input=self.settings.formatValueToKey.apply(this,[input]))&&"object"!=typeof input&&"function"!=typeof input)return data[self.settings.valueField]=input,data;throw new Error('Selectize "formatValueToKey" setting must be a function that returns a value other than object or function.')},create=(called=!(fn=function(data){return self.unlock(),!data||"object"!=typeof data||"string"!=typeof(value=hash_key(data[self.settings.valueField]))?callback():(self.setTextboxValue(""),self.addOption(data),self.setCaret(caret),self.addItem(value),self.refreshOptions(triggerDropdown&&"single"!==self.settings.mode),void callback(data));var value}),function(){called||(called=!0,fn.apply(this,arguments))}),setup=setup.apply(this,[input,create]);return void 0!==setup&&create(setup),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var invalid=!this.items.length;this.isInvalid=invalid,this.$control_input.prop("required",invalid),this.$input.prop("required",!invalid)},refreshClasses:function(){var isFull=this.isFull(),isLocked=this.isLocked;this.$wrapper.toggleClass("rtl",this.rtl),this.$control.toggleClass("focus",this.isFocused).toggleClass("disabled",this.isDisabled).toggleClass("required",this.isRequired).toggleClass("invalid",this.isInvalid).toggleClass("locked",isLocked).toggleClass("full",isFull).toggleClass("not-full",!isFull).toggleClass("input-active",this.isFocused&&!this.isInputHidden).toggleClass("dropdown-active",this.isOpen).toggleClass("has-options",!$.isEmptyObject(this.options)).toggleClass("has-items",0<this.items.length),this.$control_input.data("grow",!isFull&&!isLocked)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(opts){var i,n,options,label;if(opts=opts||{},1===this.tagType){for(options=[],i=0,n=this.items.length;i<n;i++)label=this.options[this.items[i]][this.settings.labelField]||"",options.push('<option value="'+escape_html(this.items[i])+'" selected="selected">'+escape_html(label)+"</option>");options.length||this.$input.attr("multiple")||options.push('<option value="" selected="selected"></option>'),this.$input.html(options.join(""))}else this.$input.val(this.getValue()),this.$input.attr("value",this.$input.val());this.isSetup&&!opts.silent&&this.trigger("change",this.$input.val())},updatePlaceholder:function(){var $input;this.settings.placeholder&&($input=this.$control_input,this.items.length?$input.removeAttr("placeholder"):$input.attr("placeholder",this.settings.placeholder),$input.triggerHandler("update",{force:!0}))},open:function(){this.isLocked||this.isOpen||"multi"===this.settings.mode&&this.isFull()||(this.focus(),this.isOpen=!0,this.refreshState(),this.$dropdown.css({visibility:"hidden",display:"block"}),this.positionDropdown(),this.$dropdown.css({visibility:"visible"}),this.trigger("dropdown_open",this.$dropdown))},close:function(){var trigger=this.isOpen;"single"===this.settings.mode&&this.items.length&&(this.hideInput(),this.isBlurring&&this.$control_input.blur()),this.isOpen=!1,this.$dropdown.hide(),this.setActiveOption(null),this.refreshState(),trigger&&this.trigger("dropdown_close",this.$dropdown)},positionDropdown:function(){var $control=this.$control,offset="body"===this.settings.dropdownParent?$control.offset():$control.position();offset.top+=$control.outerHeight(!0),this.$dropdown.css({width:$control[0].getBoundingClientRect().width,top:offset.top,left:offset.left})},clear:function(silent){this.items.length&&(this.$control.children(":not(input)").remove(),this.items=[],this.lastQuery=null,this.setCaret(0),this.setActiveItem(null),this.updatePlaceholder(),this.updateOriginalInput({silent:silent}),this.refreshState(),this.showInput(),this.trigger("clear"))},insertAtCaret:function($el){var caret=Math.min(this.caretPos,this.items.length),$el=$el[0],target=this.buffer||this.$control[0];0===caret?target.insertBefore($el,target.firstChild):target.insertBefore($el,target.childNodes[caret]),this.setCaret(caret+1)},deleteSelection:function(e){var i,n,values,option_select,$tail,direction=e&&8===e.keyCode?-1:1,selection=getSelection(this.$control_input[0]);if(this.$activeOption&&!this.settings.hideSelected&&(option_select=("string"==typeof this.settings.deselectBehavior&&"top"===this.settings.deselectBehavior?this.getFirstOption():this.getAdjacentOption(this.$activeOption,-1)).attr("data-value")),values=[],this.$activeItems.length){for($tail=this.$control.children(".active:"+(0<direction?"last":"first")),$tail=this.$control.children(":not(input)").index($tail),0<direction&&$tail++,i=0,n=this.$activeItems.length;i<n;i++)values.push($(this.$activeItems[i]).attr("data-value"));e&&(e.preventDefault(),e.stopPropagation())}else(this.isFocused||"single"===this.settings.mode)&&this.items.length&&(direction<0&&0===selection.start&&0===selection.length?values.push(this.items[this.caretPos-1]):0<direction&&selection.start===this.$control_input.val().length&&values.push(this.items[this.caretPos]));if(!values.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete.apply(this,[values]))return!1;for(void 0!==$tail&&this.setCaret($tail);values.length;)this.removeItem(values.pop());return this.showInput(),this.positionDropdown(),this.refreshOptions(!0),option_select&&(e=this.getOption(option_select)).length&&this.setActiveOption(e),!0},advanceSelection:function(direction,e){var tail,valueLength,selection;0!==direction&&(this.rtl&&(direction*=-1),tail=0<direction?"last":"first",selection=getSelection(this.$control_input[0]),this.isFocused&&!this.isInputHidden?(valueLength=this.$control_input.val().length,(direction<0?0!==selection.start||0!==selection.length:selection.start!==valueLength)||valueLength||this.advanceCaret(direction,e)):(selection=this.$control.children(".active:"+tail)).length&&(valueLength=this.$control.children(":not(input)").index(selection),this.setActiveItem(null),this.setCaret(0<direction?valueLength+1:valueLength)))},advanceCaret:function(direction,e){var $adj;0!==direction&&(this.isShiftDown?($adj=this.$control_input[0<direction?"next":"prev"]()).length&&(this.hideInput(),this.setActiveItem($adj),e&&e.preventDefault()):this.setCaret(this.caretPos+direction))},setCaret:function(i){if(i="single"===this.settings.mode?this.items.length:Math.max(0,Math.min(this.items.length,i)),!this.isPending)for(var $child,$children=this.$control.children(":not(input)"),j=0,n=$children.length;j<n;j++)$child=$($children[j]).detach(),j<i?this.$control_input.before($child):this.$control.append($child);this.caretPos=i},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){this.$input.prop("disabled",!0),this.$control_input.prop("disabled",!0).prop("tabindex",-1),this.isDisabled=!0,this.lock()},enable:function(){this.$input.prop("disabled",!1),this.$control_input.prop("disabled",!1).prop("tabindex",this.tabIndex),this.isDisabled=!1,this.unlock()},destroy:function(){var eventNS=this.eventNS,revertSettings=this.revertSettings;this.trigger("destroy"),this.off(),this.$wrapper.remove(),this.$dropdown.remove(),this.$input.html("").append(revertSettings.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:revertSettings.tabindex}).show(),this.$control_input.removeData("grow"),this.$input.removeData("selectize"),0==--Selectize.count&&Selectize.$testInput&&(Selectize.$testInput.remove(),Selectize.$testInput=void 0),$(window).off(eventNS),$(document).off(eventNS),$(document.body).off(eventNS),delete this.$input[0].selectize},render:function(templateName,data){var value,id,html="",cache=!1;return(cache="option"!==templateName&&"item"!==templateName?cache:!!(value=hash_key(data[this.settings.valueField])))&&(isset(this.renderCache[templateName])||(this.renderCache[templateName]={}),this.renderCache[templateName].hasOwnProperty(value))?this.renderCache[templateName][value]:(html=$(this.settings.render[templateName].apply(this,[data,escape_html])),"option"===templateName||"option_create"===templateName?data[this.settings.disabledField]||html.attr("data-selectable",""):"optgroup"===templateName&&(id=data[this.settings.optgroupValueField]||"",html.attr("data-group",id),data[this.settings.disabledField]&&html.attr("data-disabled","")),"option"!==templateName&&"item"!==templateName||html.attr("data-value",value||""),cache&&(this.renderCache[templateName][value]=html[0]),html[0])},clearCache:function(templateName){void 0===templateName?this.renderCache={}:delete this.renderCache[templateName]},canCreate:function(input){if(!this.settings.create)return!1;var filter=this.settings.createFilter;return input.length&&("function"!=typeof filter||filter.apply(this,[input]))&&("string"!=typeof filter||new RegExp(filter).test(input))&&(!(filter instanceof RegExp)||filter.test(input))}}),Selectize.count=0,Selectize.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,showAddOptionOnCreate:!0,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!0,preload:!1,allowEmptyOption:!1,showEmptyOptionInDropdown:!1,emptyOptionLabel:"--",closeAfterSelect:!1,scrollDuration:60,deselectBehavior:"previous",loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},$.fn.selectize=function(settings_user){function init_select($input,settings_element){function addOption($option,group){$option=$($option);var arr,value=hash_key($option.val());(value||settings.allowEmptyOption)&&(optionsMap.hasOwnProperty(value)?group&&((arr=optionsMap[value][field_optgroup])?$.isArray(arr)?arr.push(group):optionsMap[value][field_optgroup]=[arr,group]:optionsMap[value][field_optgroup]=group):((arr=readData($option)||{})[field_label]=arr[field_label]||$option.text(),arr[field_value]=arr[field_value]||value,arr[field_disabled]=arr[field_disabled]||$option.prop("disabled"),arr[field_optgroup]=arr[field_optgroup]||group,optionsMap[value]=arr,options.push(arr),$option.is(":selected")&&settings_element.items.push(value)))}var i,n,tagName,$children,options=settings_element.options,optionsMap={},readData=function($el){$el=attr_data&&$el.attr(attr_data);return"string"==typeof $el&&$el.length?JSON.parse($el):null};for(settings_element.maxItems=$input.attr("multiple")?null:1,i=0,n=($children=$input.children()).length;i<n;i++)"optgroup"===(tagName=$children[i].tagName.toLowerCase())?function($optgroup){var i,n,id,optgroup,$options;for((id=($optgroup=$($optgroup)).attr("label"))&&((optgroup=readData($optgroup)||{})[field_optgroup_label]=id,optgroup[field_optgroup_value]=id,optgroup[field_disabled]=$optgroup.prop("disabled"),settings_element.optgroups.push(optgroup)),i=0,n=($options=$("option",$optgroup)).length;i<n;i++)addOption($options[i],id)}($children[i]):"option"===tagName&&addOption($children[i])}var defaults=$.fn.selectize.defaults,settings=$.extend({},defaults,settings_user),attr_data=settings.dataAttr,field_label=settings.labelField,field_value=settings.valueField,field_disabled=settings.disabledField,field_optgroup=settings.optgroupField,field_optgroup_label=settings.optgroupLabelField,field_optgroup_value=settings.optgroupValueField;return this.each(function(){var $input,tag_name,placeholder,input_html;this.selectize||($input=$(this),tag_name=this.tagName.toLowerCase(),(placeholder=$input.attr("placeholder")||$input.attr("data-placeholder"))||settings.allowEmptyOption||(placeholder=$input.children('option[value=""]').text()),settings.allowEmptyOption&&settings.showEmptyOptionInDropdown&&!$input.children('option[value=""]').length&&(input_html=$input.html(),$input.html('<option value="">'+settings.emptyOptionLabel+"</option>"+input_html)),("select"===tag_name?init_select:function($input,settings_element){var i,n,values,option,data_raw=$input.attr(attr_data);if(data_raw)for(settings_element.options=JSON.parse(data_raw),i=0,n=settings_element.options.length;i<n;i++)settings_element.items.push(settings_element.options[i][field_value]);else{data_raw=$.trim($input.val()||"");if(settings.allowEmptyOption||data_raw.length){for(i=0,n=(values=data_raw.split(settings.delimiter)).length;i<n;i++)(option={})[field_label]=values[i],option[field_value]=values[i],settings_element.options.push(option);settings_element.items=values}}})($input,input_html={placeholder:placeholder,options:[],optgroups:[],items:[]}),new Selectize($input,$.extend(!0,{},defaults,input_html,settings_user)))})},$.fn.selectize.defaults=Selectize.defaults,$.fn.selectize.support={validity:SUPPORTS_VALIDITY_API},Selectize.define("auto_position",function(){const POSITION={top:"top",bottom:"bottom"};this.positionDropdown=function(){const $control=this.$control,offset="body"===this.settings.dropdownParent?$control.offset():$control.position();offset.top+=$control.outerHeight(!0);var dropdownHeight=this.$dropdown.prop("scrollHeight")+5,dropdownHeight=this.$control.get(0).getBoundingClientRect().top+dropdownHeight+this.$wrapper.height()>window.innerHeight?POSITION.top:POSITION.bottom,styles={width:$control.outerWidth(),left:offset.left};dropdownHeight===POSITION.top?(Object.assign(styles,{bottom:offset.top,top:"unset",margin:"0 0 5px 0"}),this.$dropdown.addClass("selectize-position-top")):(Object.assign(styles,{top:offset.top,bottom:"unset",margin:"5px 0 0 0"}),this.$dropdown.removeClass("selectize-position-top")),this.$dropdown.css(styles)}}),Selectize.define("auto_select_on_type",function(options){var originalBlur,self=this;self.onBlur=(originalBlur=self.onBlur,function(e){var $matchedItem=self.getFirstItemMatchedByTextContent(self.lastValue,!0);return void 0!==$matchedItem.attr("data-value")&&self.getValue()!==$matchedItem.attr("data-value")&&self.setValue($matchedItem.attr("data-value")),originalBlur.apply(this,arguments)})}),Selectize.define("autofill_disable",function(options){var original,self=this;self.setup=(original=self.setup,function(){original.apply(self,arguments),self.$control_input.attr({autocomplete:"new-password",autofill:"no"})})}),Selectize.define("drag_drop",function(options){if(!$.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');var self,original;"multi"===this.settings.mode&&((self=this).lock=(original=self.lock,function(){var sortable=self.$control.data("sortable");return sortable&&sortable.disable(),original.apply(self,arguments)}),self.unlock=function(){var original=self.unlock;return function(){var sortable=self.$control.data("sortable");return sortable&&sortable.enable(),original.apply(self,arguments)}}(),self.setup=function(){var original=self.setup;return function(){original.apply(this,arguments);var $control=self.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:self.isLocked,start:function(e,ui){ui.placeholder.css("width",ui.helper.css("width")),$control.addClass("dragging")},stop:function(){$control.removeClass("dragging");var active=self.$activeItems?self.$activeItems.slice():null,values=[];$control.children("[data-value]").each(function(){values.push($(this).attr("data-value"))}),self.isFocused=!1,self.setValue(values),self.isFocused=!0,self.setActiveItem(active),self.positionDropdown()}})}}())}),Selectize.define("dropdown_header",function(options){var original,self=this;options=$.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(data){return'<div class="'+data.headerClass+'"><div class="'+data.titleRowClass+'"><span class="'+data.labelClass+'">'+data.title+'</span><a href="javascript:void(0)" class="'+data.closeClass+'">×</a></div></div>'}},options),self.setup=(original=self.setup,function(){original.apply(self,arguments),self.$dropdown_header=$(options.html(options)),self.$dropdown.prepend(self.$dropdown_header)})}),Selectize.define("optgroup_columns",function(options){function equalizeSizes(){var i,height_max,width,width_parent,$optgroups=$("[data-group]",self.$dropdown_content),n=$optgroups.length;if(n&&self.$dropdown_content.width()){if(options.equalizeHeight){for(i=height_max=0;i<n;i++)height_max=Math.max(height_max,$optgroups.eq(i).height());$optgroups.css({height:height_max})}options.equalizeWidth&&(width_parent=self.$dropdown_content.innerWidth()-getScrollbarWidth(),width=Math.round(width_parent/n),$optgroups.css({width:width}),1<n&&(width_parent=width_parent-width*(n-1),$optgroups.eq(n-1).css({width:width_parent})))}}var original,self=this,getScrollbarWidth=(options=$.extend({equalizeWidth:!0,equalizeHeight:!0},options),this.getAdjacentOption=function($option,direction){var $options=$option.closest("[data-group]").find("[data-selectable]"),$option=$options.index($option)+direction;return 0<=$option&&$option<$options.length?$options.eq($option):$()},this.onKeyDown=(original=self.onKeyDown,function(e){var index,$optgroup;if(!this.isOpen||37!==e.keyCode&&39!==e.keyCode)return original.apply(this,arguments);self.ignoreHover=!0,index=($optgroup=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),($optgroup=(e=($optgroup=37===e.keyCode?$optgroup.prev("[data-group]"):$optgroup.next("[data-group]")).find("[data-selectable]")).eq(Math.min(e.length-1,index))).length&&this.setActiveOption($optgroup)}),function(){var div,width=getScrollbarWidth.width,doc=document;return void 0===width&&((div=doc.createElement("div")).innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',div=div.firstChild,doc.body.appendChild(div),width=getScrollbarWidth.width=div.offsetWidth-div.clientWidth,doc.body.removeChild(div)),width});(options.equalizeHeight||options.equalizeWidth)&&(hook.after(this,"positionDropdown",equalizeSizes),hook.after(this,"refreshOptions",equalizeSizes))}),Selectize.define("remove_button",function(options){options=$.extend({label:"×",title:"Remove",className:"remove",append:!0},options),("single"===this.settings.mode?function(thisRef,options){options.className="remove-single";var original,self=thisRef,html='<a href="javascript:void(0)" class="'+options.className+'" tabindex="-1" title="'+escape_html(options.title)+'">'+options.label+"</a>";thisRef.setup=(original=self.setup,function(){var id,render_item;options.append&&(id=$(self.$input.context).attr("id"),$("#"+id),render_item=self.settings.render.item,self.settings.render.item=function(data){return html_container=render_item.apply(thisRef,arguments),html_element=html,$("<span>").append(html_container).append(html_element);var html_container,html_element}),original.apply(thisRef,arguments),thisRef.$control.on("click","."+options.className,function(e){e.preventDefault(),self.isLocked||self.clear()})})}:function(thisRef,options){var original,self=thisRef,html='<a href="javascript:void(0)" class="'+options.className+'" tabindex="-1" title="'+escape_html(options.title)+'">'+options.label+"</a>";thisRef.setup=(original=self.setup,function(){var render_item;options.append&&(render_item=self.settings.render.item,self.settings.render.item=function(data){return html_container=render_item.apply(thisRef,arguments),html_element=html,pos=html_container.search(/(<\/[^>]+>\s*)$/),html_container.substring(0,pos)+html_element+html_container.substring(pos);var html_container,html_element,pos}),original.apply(thisRef,arguments),thisRef.$control.on("click","."+options.className,function(e){if(e.preventDefault(),!self.isLocked)return e=$(e.currentTarget).parent(),self.setActiveItem(e),self.deleteSelection()&&self.setCaret(self.items.length),!1})})})(this,options)}),Selectize.define("restore_on_backspace",function(options){var original,self=this;options.text=options.text||function(option){return option[this.settings.labelField]},this.onKeyDown=(original=self.onKeyDown,function(e){var index;return 8===e.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(index=this.caretPos-1)&&index<this.items.length?(index=this.options[this.items[index]],this.deleteSelection(e)&&(this.setTextboxValue(options.text.apply(this,[index])),this.refreshOptions(!0)),void e.preventDefault()):original.apply(this,arguments)})}),Selectize.define("select_on_focus",function(options){var originalFocus,originalBlur,self=this;self.on("focus",(originalFocus=self.onFocus,function(e){var value=self.getItem(self.getValue()).text();return self.clear(),self.setTextboxValue(value),self.$control_input.select(),setTimeout(function(){self.settings.selectOnTab&&self.setActiveOption(self.getFirstItemMatchedByTextContent(value)),self.settings.score=null},0),originalFocus.apply(this,arguments)})),self.onBlur=(originalBlur=self.onBlur,function(e){return""===self.getValue()&&self.lastValidValue!==self.getValue()&&self.setValue(self.lastValidValue),setTimeout(function(){self.settings.score=function(){return function(){return 1}}},0),originalBlur.apply(this,arguments)}),self.settings.score=function(){return function(){return 1}}}),Selectize.define("tag_limit",function(options){const self=this;options.tagLimit=options.tagLimit,this.onBlur=function(){const original=self.onBlur;return function(e){if(original.apply(this,e),e){const $control=this.$control,$items=$control.find(".item"),limit=options.tagLimit;void 0===limit||$items.length<=limit||($items.toArray().forEach(function(item,index){index<limit||$(item).hide()}),$control.append("<span><b>"+($items.length-limit)+"</b></span>"))}}}(),this.onFocus=function(){const original=self.onFocus;return function(e){if(original.apply(this,e),e){const $control=this.$control,$items=$control.find(".item");$items.show(),$control.find("span").remove()}}}()}),Selectize});Selectize.define("click2deselect",function(options){var self=this;var setup=self.setup;this.setup=function(){setup.apply(self,arguments);self.$dropdown.on("click","[data-selectable]",function(e){let value=this.getAttribute("data-value");if(this.classList.contains("checked")){this.classList.remove("checked");self.removeItem(value);self.refreshItems();self.refreshOptions()}else{this.classList.add("checked")}return false})}});
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: bookings, calendar, tickets, events, buddypress, event management, google
|
|
5 |
Text Domain: events-manager
|
6 |
Requires at least: 5.2
|
7 |
Tested up to: 6.0.1
|
8 |
-
Stable tag: 6.1.2
|
9 |
Requires PHP: 5.3
|
10 |
|
11 |
Fully featured event registration management including recurring events, locations management, calendar, Google map integration, booking management
|
@@ -135,9 +135,6 @@ See our [FAQ](http://wp-events-plugin.com/documentation/faq/) page, which is upd
|
|
135 |
15. Clean forms for submitting and managing events, as well as booking events for users.
|
136 |
|
137 |
== Changelog ==
|
138 |
-
= 6.1.2.1 =
|
139 |
-
* fixed php 8.1 fatal error
|
140 |
-
|
141 |
= 6.1.2 =
|
142 |
* changed EM_Tickets, EM_Bookings and EM_Ticket so event object is stored as referece so get_event() all reference the same parent object,
|
143 |
* changed em_bookings_ticket_exists hook for when tickets don't exist, $EM_Ticket is pssed as a blank EM_Ticket with the requested $ticket_id
|
5 |
Text Domain: events-manager
|
6 |
Requires at least: 5.2
|
7 |
Tested up to: 6.0.1
|
8 |
+
Stable tag: 6.1.2
|
9 |
Requires PHP: 5.3
|
10 |
|
11 |
Fully featured event registration management including recurring events, locations management, calendar, Google map integration, booking management
|
135 |
15. Clean forms for submitting and managing events, as well as booking events for users.
|
136 |
|
137 |
== Changelog ==
|
|
|
|
|
|
|
138 |
= 6.1.2 =
|
139 |
* changed EM_Tickets, EM_Bookings and EM_Ticket so event object is stored as referece so get_event() all reference the same parent object,
|
140 |
* changed em_bookings_ticket_exists hook for when tickets don't exist, $EM_Ticket is pssed as a blank EM_Ticket with the requested $ticket_id
|
trunk/admin/bookings/em-cancelled.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
4 |
+
*
|
5 |
+
* @param int $event_id
|
6 |
+
*/
|
7 |
+
function em_bookings_cancelled_table(){
|
8 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
9 |
+
|
10 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_cancelled_table' );
|
11 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
13 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
15 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
16 |
+
|
17 |
+
if( is_object($EM_Ticket) ){
|
18 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_cancelled_bookings();
|
19 |
+
}else{
|
20 |
+
if( is_object($EM_Event) ){
|
21 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_cancelled_bookings();
|
22 |
+
}else{
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
27 |
+
?>
|
28 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
29 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
30 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
31 |
+
<!--
|
32 |
+
<ul class="subsubsub">
|
33 |
+
<li>
|
34 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
35 |
+
</li>
|
36 |
+
</ul>
|
37 |
+
<p class="search-box">
|
38 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'events-manager'); ?>:</label>
|
39 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
40 |
+
<input type="submit" value="<?php _e('Search', 'events-manager'); ?>" class="button" />
|
41 |
+
</p>
|
42 |
+
-->
|
43 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
44 |
+
<div class='tablenav'>
|
45 |
+
<!--
|
46 |
+
<div class="alignleft actions">
|
47 |
+
<select name="action">
|
48 |
+
<option value="-1" selected="selected">
|
49 |
+
<?php _e('Bulk Actions', 'events-manager'); ?>
|
50 |
+
</option>
|
51 |
+
<option value="approve">
|
52 |
+
<?php _e('Approve', 'events-manager'); ?>
|
53 |
+
</option>
|
54 |
+
<option value="decline">
|
55 |
+
<?php _e('Decline', 'events-manager'); ?>
|
56 |
+
</option>
|
57 |
+
</select>
|
58 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
59 |
+
</div>
|
60 |
+
-->
|
61 |
+
<!--
|
62 |
+
<div class="view-switch">
|
63 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
64 |
+
</div>
|
65 |
+
-->
|
66 |
+
<?php
|
67 |
+
if ( $bookings_count >= $limit ) {
|
68 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
69 |
+
echo $bookings_nav;
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
<div class="clear"></div>
|
73 |
+
</div>
|
74 |
+
<?php endif; ?>
|
75 |
+
<div class="clear"></div>
|
76 |
+
<?php if( $bookings_count > 0 ): ?>
|
77 |
+
<div class='table-wrap'>
|
78 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
79 |
+
<thead>
|
80 |
+
<tr>
|
81 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
82 |
+
<input class='select-all' type="checkbox" value='1' />
|
83 |
+
</th>
|
84 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'events-manager'); ?></th>
|
85 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'events-manager'); ?></th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'events-manager'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'events-manager'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'> </th>
|
89 |
+
</tr>
|
90 |
+
</thead>
|
91 |
+
<tbody>
|
92 |
+
<?php
|
93 |
+
$rowno = 0;
|
94 |
+
$event_count = 0;
|
95 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
96 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
97 |
+
$rowno++;
|
98 |
+
?>
|
99 |
+
<tr>
|
100 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
101 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
102 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
103 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
104 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
+
<td>
|
106 |
+
<?php
|
107 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
108 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
+
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
110 |
+
?>
|
111 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','events-manager'); ?></a> |
|
112 |
+
<a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','events-manager'); ?></a> |
|
113 |
+
<a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','events-manager'); ?></a>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
$event_count++;
|
119 |
+
}
|
120 |
+
?>
|
121 |
+
</tbody>
|
122 |
+
</table>
|
123 |
+
</div>
|
124 |
+
<?php else: ?>
|
125 |
+
<?php _e('No cancelled bookings.', 'events-manager'); ?>
|
126 |
+
<?php endif; ?>
|
127 |
+
</form>
|
128 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
129 |
+
<div class='tablenav'>
|
130 |
+
<?php echo $bookings_nav; ?>
|
131 |
+
<div class="clear"></div>
|
132 |
+
</div>
|
133 |
+
<?php endif; ?>
|
134 |
+
</div>
|
135 |
+
<?php
|
136 |
+
}
|
137 |
+
?>
|
trunk/admin/bookings/em-confirmed.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
5 |
+
*
|
6 |
+
* @param int $event_id
|
7 |
+
*/
|
8 |
+
function em_bookings_confirmed_table(){
|
9 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
10 |
+
|
11 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
12 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
13 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
14 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
15 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
16 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
17 |
+
|
18 |
+
if( is_object($EM_Ticket) ){
|
19 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_bookings();
|
20 |
+
}else{
|
21 |
+
if( is_object($EM_Event) ){
|
22 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_bookings();
|
23 |
+
}else{
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
28 |
+
?>
|
29 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
30 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
31 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
32 |
+
<!--
|
33 |
+
<ul class="subsubsub">
|
34 |
+
<li>
|
35 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
36 |
+
</li>
|
37 |
+
</ul>
|
38 |
+
<p class="search-box">
|
39 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'events-manager'); ?>:</label>
|
40 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
41 |
+
<input type="submit" value="<?php _e('Search', 'events-manager'); ?>" class="button" />
|
42 |
+
</p>
|
43 |
+
-->
|
44 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
45 |
+
<div class='tablenav'>
|
46 |
+
<!--
|
47 |
+
<div class="alignleft actions">
|
48 |
+
<select name="action">
|
49 |
+
<option value="-1" selected="selected">
|
50 |
+
<?php _e('Bulk Actions', 'events-manager'); ?>
|
51 |
+
</option>
|
52 |
+
<option value="approve">
|
53 |
+
<?php _e('Approve', 'events-manager'); ?>
|
54 |
+
</option>
|
55 |
+
<option value="decline">
|
56 |
+
<?php _e('Decline', 'events-manager'); ?>
|
57 |
+
</option>
|
58 |
+
</select>
|
59 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
60 |
+
</div>
|
61 |
+
-->
|
62 |
+
<!--
|
63 |
+
<div class="view-switch">
|
64 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
65 |
+
</div>
|
66 |
+
-->
|
67 |
+
<?php
|
68 |
+
if ( $bookings_count >= $limit ) {
|
69 |
+
$bookings_nav = em_admin_paginate($bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
70 |
+
echo $bookings_nav;
|
71 |
+
}
|
72 |
+
?>
|
73 |
+
<div class="clear"></div>
|
74 |
+
</div>
|
75 |
+
<?php endif; ?>
|
76 |
+
<div class="clear"></div>
|
77 |
+
<?php if( $bookings_count > 0 ): ?>
|
78 |
+
<div class='table-wrap'>
|
79 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
80 |
+
<thead>
|
81 |
+
<tr>
|
82 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
83 |
+
<input class='select-all' type="checkbox" value='1' />
|
84 |
+
</th>
|
85 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'events-manager'); ?></th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'events-manager'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'events-manager'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'events-manager'); ?></th>
|
89 |
+
<th class='manage-column' scope='col'> </th>
|
90 |
+
</tr>
|
91 |
+
</thead>
|
92 |
+
<tbody>
|
93 |
+
<?php
|
94 |
+
$rowno = 0;
|
95 |
+
$event_count = 0;
|
96 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
97 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
98 |
+
$rowno++;
|
99 |
+
?>
|
100 |
+
<tr>
|
101 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
102 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
103 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
104 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
105 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
106 |
+
<td>
|
107 |
+
<?php
|
108 |
+
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
+
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
110 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
111 |
+
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
112 |
+
?>
|
113 |
+
<?php if( current_user_can('manage_bookings') && get_option('dbem_bookings_approval') ): ?>
|
114 |
+
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','events-manager'); ?></a> |
|
115 |
+
<?php else: ?>
|
116 |
+
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','events-manager'); ?></a> |
|
117 |
+
<?php endif; ?>
|
118 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','events-manager'); ?></a></span> |
|
119 |
+
<a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','events-manager'); ?></a>
|
120 |
+
</td>
|
121 |
+
</tr>
|
122 |
+
<?php
|
123 |
+
}
|
124 |
+
$event_count++;
|
125 |
+
}
|
126 |
+
?>
|
127 |
+
</tbody>
|
128 |
+
</table>
|
129 |
+
</div>
|
130 |
+
<?php else: ?>
|
131 |
+
<?php _e('No confirmed bookings.', 'events-manager'); ?>
|
132 |
+
<?php endif; ?>
|
133 |
+
</form>
|
134 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
135 |
+
<div class='tablenav'>
|
136 |
+
<?php echo $bookings_nav; ?>
|
137 |
+
<div class="clear"></div>
|
138 |
+
</div>
|
139 |
+
<?php endif; ?>
|
140 |
+
</div>
|
141 |
+
<?php
|
142 |
+
|
143 |
+
}
|
144 |
+
?>
|
trunk/admin/bookings/em-events.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Determines whether to show event page or events page, and saves any updates to the event or events
|
5 |
+
* @return null
|
6 |
+
*/
|
7 |
+
function em_bookings_events_table() {
|
8 |
+
//TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
|
9 |
+
global $wpdb;
|
10 |
+
|
11 |
+
$scope_names = array (
|
12 |
+
'past' => __ ( 'Past events', 'events-manager'),
|
13 |
+
'all' => __ ( 'All events', 'events-manager'),
|
14 |
+
'future' => __ ( 'Future events', 'events-manager')
|
15 |
+
);
|
16 |
+
|
17 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_events_table' );
|
18 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
19 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
20 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
21 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
22 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
23 |
+
$scope = ( $action_scope && !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
|
24 |
+
|
25 |
+
// No action, only showing the events list
|
26 |
+
switch ($scope) {
|
27 |
+
case "past" :
|
28 |
+
$title = __ ( 'Past Events', 'events-manager');
|
29 |
+
break;
|
30 |
+
case "all" :
|
31 |
+
$title = __ ( 'All Events', 'events-manager');
|
32 |
+
break;
|
33 |
+
default :
|
34 |
+
$title = __ ( 'Future Events', 'events-manager');
|
35 |
+
$scope = "future";
|
36 |
+
}
|
37 |
+
$owner = !current_user_can('manage_others_bookings') ? get_current_user_id() : false;
|
38 |
+
$events = EM_Events::get( array('scope'=>$scope, 'limit'=>$limit, 'offset' => $offset, 'order'=>$order, 'orderby'=>'event_start', 'bookings'=>true, 'owner' => $owner, 'pagination' => 1 ) );
|
39 |
+
$events_count = EM_Events::$num_rows_found;
|
40 |
+
|
41 |
+
$use_events_end = get_option ( 'dbem_use_event_end' );
|
42 |
+
?>
|
43 |
+
<div class="wrap em_bookings_events_table em_obj">
|
44 |
+
<form id="posts-filter" action="" method="get">
|
45 |
+
<input type="hidden" name="em_obj" value="em_bookings_events_table" />
|
46 |
+
<?php if(!empty($_GET['page'])): ?>
|
47 |
+
<input type='hidden' name='page' value='events-manager-bookings' />
|
48 |
+
<?php endif; ?>
|
49 |
+
<div class="tablenav">
|
50 |
+
<div class="alignleft actions">
|
51 |
+
<!--
|
52 |
+
<select name="action">
|
53 |
+
<option value="-1" selected="selected"><?php esc_html_e( 'Bulk Actions' ); ?></option>
|
54 |
+
<option value="deleteEvents"><?php esc_html_e( 'Delete selected','events-manager'); ?></option>
|
55 |
+
</select>
|
56 |
+
<input type="submit" value="<?php esc_html_e( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
|
57 |
+
-->
|
58 |
+
<select name="scope">
|
59 |
+
<?php
|
60 |
+
foreach ( $scope_names as $key => $value ) {
|
61 |
+
$selected = "";
|
62 |
+
if ($key == $scope)
|
63 |
+
$selected = "selected='selected'";
|
64 |
+
echo "<option value='$key' $selected>$value</option> ";
|
65 |
+
}
|
66 |
+
?>
|
67 |
+
</select>
|
68 |
+
<input id="post-query-submit" class="button-secondary" type="submit" value="<?php esc_html_e( 'Filter' )?>" />
|
69 |
+
</div>
|
70 |
+
<!--
|
71 |
+
<div class="view-switch">
|
72 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
73 |
+
</div>
|
74 |
+
-->
|
75 |
+
<?php
|
76 |
+
if ( $events_count >= $limit ) {
|
77 |
+
$events_nav = em_admin_paginate( $events_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_events_table'));
|
78 |
+
echo $events_nav;
|
79 |
+
}
|
80 |
+
?>
|
81 |
+
</div>
|
82 |
+
<div class="clear"></div>
|
83 |
+
<?php
|
84 |
+
if (empty ( $events )) {
|
85 |
+
// TODO localize
|
86 |
+
_e ( 'no events','events-manager');
|
87 |
+
} else {
|
88 |
+
?>
|
89 |
+
<div class='table-wrap'>
|
90 |
+
<table class="widefat">
|
91 |
+
<thead>
|
92 |
+
<tr>
|
93 |
+
<th><?php esc_html_e( 'Event', 'events-manager'); ?></th>
|
94 |
+
<th><?php esc_html_e( 'Date and time', 'events-manager'); ?></th>
|
95 |
+
</tr>
|
96 |
+
</thead>
|
97 |
+
<tbody>
|
98 |
+
<?php
|
99 |
+
$rowno = 0;
|
100 |
+
foreach ( $events as $EM_Event ) {
|
101 |
+
/* @var $event EM_Event */
|
102 |
+
$rowno++;
|
103 |
+
$class = ($rowno % 2) ? ' class="alternate"' : '';
|
104 |
+
$style = "";
|
105 |
+
|
106 |
+
if ($EM_Event->start()->getTimestamp() < time() && $EM_Event->end()->getTimestamp() < time()){
|
107 |
+
$style = "style ='background-color: #FADDB7;'";
|
108 |
+
}
|
109 |
+
?>
|
110 |
+
<tr <?php echo "$class $style"; ?>>
|
111 |
+
<td>
|
112 |
+
<strong>
|
113 |
+
<?php echo $EM_Event->output('#_BOOKINGSLINK'); ?>
|
114 |
+
</strong>
|
115 |
+
–
|
116 |
+
<?php esc_html_e("Booked Spaces",'events-manager') ?>: <?php echo $EM_Event->get_bookings()->get_booked_spaces()."/".$EM_Event->get_spaces() ?>
|
117 |
+
<?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
|
118 |
+
| <?php esc_html_e("Pending",'events-manager') ?>: <?php echo $EM_Event->get_bookings()->get_pending_spaces(); ?>
|
119 |
+
<?php endif; ?>
|
120 |
+
</td>
|
121 |
+
|
122 |
+
<td>
|
123 |
+
<?php echo $EM_Event->output_dates(false, " - "). ' @ ' . $EM_Event->output_times(false, ' - '); ?>
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
<?php
|
127 |
+
}
|
128 |
+
?>
|
129 |
+
</tbody>
|
130 |
+
</table>
|
131 |
+
</div>
|
132 |
+
<?php
|
133 |
+
} // end of table
|
134 |
+
?>
|
135 |
+
<div class='tablenav'>
|
136 |
+
<div class="alignleft actions">
|
137 |
+
<br class='clear' />
|
138 |
+
</div>
|
139 |
+
<?php if (!empty($events_nav) && $events_count >= $limit ) : ?>
|
140 |
+
<div class="tablenav-pages">
|
141 |
+
<?php
|
142 |
+
echo $events_nav;
|
143 |
+
?>
|
144 |
+
</div>
|
145 |
+
<?php endif; ?>
|
146 |
+
<br class='clear' />
|
147 |
+
</div>
|
148 |
+
</form>
|
149 |
+
</div>
|
150 |
+
<?php
|
151 |
+
}
|
152 |
+
|
153 |
+
?>
|
trunk/admin/bookings/em-pending.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates a "widget" table of pending bookings with some quick admin operation options.
|
5 |
+
* If event id supplied then only pending bookings for that event will show.
|
6 |
+
*
|
7 |
+
* @param int $event_id
|
8 |
+
*/
|
9 |
+
function em_bookings_pending_table($event_id = false){
|
10 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
11 |
+
|
12 |
+
if( get_option('dbem_bookings_approval') == 0 ){
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_pending_table' );
|
17 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
18 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
19 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
20 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
21 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
22 |
+
|
23 |
+
if( is_object($EM_Ticket) ){
|
24 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_pending_bookings();
|
25 |
+
}else{
|
26 |
+
if( is_object($EM_Event) ){
|
27 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_pending_bookings();
|
28 |
+
}else{
|
29 |
+
//To optimize performance, we can do one query here for all pending bookings to show.
|
30 |
+
$EM_Bookings = EM_Bookings::get(array('status'=>0));
|
31 |
+
$events = array();
|
32 |
+
//Now let's create events and bookings for this:
|
33 |
+
foreach($EM_Bookings->bookings as $EM_Booking){
|
34 |
+
//create event
|
35 |
+
if( !array_key_exists($EM_Booking->event_id,$events) ){
|
36 |
+
$events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
42 |
+
?>
|
43 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
44 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
45 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
46 |
+
<!--
|
47 |
+
<ul class="subsubsub">
|
48 |
+
<li>
|
49 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
50 |
+
</li>
|
51 |
+
</ul>
|
52 |
+
<p class="search-box">
|
53 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'events-manager'); ?>:</label>
|
54 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
55 |
+
<input type="submit" value="<?php _e('Search', 'events-manager'); ?>" class="button" />
|
56 |
+
</p>
|
57 |
+
-->
|
58 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
59 |
+
<div class='tablenav'>
|
60 |
+
<!--
|
61 |
+
<div class="alignleft actions">
|
62 |
+
<select name="action">
|
63 |
+
<option value="-1" selected="selected">
|
64 |
+
<?php _e('Bulk Actions', 'events-manager'); ?>
|
65 |
+
</option>
|
66 |
+
<option value="approve">
|
67 |
+
<?php _e('Approve', 'events-manager'); ?>
|
68 |
+
</option>
|
69 |
+
<option value="decline">
|
70 |
+
<?php _e('Decline', 'events-manager'); ?>
|
71 |
+
</option>
|
72 |
+
</select>
|
73 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
74 |
+
</div>
|
75 |
+
-->
|
76 |
+
<!--
|
77 |
+
<div class="view-switch">
|
78 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
79 |
+
</div>
|
80 |
+
-->
|
81 |
+
<?php
|
82 |
+
if ( $bookings_count >= $limit ) {
|
83 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_pending_table'));
|
84 |
+
echo $bookings_nav;
|
85 |
+
}
|
86 |
+
?>
|
87 |
+
<div class="clear"></div>
|
88 |
+
</div>
|
89 |
+
<?php endif; ?>
|
90 |
+
<div class="clear"></div>
|
91 |
+
<?php if( $bookings_count > 0 ): ?>
|
92 |
+
<div class='table-wrap'>
|
93 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
94 |
+
<thead>
|
95 |
+
<tr>
|
96 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
97 |
+
<input class='select-all' type="checkbox" value='1' />
|
98 |
+
</th>
|
99 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'events-manager'); ?></th>
|
100 |
+
<?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
|
101 |
+
<th class='manage-column' scope="col"><?php _e('Event', 'events-manager'); ?></th>
|
102 |
+
<?php endif; ?>
|
103 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'events-manager'); ?></th>
|
104 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'events-manager'); ?></th>
|
105 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'events-manager'); ?></th>
|
106 |
+
<th class='manage-column' scope='col'> </th>
|
107 |
+
</tr>
|
108 |
+
</thead>
|
109 |
+
<tbody>
|
110 |
+
<?php
|
111 |
+
$rowno = 0;
|
112 |
+
$event_count = 0;
|
113 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
114 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
115 |
+
$rowno++;
|
116 |
+
?>
|
117 |
+
<tr>
|
118 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
119 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
120 |
+
<?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
|
121 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&event_id=<?php echo $EM_Booking->event_id; ?>"><?php echo $events[$EM_Booking->event_id]->name ?></a></td>
|
122 |
+
<?php endif; ?>
|
123 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
124 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
125 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
126 |
+
<td>
|
127 |
+
<?php
|
128 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
129 |
+
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
130 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
131 |
+
?>
|
132 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','events-manager'); ?></a> |
|
133 |
+
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','events-manager'); ?></a> |
|
134 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','events-manager'); ?></a></span> |
|
135 |
+
<a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&booking_id=<?php echo $EM_Booking->booking_id; ?>"><?php _e('Edit/View','events-manager'); ?></a>
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
<?php
|
139 |
+
}
|
140 |
+
$event_count++;
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
</tbody>
|
144 |
+
</table>
|
145 |
+
</div>
|
146 |
+
<?php else: ?>
|
147 |
+
<?php _e('No pending bookings.', 'events-manager'); ?>
|
148 |
+
<?php endif; ?>
|
149 |
+
</form>
|
150 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
151 |
+
<div class='tablenav'>
|
152 |
+
<?php echo $bookings_nav; ?>
|
153 |
+
<div class="clear"></div>
|
154 |
+
</div>
|
155 |
+
<?php endif; ?>
|
156 |
+
</div>
|
157 |
+
<?php
|
158 |
+
}
|
159 |
+
?>
|
trunk/admin/bookings/em-person.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
5 |
+
*
|
6 |
+
* @param int $event_id
|
7 |
+
*/
|
8 |
+
function em_bookings_person_table(){
|
9 |
+
global $wpdb, $current_user,$EM_Person;
|
10 |
+
if(!is_object($EM_Person)){
|
11 |
+
return false;
|
12 |
+
}
|
13 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
14 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
15 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
16 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
17 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
18 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
19 |
+
|
20 |
+
$bookings = $EM_Person->get_bookings();
|
21 |
+
$bookings_count = count($bookings);
|
22 |
+
if($bookings_count > 0){
|
23 |
+
//Get events here in one query to speed things up
|
24 |
+
foreach($bookings as $EM_Booking){
|
25 |
+
$event_ids[] = $EM_Booking->event_id;
|
26 |
+
}
|
27 |
+
$events = EM_Events::get($event_ids);
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
31 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
32 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
33 |
+
<!--
|
34 |
+
<ul class="subsubsub">
|
35 |
+
<li>
|
36 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
37 |
+
</li>
|
38 |
+
</ul>
|
39 |
+
<p class="search-box">
|
40 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'events-manager'); ?>:</label>
|
41 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
42 |
+
<input type="submit" value="<?php _e('Search', 'events-manager'); ?>" class="button" />
|
43 |
+
</p>
|
44 |
+
-->
|
45 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
46 |
+
<div class='tablenav'>
|
47 |
+
<!--
|
48 |
+
<div class="alignleft actions">
|
49 |
+
<select name="action">
|
50 |
+
<option value="-1" selected="selected">
|
51 |
+
<?php _e('Bulk Actions', 'events-manager'); ?>
|
52 |
+
</option>
|
53 |
+
<option value="approve">
|
54 |
+
<?php _e('Approve', 'events-manager'); ?>
|
55 |
+
</option>
|
56 |
+
<option value="decline">
|
57 |
+
<?php _e('Decline', 'events-manager'); ?>
|
58 |
+
</option>
|
59 |
+
</select>
|
60 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
61 |
+
</div>
|
62 |
+
-->
|
63 |
+
<!--
|
64 |
+
<div class="view-switch">
|
65 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
66 |
+
</div>
|
67 |
+
-->
|
68 |
+
<?php
|
69 |
+
if ( $bookings_count >= $limit ) {
|
70 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
71 |
+
echo $bookings_nav;
|
72 |
+
}
|
73 |
+
?>
|
74 |
+
<div class="clear"></div>
|
75 |
+
</div>
|
76 |
+
<?php endif; ?>
|
77 |
+
<div class="clear"></div>
|
78 |
+
<?php if( $bookings_count > 0 ): ?>
|
79 |
+
<div class='table-wrap'>
|
80 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
81 |
+
<thead>
|
82 |
+
<tr>
|
83 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
84 |
+
<input class='select-all' type="checkbox" value='1' />
|
85 |
+
</th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('Event', 'events-manager'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'events-manager'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'><?php _e('Status', 'events-manager'); ?></th>
|
89 |
+
<th class='manage-column' scope='col'> </th>
|
90 |
+
</tr>
|
91 |
+
</thead>
|
92 |
+
<tbody>
|
93 |
+
<?php
|
94 |
+
$rowno = 0;
|
95 |
+
$event_count = 0;
|
96 |
+
foreach ($bookings as $EM_Booking) {
|
97 |
+
$EM_Event = $events[$EM_Booking->event_id];
|
98 |
+
if( $EM_Event->can_manage('edit_events','edit_others_events') && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
99 |
+
$rowno++;
|
100 |
+
?>
|
101 |
+
<tr>
|
102 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
103 |
+
<td><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&event_id=<?php echo $EM_Event->event_id ?>"><?php echo ($EM_Event->event_name); ?></a></td>
|
104 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
+
<td><?php echo $EM_Booking->status_array[$EM_Booking->booking_status]; ?>
|
106 |
+
</td>
|
107 |
+
<td>
|
108 |
+
<?php
|
109 |
+
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->booking_id));
|
110 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
111 |
+
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
|
112 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
113 |
+
?>
|
114 |
+
<?php if( get_option('dbem_bookings_approval') && ($EM_Booking->booking_status == 0 ) ): ?>
|
115 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','events-manager'); ?></a> |
|
116 |
+
<?php endif; ?>
|
117 |
+
<?php if( get_option('dbem_bookings_approval') && $EM_Booking->booking_status == 1 ): ?>
|
118 |
+
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','events-manager'); ?></a> |
|
119 |
+
<?php endif; ?>
|
120 |
+
<?php if( $EM_Booking->booking_status == 2 ): ?>
|
121 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','events-manager'); ?></a> |
|
122 |
+
<?php endif; ?>
|
123 |
+
<?php if( $EM_Booking->booking_status == 0 || $EM_Booking->booking_status == 1 ): ?>
|
124 |
+
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','events-manager'); ?></a> |
|
125 |
+
<?php endif; ?>
|
126 |
+
<a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&booking_id=<?php echo $EM_Booking->booking_id; ?>"><?php _e('Edit/View','events-manager'); ?></a> |
|
127 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','events-manager'); ?></a></span>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
$event_count++;
|
133 |
+
}
|
134 |
+
?>
|
135 |
+
</tbody>
|
136 |
+
</table>
|
137 |
+
</div>
|
138 |
+
<?php else: ?>
|
139 |
+
<?php _e('No confirmed bookings.', 'events-manager'); ?>
|
140 |
+
<?php endif; ?>
|
141 |
+
</form>
|
142 |
+
<?php if( !empty($bookings_nav) && $bookings >= $limit ) : ?>
|
143 |
+
<div class='tablenav'>
|
144 |
+
<?php echo $bookings_nav; ?>
|
145 |
+
<div class="clear"></div>
|
146 |
+
</div>
|
147 |
+
<?php endif; ?>
|
148 |
+
</div>
|
149 |
+
<?php
|
150 |
+
|
151 |
+
}
|
152 |
+
?>
|
trunk/admin/bookings/em-rejected.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generates a "widget" table of confirmed bookings for a specific event.
|
4 |
+
*
|
5 |
+
* @param int $event_id
|
6 |
+
*/
|
7 |
+
function em_bookings_rejected_table(){
|
8 |
+
global $EM_Event, $EM_Ticket, $wpdb, $current_user;
|
9 |
+
|
10 |
+
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
|
11 |
+
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
|
12 |
+
$order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
|
13 |
+
$limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
|
14 |
+
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
|
15 |
+
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
|
16 |
+
|
17 |
+
if( is_object($EM_Ticket) ){
|
18 |
+
$EM_Bookings = $EM_Ticket->get_bookings()->get_rejected_bookings();
|
19 |
+
}else{
|
20 |
+
if( is_object($EM_Event) ){
|
21 |
+
$EM_Bookings = $EM_Event->get_bookings()->get_rejected_bookings();
|
22 |
+
}else{
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
$bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
|
27 |
+
?>
|
28 |
+
<div class='wrap em_bookings_pending_table em_obj'>
|
29 |
+
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
|
30 |
+
<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
|
31 |
+
<!--
|
32 |
+
<ul class="subsubsub">
|
33 |
+
<li>
|
34 |
+
<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
|
35 |
+
</li>
|
36 |
+
</ul>
|
37 |
+
<p class="search-box">
|
38 |
+
<label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'events-manager'); ?>:</label>
|
39 |
+
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? esc_attr($_GET['em_search']):''; ?>" />
|
40 |
+
<input type="submit" value="<?php _e('Search', 'events-manager'); ?>" class="button" />
|
41 |
+
</p>
|
42 |
+
-->
|
43 |
+
<?php if ( $bookings_count >= $limit ) : ?>
|
44 |
+
<div class='tablenav'>
|
45 |
+
<!--
|
46 |
+
<div class="alignleft actions">
|
47 |
+
<select name="action">
|
48 |
+
<option value="-1" selected="selected">
|
49 |
+
<?php _e('Bulk Actions', 'events-manager'); ?>
|
50 |
+
</option>
|
51 |
+
<option value="approve">
|
52 |
+
<?php _e('Approve', 'events-manager'); ?>
|
53 |
+
</option>
|
54 |
+
<option value="decline">
|
55 |
+
<?php _e('Decline', 'events-manager'); ?>
|
56 |
+
</option>
|
57 |
+
</select>
|
58 |
+
<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
|
59 |
+
</div>
|
60 |
+
-->
|
61 |
+
<!--
|
62 |
+
<div class="view-switch">
|
63 |
+
<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
|
64 |
+
</div>
|
65 |
+
-->
|
66 |
+
<?php
|
67 |
+
if ( $bookings_count >= $limit ) {
|
68 |
+
$bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
|
69 |
+
echo $bookings_nav;
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
<div class="clear"></div>
|
73 |
+
</div>
|
74 |
+
<?php endif; ?>
|
75 |
+
<div class="clear"></div>
|
76 |
+
<?php if( $bookings_count > 0 ): ?>
|
77 |
+
<div class='table-wrap'>
|
78 |
+
<table id='dbem-bookings-table' class='widefat post '>
|
79 |
+
<thead>
|
80 |
+
<tr>
|
81 |
+
<th class='manage-column column-cb check-column' scope='col'>
|
82 |
+
<input class='select-all' type="checkbox" value='1' />
|
83 |
+
</th>
|
84 |
+
<th class='manage-column' scope='col'><?php _e('Booker', 'events-manager'); ?></th>
|
85 |
+
<th class='manage-column' scope='col'><?php _e('E-mail', 'events-manager'); ?></th>
|
86 |
+
<th class='manage-column' scope='col'><?php _e('Phone number', 'events-manager'); ?></th>
|
87 |
+
<th class='manage-column' scope='col'><?php _e('Spaces', 'events-manager'); ?></th>
|
88 |
+
<th class='manage-column' scope='col'> </th>
|
89 |
+
</tr>
|
90 |
+
</thead>
|
91 |
+
<tbody>
|
92 |
+
<?php
|
93 |
+
$rowno = 0;
|
94 |
+
$event_count = 0;
|
95 |
+
foreach ($EM_Bookings->bookings as $EM_Booking) {
|
96 |
+
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
|
97 |
+
$rowno++;
|
98 |
+
?>
|
99 |
+
<tr>
|
100 |
+
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->booking_id ?>' name='bookings[]'/></th>
|
101 |
+
<td><a href="<?php echo EM_ADMIN_URL; ?>&page=events-manager-bookings&person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
|
102 |
+
<td><?php echo $EM_Booking->person->user_email ?></td>
|
103 |
+
<td><?php echo $EM_Booking->person->phone ?></td>
|
104 |
+
<td><?php echo $EM_Booking->get_spaces() ?></td>
|
105 |
+
<td>
|
106 |
+
<?php
|
107 |
+
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
|
108 |
+
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
|
109 |
+
$edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->booking_id, 'em_ajax'=>null, 'em_obj'=>null));
|
110 |
+
?>
|
111 |
+
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','events-manager'); ?></a> |
|
112 |
+
<a class="em-bookings-edit" href="<?php echo $edit_url ?>"><?php _e('Edit/View','events-manager'); ?></a> |
|
113 |
+
<span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','events-manager'); ?></a></span>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<?php
|
117 |
+
}
|
118 |
+
$event_count++;
|
119 |
+
}
|
120 |
+
?>
|
121 |
+
</tbody>
|
122 |
+
</table>
|
123 |
+
</div>
|
124 |
+
<?php else: ?>
|
125 |
+
<?php _e('No rejected bookings.', 'events-manager'); ?>
|
126 |
+
<?php endif; ?>
|
127 |
+
</form>
|
128 |
+
<?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
|
129 |
+
<div class='tablenav'>
|
130 |
+
<?php echo $bookings_nav; ?>
|
131 |
+
<div class="clear"></div>
|
132 |
+
</div>
|
133 |
+
<?php endif; ?>
|
134 |
+
</div>
|
135 |
+
<?php
|
136 |
+
}
|
137 |
+
?>
|
trunk/admin/em-admin.php
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//Admin functions
|
3 |
+
function em_admin_menu(){
|
4 |
+
global $menu, $submenu, $pagenow;
|
5 |
+
//Count pending bookings
|
6 |
+
if( get_option('dbem_rsvp_enabled') ){
|
7 |
+
$bookings_num = '';
|
8 |
+
$bookings_pending_count = apply_filters('em_bookings_pending_count',0);
|
9 |
+
if( get_option('dbem_bookings_approval') == 1){
|
10 |
+
$bookings_pending_count += EM_Bookings::count(array('status'=>'0', 'blog'=>get_current_blog_id()));
|
11 |
+
}
|
12 |
+
if($bookings_pending_count > 0){
|
13 |
+
$bookings_num = '<span class="update-plugins count-'.$bookings_pending_count.'"><span class="plugin-count">'.$bookings_pending_count.'</span></span>';
|
14 |
+
}
|
15 |
+
}else{
|
16 |
+
$bookings_num = '';
|
17 |
+
$bookings_pending_count = 0;
|
18 |
+
}
|
19 |
+
//Count pending events
|
20 |
+
$events_num = '';
|
21 |
+
$events_pending_count = EM_Events::count(array('status'=>0, 'scope'=>'all', 'blog'=>get_current_blog_id()));
|
22 |
+
//TODO Add flexible permissions
|
23 |
+
if($events_pending_count > 0){
|
24 |
+
$events_num = '<span class="update-plugins count-'.$events_pending_count.'"><span class="plugin-count">'.$events_pending_count.'</span></span>';
|
25 |
+
}
|
26 |
+
//Count pending recurring events
|
27 |
+
$events_recurring_num = '';
|
28 |
+
$events_recurring_pending_count = EM_Events::count(array('status'=>0, 'recurring'=>1, 'scope'=>'all', 'blog'=>get_current_blog_id()));
|
29 |
+
//TODO Add flexible permissions
|
30 |
+
if($events_recurring_pending_count > 0){
|
31 |
+
$events_recurring_num = '<span class="update-plugins count-'.$events_recurring_pending_count.'"><span class="plugin-count">'.$events_recurring_pending_count.'</span></span>';
|
32 |
+
}
|
33 |
+
$both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count + $events_recurring_pending_count);
|
34 |
+
$both_num = ($both_pending_count > 0) ? '<span class="update-plugins count-'.$both_pending_count.'"><span class="plugin-count">'.$both_pending_count.'</span></span>':'';
|
35 |
+
// Add a submenu to the custom top-level menu:
|
36 |
+
$plugin_pages = array();
|
37 |
+
if( get_option('dbem_rsvp_enabled') ){
|
38 |
+
$plugin_pages['bookings'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Bookings', 'events-manager'), __('Bookings', 'events-manager').$bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page");
|
39 |
+
}
|
40 |
+
$plugin_pages['options'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Events Manager Settings','events-manager'),__('Settings','events-manager'), 'manage_options', "events-manager-options", 'em_admin_options_page');
|
41 |
+
$plugin_pages['help'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Getting Help for Events Manager','events-manager'),__('Help','events-manager'), 'manage_options', "events-manager-help", 'em_admin_help_page');
|
42 |
+
//If multisite global with locations set to be saved in main blogs we can force locations to be created on the main blog only
|
43 |
+
if( EM_MS_GLOBAL && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
|
44 |
+
include( dirname(__FILE__)."/em-ms-locations.php" );
|
45 |
+
$plugin_pages['locations'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Locations','events-manager'),__('Locations','events-manager'), 'read_others_locations', "locations", 'em_admin_ms_locations');
|
46 |
+
}
|
47 |
+
$plugin_pages = apply_filters('em_create_events_submenu',$plugin_pages);
|
48 |
+
//We have to modify the menus manually
|
49 |
+
if( !empty($both_num) ){ //Main Event Menu
|
50 |
+
//go through the menu array and modify the events menu if found
|
51 |
+
foreach ( (array)$menu as $key => $parent_menu ) {
|
52 |
+
if ( $parent_menu[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
|
53 |
+
$menu[$key][0] = $menu[$key][0]. $both_num;
|
54 |
+
break;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
if( !empty($events_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Event Item
|
59 |
+
//go through the menu array and modify the events menu if found
|
60 |
+
foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
|
61 |
+
if ( $submenu_item[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
|
62 |
+
$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_num;
|
63 |
+
break;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
if( !empty($events_recurring_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Recurring Event Item
|
68 |
+
//go through the menu array and modify the events menu if found
|
69 |
+
foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
|
70 |
+
if ( $submenu_item[2] == 'edit.php?post_type=event-recurring' ){
|
71 |
+
$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_recurring_num;
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
/* Hack! Add location/recurrence isn't possible atm so this is a workaround */
|
77 |
+
global $_wp_submenu_nopriv;
|
78 |
+
if( $pagenow == 'post-new.php' && !empty($_REQUEST['post_type']) ){
|
79 |
+
if( $_REQUEST['post_type'] == EM_POST_TYPE_LOCATION && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_locations') ){
|
80 |
+
unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
|
81 |
+
}
|
82 |
+
if( $_REQUEST['post_type'] == 'event-recurring' && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_recurring_events') ){
|
83 |
+
unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
add_action('admin_menu','em_admin_menu');
|
88 |
+
|
89 |
+
function em_admin_dashicon(){
|
90 |
+
?>
|
91 |
+
<style type="text/css">
|
92 |
+
@font-face {
|
93 |
+
font-family: 'em_dashicons';
|
94 |
+
src: url('<?php echo EM_DIR_URI; ?>includes/fonts/em-dashicons.eot'); // this is for IE
|
95 |
+
}
|
96 |
+
@font-face {
|
97 |
+
font-family: 'em_dashicons';
|
98 |
+
src: url(data:application/font-woff;charset=utf-8;base64,d09GRk9UVE8AAAVIAAoAAAAABQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAAAb8AAAG/+vk+uU9TLzIAAAK0AAAAYAAAAGAIIvy2Y21hcAAAAxQAAABMAAAATBpVzFdnYXNwAAADYAAAAAgAAAAIAAAAEGhlYWQAAANoAAAANgAAADYBZ6hBaGhlYQAAA6AAAAAkAAAAJAPIAeZobXR4AAADxAAAABQAAAAUAwAAM21heHAAAAPYAAAABgAAAAYABVAAbmFtZQAAA+AAAAFFAAABRVcZpu5wb3N0AAAFKAAAACAAAAAgAAMAAAEABAQAAQEBCGljb21vb24AAQIAAQA6+BwC+BsD+BgEHgoAGVP/i4seCgAZU/+LiwwHi2v4lPh0BR0AAAB2Dx0AAAB7ER0AAAAJHQAAAbYSAAYBAQgPERMWG2ljb21vb25pY29tb29udTB1MXUyMHVFNjAwAAACAYkAAwAFAgABAAQABwAKAA0BLfyUDvyUDvyUDvuUDvcu+FoVfIuAgIt9CItYBYt8loCai5mLlpaLmgiLvgWLmYCWfYsI93qLFX2Lf4CLfQiLWAWLfJeAmYuZi5eWi5oIi74Fi5l/ln2LCPth+0cVi1hYi4u+vosFpYsVvouLWFiLi74F2IsVvouLWFiLi74F14sVv4uLWFeLi74Fiz4VvouLWFiLi74FPosVv4uLWFeLi74FPosVv4uLWFeLi74FP4sVvouLWFiLi74F1z8Vv4uLV1eLi78F2IsVv4uLV1eLi78F9y33ihWGc3d5cotui3Wii6gIi5cFdI91jXiLd4t1iXWHCIt+BYtvdHRui3KLd52Go2yCdoSLi4uLi2eLfIv7lfduWYuLi4v3bb2L95WLmYuwi4uLi3aSbJQIDviUFPiUFYsMCgAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmAAHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYA//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAEAAIXyBpNfDzz1AAsCAAAAAADQMTPCAAAAANAxM8IAAP/6AeYBxgAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAAB5gABAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAEAAAACAAAzAABQAAAFAAAAAAAOAK4AAQAAAAAAAQAOAAAAAQAAAAAAAgAOAEcAAQAAAAAAAwAOACQAAQAAAAAABAAOAFUAAQAAAAAABQAWAA4AAQAAAAAABgAHADIAAQAAAAAACgA0AGMAAwABBAkAAQAOAAAAAwABBAkAAgAOAEcAAwABBAkAAwAOACQAAwABBAkABAAOAFUAAwABBAkABQAWAA4AAwABBAkABgAOADkAAwABBAkACgA0AGMAaQBjAG8AbQBvAG8AbgBWAGUAcgBzAGkAbwBuACAAMQAuADAAaQBjAG8AbQBvAG8Abmljb21vb24AaQBjAG8AbQBvAG8AbgBSAGUAZwB1AGwAYQByAGkAYwBvAG0AbwBvAG4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('woff'),
|
99 |
+
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMggi/LYAAAC8AAAAYGNtYXAaVcxXAAABHAAAAExnYXNwAAAAEAAAAWgAAAAIZ2x5ZsaoTWEAAAFwAAACFGhlYWQBZ6hBAAADhAAAADZoaGVhA8gB5gAAA7wAAAAkaG10eAMAADMAAAPgAAAAFGxvY2EAKAEeAAAD9AAAAAxtYXhwABMAowAABAAAAAAgbmFtZVcZpu4AAAQgAAABRXBvc3QAAwAAAAAFaAAAACAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmAAHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYA//3//wAAAAAAIOYA//3//wAB/+MaBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAADQAz//oB5gHGABoANQA6AD8ARABJAE4AUwBYAF0AYgBnAKAAABMiBgcOAQcXBhYXHgEzMjY3PgE3JzYmJy4BIzMiBgcOARcHHgEXHgEzMjY3PgEnNy4BJy4BIwcXIzczOwEXIzc7AQcjJzsBFyM3BzMHIycjMxcjNyMzByMnIzMXIzcXMwcjJzsBFyM3Nw4BBw4BIyImJy4BJzcuASciJiMiBiMOAQ8BFgYHDgEjIiYnLgEnDgEzIhYHHgEzIjYnNiYzIiYnmgUKAgUDAQEBBQMECAcECgMEAwEBAQUCBQgG5wYJBAMFAQEBAwUCCwQGCQQDBQEBAQMFAgsEzgE0ATIbMgE0AUw0ATIBTTMBNQEBNAEyAUwzATUBTjUBMwFLMgE0AUs1ATMBTjMBNQGYAQoGBxAKChQFCAcBAQoPCQcRBgkOCQgRBwEBCgUIEgwIEgUICAMWHgEBAQEB2QEB2gEBAQEBHBgBxgQDBAkFMwYJBAMEBAMECQYzBQkEAwQEAwQJBTMGCQQDBAQDBAkGMwUJBAMEszMzMzMzMzMzTTMzMzMzMzMzTDQ0NDT2CQ8GBQcIBwcTCwwCAgEBAQECAg0KEwcHCAcFBg8JBwkoC8FycsELKAkHAAEAAAABAACs5UCKXw889QALAgAAAAAA0DEzwgAAAADQMTPCAAD/+gHmAcYAAAAIAAIAAAAAAAAAAQAAAeD/4AAAAgAAAAAAAeYAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAABAAAAAgAAMwAAAAAACgAUAB4BCgABAAAABQChAA0AAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIADgBHAAEAAAAAAAMADgAkAAEAAAAAAAQADgBVAAEAAAAAAAUAFgAOAAEAAAAAAAYABwAyAAEAAAAAAAoANABjAAMAAQQJAAEADgAAAAMAAQQJAAIADgBHAAMAAQQJAAMADgAkAAMAAQQJAAQADgBVAAMAAQQJAAUAFgAOAAMAAQQJAAYADgA5AAMAAQQJAAoANABjAGkAYwBvAG0AbwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG0AbwBvAG5pY29tb29uAGkAYwBvAG0AbwBvAG4AUgBlAGcAdQBsAGEAcgBpAGMAbwBtAG8AbwBuAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format('truetype');
|
100 |
+
font-weight: normal;
|
101 |
+
font-style: normal;
|
102 |
+
}
|
103 |
+
.menu-icon-event .dashicons-calendar:before, #toplevel_page_events-manager-options .dashicons-calendar:before {
|
104 |
+
font-family: 'em_dashicons';
|
105 |
+
content: '\e600';
|
106 |
+
}
|
107 |
+
</style>
|
108 |
+
<?php
|
109 |
+
}
|
110 |
+
add_action('admin_head','em_admin_dashicon');
|
111 |
+
|
112 |
+
function em_ms_admin_menu(){
|
113 |
+
add_menu_page( __('Events Manager','events-manager'), __('Events Manager','events-manager'), 'activate_plugins', 'events-manager-options', 'em_ms_admin_options_page', 'dashicons-calendar' );
|
114 |
+
add_submenu_page('events-manager-options', __('Update Blogs','events-manager'),__('Update Blogs','events-manager'), 'activate_plugins', "events-manager-update", 'em_ms_upgrade');
|
115 |
+
}
|
116 |
+
add_action('network_admin_menu','em_ms_admin_menu');
|
117 |
+
|
118 |
+
function em_admin_init(){
|
119 |
+
//in MS global mode and locations are stored in the main blog, then a user must have at least a subscriber role
|
120 |
+
if( EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
|
121 |
+
EM_Object::ms_global_switch();
|
122 |
+
$user = new WP_User(get_current_user_id());
|
123 |
+
if( count($user->roles) == 0 ){
|
124 |
+
$user->set_role('subscriber');
|
125 |
+
}
|
126 |
+
EM_Object::ms_global_switch_back();
|
127 |
+
}
|
128 |
+
}
|
129 |
+
add_action('admin_init','em_admin_init');
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Generate warnings and notices in the admin area
|
133 |
+
*/
|
134 |
+
function em_admin_warnings() {
|
135 |
+
global $EM_Notices;
|
136 |
+
//If we're editing the events page show hello to new user
|
137 |
+
$events_page_id = get_option ( 'dbem_events_page' );
|
138 |
+
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&':'?';
|
139 |
+
|
140 |
+
if( current_user_can('activate_plugins') ){
|
141 |
+
//New User Intro
|
142 |
+
if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
|
143 |
+
// Disable Hello to new user if requested
|
144 |
+
update_option('dbem_hello_to_user',0);
|
145 |
+
}elseif ( get_option ( 'dbem_hello_to_user' ) ) {
|
146 |
+
//FIXME update welcome msg with good links
|
147 |
+
$advice = sprintf( __("<p>Events Manager is ready to go! It is highly recommended you read the <a href='%s'>Getting Started</a> guide on our site, as well as checking out the <a href='%s'>Settings Page</a>. <a href='%s' title='Don't show this advice again'>Dismiss</a></p>", 'events-manager'), 'http://wp-events-plugin.com/documentation/getting-started-guide/?utm_source=em&utm_medium=plugin&utm_content=installationlink&utm_campaign=plugin_links', EM_ADMIN_URL .'&page=events-manager-options', esc_url($_SERVER['REQUEST_URI'].$dismiss_link_joiner.'disable_hello_to_user=true'));
|
148 |
+
?>
|
149 |
+
<div id="message" class="updated">
|
150 |
+
<?php echo $advice; ?>
|
151 |
+
</div>
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
|
155 |
+
//If events page couldn't be created or is missing
|
156 |
+
if( !empty($_GET['em_dismiss_events_page']) ){
|
157 |
+
update_option('dbem_dismiss_events_page',1);
|
158 |
+
}else{
|
159 |
+
if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
|
160 |
+
?>
|
161 |
+
<div id="em_page_error" class="updated">
|
162 |
+
<p><?php echo sprintf ( __( 'Uh Oh! For some reason WordPress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'events-manager'), EM_ADMIN_URL .'&page=events-manager-options', esc_url($_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1') ); ?></p>
|
163 |
+
</div>
|
164 |
+
<?php
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
if( is_multisite() && !empty($_REQUEST['page']) && $_REQUEST['page']=='events-manager-options' && em_wp_is_super_admin() && get_option('dbem_ms_update_nag') ){
|
169 |
+
if( !empty($_GET['disable_dbem_ms_update_nag']) ){
|
170 |
+
delete_site_option('dbem_ms_update_nag');
|
171 |
+
}else{
|
172 |
+
?>
|
173 |
+
<div id="em_page_error" class="updated">
|
174 |
+
<p><?php echo sprintf(__('MultiSite options have moved <a href="%s">here</a>. <a href="%s">Dismiss message</a>','events-manager'),admin_url().'network/admin.php?page=events-manager-options', esc_url($_SERVER['REQUEST_URI'].'&disable_dbem_ms_update_nag=1')); ?></p>
|
175 |
+
</div>
|
176 |
+
<?php
|
177 |
+
}
|
178 |
+
}
|
179 |
+
if( !empty($_REQUEST['page']) && 'events-manager-options' == $_REQUEST['page'] && get_option('dbem_pro_dev_updates') == 1 ){
|
180 |
+
?>
|
181 |
+
<div id="message" class="updated">
|
182 |
+
<p><?php echo sprintf(__('Dev Mode active: Just a friendly reminder that you are updating to development versions. Only admins see this message, and it will go away when you disable this <a href="#pro-api">here</a> in your settings.','events-manager'),'<code>define(\'EMP_DEV_UPDATES\',true);</code>'); ?></p>
|
183 |
+
</div>
|
184 |
+
<?php
|
185 |
+
}
|
186 |
+
if( class_exists('SitePress') && !class_exists('EM_WPML') && !get_site_option('disable_em_wpml_warning') ){
|
187 |
+
if( !empty($_REQUEST['disable_em_wpml_warning']) ){
|
188 |
+
update_site_option('disable_em_wpml_warning',1);
|
189 |
+
}else{
|
190 |
+
?>
|
191 |
+
<div id="message" class="updated">
|
192 |
+
<p><?php echo sprintf(__('It looks like you have WPML enabled on your site. We advise you also install our extra <a href="%s">Events Manager WPML Connector</a> plugin which helps the two work better together. <a href="%s">Dismiss message</a>','events-manager'),'http://wordpress.org/extend/plugins/events-manager-wpml/', esc_url(add_query_arg(array('disable_em_wpml_warning'=>1)))); ?></p>
|
193 |
+
</div>
|
194 |
+
<?php
|
195 |
+
}
|
196 |
+
}
|
197 |
+
if( array_key_exists('dbem_disable_timthumb', wp_load_alloptions()) ){
|
198 |
+
if( !empty($_REQUEST['dbem_disable_timthumb']) ){
|
199 |
+
delete_option('dbem_disable_timthumb',1);
|
200 |
+
}else{
|
201 |
+
?>
|
202 |
+
<div id="message" class="updated">
|
203 |
+
<p>We have stopped using TimThumb for thumbnails in Events Manager, <a href="http://wp-events-plugin.com/blog/2014/12/05/bye-timthumb/">please see this post</a> for more information on how this may affect you and what options are available to you. <a href="<?php echo esc_url(add_query_arg(array('dbem_disable_timthumb'=>1))); ?>">Dismiss</a></p>
|
204 |
+
</div>
|
205 |
+
<?php
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
//Warn about EM page edit
|
210 |
+
if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
|
211 |
+
$message = sprintf ( __ ( "This page corresponds to the <strong>Events Manager</strong> %s page. Its content will be overridden by Events Manager, although if you include the word CONTENTS (exactly in capitals) and surround it with other text, only CONTENTS will be overwritten. If you want to change the way your events look, go to the <a href='%s'>settings</a> page. ", 'events-manager'), __('Events','events-manager'), EM_ADMIN_URL .'&page=events-manager-options' );
|
212 |
+
$notice = "<div class='error'><p>$message</p></div>";
|
213 |
+
echo $notice;
|
214 |
+
}
|
215 |
+
echo $EM_Notices;
|
216 |
+
}
|
217 |
+
add_action ( 'admin_notices', 'em_admin_warnings', 100 );
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Settings link in the plugins page menu
|
221 |
+
* @param array $links
|
222 |
+
* @param string $file
|
223 |
+
* @return array
|
224 |
+
*/
|
225 |
+
function em_plugin_action_links($actions, $file, $plugin_data) {
|
226 |
+
$new_actions = array();
|
227 |
+
$new_actions[] = sprintf( '<a href="'.EM_ADMIN_URL.'&page=events-manager-options">%s</a>', __('Settings', 'events-manager') );
|
228 |
+
$new_actions = array_merge($new_actions, $actions);
|
229 |
+
if( is_multisite() ){
|
230 |
+
$uninstall_url = admin_url().'network/admin.php?page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
231 |
+
}else{
|
232 |
+
$uninstall_url = EM_ADMIN_URL.'&page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
233 |
+
}
|
234 |
+
$new_actions[] = '<span class="delete"><a href="'.$uninstall_url.'" class="delete">'.__('Uninstall','events-manager').'</a></span>';
|
235 |
+
return $new_actions;
|
236 |
+
}
|
237 |
+
add_filter( 'plugin_action_links_events-manager/events-manager.php', 'em_plugin_action_links', 10, 3 );
|
238 |
+
|
239 |
+
//Updates and Dev versions
|
240 |
+
function em_updates_check( $transient ) {
|
241 |
+
// Check if the transient contains the 'checked' information
|
242 |
+
if( empty( $transient->checked ) )
|
243 |
+
return $transient;
|
244 |
+
|
245 |
+
//only bother if we're checking for dev versions
|
246 |
+
if( get_option('em_check_dev_version') || get_option('dbem_pro_dev_updates') ){
|
247 |
+
//check WP repo for trunk version, other EM-related plugins on .org can hook here to make the best of our admin setting option
|
248 |
+
$plugins = apply_filters('em_org_dev_versions', array(
|
249 |
+
'events-manager'=> array(
|
250 |
+
'slug' => EM_SLUG,
|
251 |
+
'version' => EM_VERSION
|
252 |
+
)
|
253 |
+
));
|
254 |
+
foreach( $plugins as $org_slug => $plugin_info ) {
|
255 |
+
$request = wp_remote_get('https://plugins.svn.wordpress.org/'.$org_slug.'/trunk/'.$org_slug.'.php');
|
256 |
+
$wp_slug = $plugin_info['slug'];
|
257 |
+
if( empty($transient->checked[$wp_slug]) ){
|
258 |
+
$transient->checked[$wp_slug] = !empty($plugin_info['version']) ? $plugin_info['version'] : 0;
|
259 |
+
}
|
260 |
+
if (!is_wp_error($request)) {
|
261 |
+
preg_match('/Version: ([0-9a-z\.]+)/', $request['body'], $matches);
|
262 |
+
|
263 |
+
if (!empty($matches[1])) {
|
264 |
+
//we have a version number!
|
265 |
+
$response = new stdClass();
|
266 |
+
$response->slug = $wp_slug;
|
267 |
+
$response->new_version = $matches[1];
|
268 |
+
$response->url = 'http://wordpress.org/extend/plugins/'.$org_slug.'/';
|
269 |
+
$response->package = 'http://downloads.wordpress.org/plugin/'.$org_slug.'.zip';
|
270 |
+
$icon_test = wp_remote_get('https://ps.w.org/'.$org_slug.'/assets/icon-128x128.png');
|
271 |
+
if( !is_wp_error($icon_test) && $icon_test['response']['code'] == 200 ){
|
272 |
+
$response->icons = array(
|
273 |
+
'1x' => 'https://ps.w.org/'.$org_slug.'/assets/icon-128x128.png',
|
274 |
+
'2x' => 'https://ps.w.org/'.$org_slug.'/assets/icon-256x256.png'
|
275 |
+
);
|
276 |
+
}
|
277 |
+
if ( version_compare($transient->checked[$wp_slug], $matches[1]) < 0) {
|
278 |
+
$transient->response[$wp_slug] = $response;
|
279 |
+
}else{
|
280 |
+
$transient->no_update[$wp_slug] = $response;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
delete_option('em_check_dev_version');
|
286 |
+
}
|
287 |
+
|
288 |
+
return $transient;
|
289 |
+
}
|
290 |
+
add_filter('pre_set_site_transient_update_plugins', 'em_updates_check', 100); // Hook into the plugin update check and mod for dev version
|
291 |
+
|
292 |
+
function em_user_action_links( $actions, $user ){
|
293 |
+
if ( !is_network_admin() && current_user_can( 'manage_others_bookings' ) ){
|
294 |
+
if( get_option('dbem_edit_bookings_page') && (!is_admin() || !empty($_REQUEST['is_public'])) ){
|
295 |
+
$my_bookings_page = get_permalink(get_option('dbem_edit_bookings_page'));
|
296 |
+
$bookings_link = em_add_get_params($my_bookings_page, array('person_id'=>$user->ID), false);
|
297 |
+
}else{
|
298 |
+
$bookings_link = EM_ADMIN_URL. "&page=events-manager-bookings&person_id=".$user->ID;
|
299 |
+
}
|
300 |
+
$actions['bookings'] = "<a href='$bookings_link'>" . __( 'Bookings','events-manager') . "</a>";
|
301 |
+
}
|
302 |
+
return $actions;
|
303 |
+
}
|
304 |
+
add_filter('user_row_actions','em_user_action_links',10,2);
|
305 |
+
?>
|
trunk/admin/em-bookings.php
ADDED
@@ -0,0 +1,646 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Deprecated - see em-actions.php - this will be removed at some point in 6.0
|
4 |
+
* Check if there's any admin-related actions to take for bookings. All actions are caught here.
|
5 |
+
* @return null
|
6 |
+
* @todo remove in 6.0
|
7 |
+
*/
|
8 |
+
function em_admin_actions_bookings() {
|
9 |
+
global $EM_Event;
|
10 |
+
if( is_object($EM_Event) && !empty($_REQUEST['action']) ){
|
11 |
+
if( $_REQUEST['action'] == 'bookings_export_csv' && wp_verify_nonce($_REQUEST['_wpnonce'],'bookings_export_csv') ){
|
12 |
+
$EM_Event->get_bookings()->export_csv();
|
13 |
+
exit();
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
add_action('admin_init','em_admin_actions_bookings',100);
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Decide what content to show in the bookings section.
|
21 |
+
*/
|
22 |
+
function em_bookings_page(){
|
23 |
+
//First any actions take priority
|
24 |
+
do_action('em_bookings_admin_page');
|
25 |
+
if( !empty($_REQUEST['_wpnonce']) ){ $_REQUEST['_wpnonce'] = $_GET['_wpnonce'] = $_POST['_wpnonce'] = esc_attr($_REQUEST['_wpnonce']); } //XSS fix just in case here too
|
26 |
+
if( !empty($_REQUEST['action']) && substr($_REQUEST['action'],0,7) != 'booking' ){ //actions not starting with booking_
|
27 |
+
?>
|
28 |
+
<div class="wrap em-bookings-admin-custom-<?php esc_attr($_REQUEST['action']); ?> <?php em_template_classes('bookings-admin'); ?>">
|
29 |
+
<div class="input">
|
30 |
+
<?php
|
31 |
+
do_action('em_bookings_'.$_REQUEST['action']);
|
32 |
+
?>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
<?php
|
36 |
+
}elseif( !empty($_REQUEST['booking_id']) ){
|
37 |
+
em_bookings_single();
|
38 |
+
}elseif( !empty($_REQUEST['person_id']) ){
|
39 |
+
em_bookings_person();
|
40 |
+
}elseif( !empty($_REQUEST['ticket_id']) ){
|
41 |
+
em_bookings_ticket();
|
42 |
+
}elseif( !empty($_REQUEST['event_id']) ){
|
43 |
+
em_bookings_event();
|
44 |
+
}else{
|
45 |
+
em_bookings_dashboard();
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Generates the bookings dashboard, showing information on all events
|
51 |
+
*/
|
52 |
+
function em_bookings_dashboard(){
|
53 |
+
global $EM_Notices;
|
54 |
+
?>
|
55 |
+
<div class='em-bookings-admin-dashboard em-bookings-dashboard <?php em_template_classes('bookings-admin'); ?>'>
|
56 |
+
<div class="input">
|
57 |
+
<?php if( is_admin() ): ?>
|
58 |
+
<h1><?php esc_html_e('Event Bookings Dashboard', 'events-manager'); ?></h1>
|
59 |
+
<?php else: echo $EM_Notices; ?>
|
60 |
+
<?php endif; ?>
|
61 |
+
<div class="em-bookings-recent">
|
62 |
+
<h2><?php esc_html_e('Recent Bookings','events-manager'); ?></h2>
|
63 |
+
<?php
|
64 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
65 |
+
$EM_Bookings_Table->status = get_option('dbem_bookings_approval') ? 'needs-attention':'confirmed';
|
66 |
+
$EM_Bookings_Table->output();
|
67 |
+
?>
|
68 |
+
</div>
|
69 |
+
<br class="clear" />
|
70 |
+
<div class="em-bookings-events">
|
71 |
+
<h2><?php esc_html_e('Events With Bookings Enabled','events-manager'); ?></h2>
|
72 |
+
<?php em_bookings_events_table(); ?>
|
73 |
+
<?php do_action('em_bookings_dashboard'); ?>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<?php
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Shows all booking data for a single event
|
82 |
+
*/
|
83 |
+
function em_bookings_event(){
|
84 |
+
global $EM_Event,$EM_Person,$EM_Notices;
|
85 |
+
//check that user can access this page
|
86 |
+
if( is_object($EM_Event) && !$EM_Event->can_manage('manage_bookings','manage_others_bookings') ){
|
87 |
+
?>
|
88 |
+
<div class="wrap <?php em_template_classes('bookings-admin'); ?>">
|
89 |
+
<h2><?php esc_html_e('Unauthorized Access','events-manager'); ?></h2>
|
90 |
+
<p><?php esc_html_e('You do not have the rights to manage this event.','events-manager'); ?></p>
|
91 |
+
</div>
|
92 |
+
<?php
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
|
96 |
+
?>
|
97 |
+
<div class='em-bookings-admin-event <?php em_template_classes('bookings-admin'); ?>'>
|
98 |
+
<div class="input">
|
99 |
+
|
100 |
+
<?php if( is_admin() ): ?><h1 class="wp-heading-inline"><?php else: ?><h2><?php endif; ?>
|
101 |
+
<?php echo sprintf(__('Manage %s Bookings', 'events-manager'), "'{$EM_Event->event_name}'"); ?>
|
102 |
+
<?php if( !is_admin() ): ?></h2><?php else: ?></h1><?php endif; // inverted to help IDEs ?>
|
103 |
+
<a href="<?php echo $EM_Event->get_permalink(); ?>" class="button button-secondary"><?php echo sprintf(__('View %s','events-manager'), __('Event', 'events-manager')) ?></a>
|
104 |
+
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="button button-secondary"><?php echo sprintf(__('Edit %s','events-manager'), __('Event', 'events-manager')) ?></a>
|
105 |
+
<?php if( locate_template('plugins/events-manager/templates/csv-event-bookings.php', false) ): //support for legacy template ?>
|
106 |
+
<a href='<?php echo EM_ADMIN_URL ."&page=events-manager-bookings&action=bookings_export_csv&_wpnonce=".wp_create_nonce('bookings_export_csv')."&event_id=".$EM_Event->event_id ?>' class="button button-secondary"><?php esc_html_e('Export CSV','events-manager')?></a>
|
107 |
+
<?php endif; ?>
|
108 |
+
<?php do_action('em_admin_event_booking_options_buttons'); ?>
|
109 |
+
<hr class="wp-header-end">
|
110 |
+
|
111 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
112 |
+
<p><strong><?php esc_html_e('Event Name','events-manager'); ?></strong> : <?php echo esc_html($EM_Event->event_name); ?></p>
|
113 |
+
<?php do_action('em_admin_event_booking_before_availibility', $EM_Event); ?>
|
114 |
+
<p>
|
115 |
+
<strong><?php esc_html_e('Availability','events-manager'); ?></strong> :
|
116 |
+
<?php echo $EM_Event->get_bookings()->get_booked_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Spaces confirmed','events-manager'); ?>
|
117 |
+
<?php if( get_option('dbem_bookings_approval_reserved') ): ?>
|
118 |
+
, <?php echo $EM_Event->get_bookings()->get_available_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Available spaces','events-manager'); ?>
|
119 |
+
<?php endif; ?>
|
120 |
+
<?php do_action('em_admin_event_booking_availibility', $EM_Event); ?>
|
121 |
+
</p>
|
122 |
+
<?php do_action('em_admin_event_booking_after_availibility', $EM_Event); ?>
|
123 |
+
<p>
|
124 |
+
<strong><?php esc_html_e('Date','events-manager'); ?></strong> :
|
125 |
+
<?php echo $EM_Event->output_dates(false, " - "). ' @ ' . $EM_Event->output_times(false, ' - '); ?>
|
126 |
+
</p>
|
127 |
+
<p>
|
128 |
+
<strong><?php esc_html_e('Location','events-manager'); ?></strong> :
|
129 |
+
<?php if( $EM_Event->location_id == 0 ): ?>
|
130 |
+
<em><?php esc_html_e('No Location', 'events-manager'); ?></em>
|
131 |
+
<?php else: ?>
|
132 |
+
<a class="row-title" href="<?php echo admin_url(); ?>post.php?action=edit&post=<?php echo $EM_Event->get_location()->post_id ?>"><?php echo ($EM_Event->get_location()->location_name); ?></a>
|
133 |
+
<?php endif; ?>
|
134 |
+
</p>
|
135 |
+
<h2><?php esc_html_e('Bookings','events-manager'); ?></h2>
|
136 |
+
<?php
|
137 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
138 |
+
$EM_Bookings_Table->status = 'all';
|
139 |
+
$EM_Bookings_Table->output();
|
140 |
+
?>
|
141 |
+
<?php do_action('em_bookings_event_footer', $EM_Event); ?>
|
142 |
+
</div>
|
143 |
+
</div>
|
144 |
+
<?php
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Shows a ticket view
|
149 |
+
*/
|
150 |
+
function em_bookings_ticket(){
|
151 |
+
global $EM_Ticket,$EM_Notices;
|
152 |
+
$EM_Event = $EM_Ticket->get_event();
|
153 |
+
//check that user can access this page
|
154 |
+
if( is_object($EM_Ticket) && !$EM_Ticket->can_manage() ){
|
155 |
+
?>
|
156 |
+
<div class="wrap <?php em_template_classes('bookings-admin'); ?>">
|
157 |
+
<h2><?php esc_html_e('Unauthorized Access','events-manager'); ?></h2>
|
158 |
+
<p><?php esc_html_e('You do not have the rights to manage this ticket.','events-manager'); ?></p>
|
159 |
+
</div>
|
160 |
+
<?php
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
?>
|
164 |
+
<div class='em-bookings-admin-ticket <?php em_template_classes('bookings-admin'); ?>'>
|
165 |
+
<div class="input">
|
166 |
+
|
167 |
+
<?php if( is_admin() ): ?><h1 class="wp-heading-inline"><?php else: ?><h2><?php endif; ?>
|
168 |
+
<?php echo sprintf(__('Ticket for %s', 'events-manager'), "'{$EM_Event->name}'"); ?><?php echo sprintf(__('Manage %s Bookings', 'events-manager'), "'{$EM_Event->event_name}'"); ?>
|
169 |
+
<?php if( !is_admin() ): ?></h2><?php else: ?></h1><?php endif; // inverted to help IDEs ?>
|
170 |
+
<a href="<?php echo $EM_Event->get_edit_url(); ?>" class="button button-secondary"><?php esc_html_e('View/Edit Event','events-manager') ?></a>
|
171 |
+
<a href="<?php echo $EM_Event->get_bookings_url(); ?>" class="button button-secondary"><?php esc_html_e('View Event Bookings','events-manager') ?></a>
|
172 |
+
<hr class="wp-header-end" />
|
173 |
+
|
174 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
175 |
+
<div>
|
176 |
+
<table>
|
177 |
+
<tr><td><?php echo __('Name','events-manager'); ?></td><td></td><td><?php echo $EM_Ticket->ticket_name; ?></td></tr>
|
178 |
+
<tr><td><?php echo __('Description','events-manager'); ?> </td><td></td><td><?php echo ($EM_Ticket->ticket_description) ? $EM_Ticket->ticket_description : '-'; ?></td></tr>
|
179 |
+
<tr><td><?php echo __('Price','events-manager'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_price) ? $EM_Ticket->ticket_price : '-'; ?></td></tr>
|
180 |
+
<tr><td><?php echo __('Spaces','events-manager'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_spaces) ? $EM_Ticket->ticket_spaces : '-'; ?></td></tr>
|
181 |
+
<tr><td><?php echo __('Min','events-manager'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_min) ? $EM_Ticket->ticket_min : '-'; ?></td></tr>
|
182 |
+
<tr><td><?php echo __('Max','events-manager'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_max) ? $EM_Ticket->ticket_max : '-'; ?></td></tr>
|
183 |
+
<tr><td><?php echo __('Start','events-manager'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_start) ? $EM_Ticket->start()->formatDefault() : '-'; ?></td></tr>
|
184 |
+
<tr><td><?php echo __('End','events-manager'); ?></td><td></td><td><?php echo ($EM_Ticket->ticket_end) ? $EM_Ticket->end()->formatDefault() : '-'; ?></td></tr>
|
185 |
+
<?php do_action('em_booking_admin_ticket_row', $EM_Ticket); ?>
|
186 |
+
</table>
|
187 |
+
</div>
|
188 |
+
<h2><?php esc_html_e('Bookings','events-manager'); ?></h2>
|
189 |
+
<?php
|
190 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
191 |
+
$EM_Bookings_Table->status = get_option('dbem_bookings_approval') ? 'needs-attention':'confirmed';
|
192 |
+
$EM_Bookings_Table->output();
|
193 |
+
?>
|
194 |
+
<?php do_action('em_bookings_ticket_footer', $EM_Ticket); ?>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
<?php
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Shows a single booking for a single person.
|
202 |
+
*/
|
203 |
+
function em_bookings_single(){
|
204 |
+
global $EM_Booking, $EM_Notices; /* @var $EM_Booking EM_Booking */
|
205 |
+
//check that user can access this page
|
206 |
+
if( is_object($EM_Booking) && !$EM_Booking->can_manage() ){
|
207 |
+
?>
|
208 |
+
<div class="wrap <?php em_template_classes('bookings-admin'); ?>">
|
209 |
+
<h2><?php esc_html_e('Unauthorized Access','events-manager'); ?></h2>
|
210 |
+
<p><?php esc_html_e('You do not have the rights to manage this event.','events-manager'); ?></p>
|
211 |
+
</div>
|
212 |
+
<?php
|
213 |
+
return false;
|
214 |
+
}
|
215 |
+
do_action('em_booking_admin', $EM_Booking);
|
216 |
+
?>
|
217 |
+
<div class='wrap em-bookings-admin-single <?php em_template_classes('bookings-admin'); ?>' id="em-bookings-admin-booking">
|
218 |
+
<div class="input">
|
219 |
+
<?php if( is_admin() ): ?><h1><?php else: ?><h2><?php endif; ?>
|
220 |
+
<?php esc_html_e('Edit Booking', 'events-manager'); ?>
|
221 |
+
<?php if( !is_admin() ): ?></h2><?php else: ?></h1><?php endif; ?>
|
222 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
223 |
+
<div class="metabox-holder">
|
224 |
+
<div class="postbox-container" style="width:99.5%">
|
225 |
+
<div class="postbox">
|
226 |
+
<h3>
|
227 |
+
<?php esc_html_e( 'Event Details', 'events-manager'); ?>
|
228 |
+
</h3>
|
229 |
+
<div class="inside">
|
230 |
+
<?php
|
231 |
+
$EM_Event = $EM_Booking->get_event();
|
232 |
+
?>
|
233 |
+
<table>
|
234 |
+
<tr><td><strong><?php esc_html_e('Name','events-manager'); ?></strong></td><td><a class="row-title" href="<?php echo $EM_Event->get_bookings_url(); ?>"><?php echo ($EM_Event->event_name); ?></a></td></tr>
|
235 |
+
<tr>
|
236 |
+
<td><strong><?php esc_html_e('Date/Time','events-manager'); ?> </strong></td>
|
237 |
+
<td>
|
238 |
+
<?php echo $EM_Event->output('#_EVENTDATES @ #_EVENTTIMES'); ?>
|
239 |
+
</td>
|
240 |
+
</tr>
|
241 |
+
</table>
|
242 |
+
<?php do_action('em_bookings_admin_booking_event', $EM_Event); ?>
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
+
<div class="postbox">
|
246 |
+
<h3>
|
247 |
+
<?php esc_html_e( 'Personal Details', 'events-manager'); ?>
|
248 |
+
</h3>
|
249 |
+
<div class="inside">
|
250 |
+
<div class="em-booking-person-details">
|
251 |
+
<?php echo $EM_Booking->get_person()->display_summary(); ?>
|
252 |
+
<?php if( $EM_Booking->is_no_user() ): ?>
|
253 |
+
<input type="button" class="button-secondary" id="em-booking-person-modify" value="<?php esc_attr_e('Edit Details','events-manager'); ?>" />
|
254 |
+
<?php endif; ?>
|
255 |
+
</div>
|
256 |
+
<?php if( $EM_Booking->is_no_user() ): ?>
|
257 |
+
<form action="" method="post" class="em-booking-person-form">
|
258 |
+
<div class="em-booking-person-editor" style="display:none;">
|
259 |
+
<?php echo $EM_Booking->get_person_editor(); ?>
|
260 |
+
<input type='hidden' name='action' value='booking_modify_person'/>
|
261 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
262 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
263 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_modify_person_'.$EM_Booking->booking_id); ?>'/>
|
264 |
+
<input type="submit" class="button-primary em-button em-booking-person-modify-submit" id="em-booking-person-modify-submit" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" />
|
265 |
+
<input type="button" id="em-booking-person-modify-cancel" class="button-secondary em-button" value="<?php esc_attr_e('Cancel','events-manager'); ?>" />
|
266 |
+
</div>
|
267 |
+
</form>
|
268 |
+
<script type="text/javascript">
|
269 |
+
jQuery(document).ready( function($){
|
270 |
+
$('#em-booking-person-modify').on('click', function(){
|
271 |
+
$('.em-booking-person-details').hide();
|
272 |
+
$('.em-booking-person-editor').show();
|
273 |
+
});
|
274 |
+
$('#em-booking-person-modify-cancel').on('click', function(){
|
275 |
+
$('.em-booking-person-details').show();
|
276 |
+
$('.em-booking-person-editor').hide();
|
277 |
+
});
|
278 |
+
});
|
279 |
+
</script>
|
280 |
+
<?php endif; ?>
|
281 |
+
<?php do_action('em_bookings_admin_booking_person', $EM_Booking); ?>
|
282 |
+
</div>
|
283 |
+
</div>
|
284 |
+
<div class="postbox">
|
285 |
+
<h3>
|
286 |
+
<?php esc_html_e( 'Booking Details', 'events-manager'); ?>
|
287 |
+
<?php $icons_class = is_admin() ? 'dashicons dashicons-info-outline' : 'em-icons em-icons-at'; ?>
|
288 |
+
<span class="em-tooltip <?php echo $icons_class ?>" aria-label="UUID : <?php echo esc_attr($EM_Booking->booking_uuid); ?>" data-tippy-interactive="true"></span>
|
289 |
+
</h3>
|
290 |
+
<div class="inside">
|
291 |
+
<?php
|
292 |
+
$EM_Event = $EM_Booking->get_event();
|
293 |
+
$shown_tickets = array();
|
294 |
+
?>
|
295 |
+
<div>
|
296 |
+
<form action="" method="post" class="em-booking-single-status-info">
|
297 |
+
<strong><?php esc_html_e('Status','events-manager'); ?> : </strong>
|
298 |
+
<?php echo $EM_Booking->get_status(); ?>
|
299 |
+
<input type="button" class="button-secondary em-button em-booking-submit-status-modify" id="em-booking-submit-status-modify" value="<?php esc_attr_e('Change', 'events-manager'); ?>" />
|
300 |
+
<input type="submit" class="button-primary em-button em-booking-resend-email" id="em-booking-resend-email" value="<?php esc_attr_e('Resend Email', 'events-manager'); ?>" />
|
301 |
+
<input type='hidden' name='action' value='booking_resend_email'/>
|
302 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
303 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
304 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_resend_email_'.$EM_Booking->booking_id); ?>'/>
|
305 |
+
</form>
|
306 |
+
<form action="" method="post" class="em-booking-single-status-edit">
|
307 |
+
<strong><?php esc_html_e('Status','events-manager'); ?> : </strong>
|
308 |
+
<select name="booking_status">
|
309 |
+
<?php foreach($EM_Booking->status_array as $status => $status_name): ?>
|
310 |
+
<option value="<?php echo esc_attr($status); ?>" <?php if($status == $EM_Booking->booking_status){ echo 'selected="selected"'; } ?>><?php echo esc_html($status_name); ?></option>
|
311 |
+
<?php endforeach; ?>
|
312 |
+
</select>
|
313 |
+
<input type="checkbox" checked="checked" name="send_email" value="1" />
|
314 |
+
<?php esc_html_e('Send Email','events-manager'); ?>
|
315 |
+
<input type="submit" class="button-primary em-button em-booking-submit-status" id="em-booking-submit-status" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" />
|
316 |
+
<input type="button" class="button-secondary em-button em-booking-submit-status-cancel" id="em-booking-submit-status-cancel" value="<?php esc_attr_e('Cancel', 'events-manager'); ?>" />
|
317 |
+
<input type='hidden' name='action' value='booking_set_status'/>
|
318 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
319 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
320 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_set_status_'.$EM_Booking->booking_id); ?>'/>
|
321 |
+
<br /><em><?php echo wp_kses_data(__('<strong>Notes:</strong> Ticket availability not taken into account when approving new bookings (i.e. you can overbook).','events-manager')); ?></em>
|
322 |
+
</form>
|
323 |
+
<?php do_action('em_bookings_admin_booking_details_actions', $EM_Booking); ?>
|
324 |
+
</div>
|
325 |
+
<form action="" method="post" class="em-booking-form">
|
326 |
+
<table class="em-tickets em-tickets-bookings-table" cellpadding="0" cellspacing="0">
|
327 |
+
<thead>
|
328 |
+
<tr>
|
329 |
+
<th><?php esc_html_e('Ticket Type','events-manager'); ?></th>
|
330 |
+
<th><?php esc_html_e('Spaces','events-manager'); ?></th>
|
331 |
+
<th><?php esc_html_e('Price','events-manager'); ?></th>
|
332 |
+
</tr>
|
333 |
+
</thead>
|
334 |
+
<?php
|
335 |
+
/* Show booked tickets in this booking, we'll add on the unbooked tickets here to prevent redundant code */
|
336 |
+
$EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings();
|
337 |
+
$tickets_bookings = array(); // we'll use this ordered with all tickets
|
338 |
+
foreach( $EM_Event->get_bookings()->get_tickets()->tickets as $ticket_id => $EM_Ticket ){
|
339 |
+
if( empty($EM_Tickets_Bookings[$ticket_id]) ) {
|
340 |
+
$tickets_bookings[$ticket_id] = new EM_Ticket_Bookings(array('ticket' => $EM_Ticket, 'booking' => $EM_Booking));
|
341 |
+
}else{
|
342 |
+
$tickets_bookings[$ticket_id] = $EM_Tickets_Bookings[$ticket_id];
|
343 |
+
}
|
344 |
+
}
|
345 |
+
?>
|
346 |
+
<?php foreach($tickets_bookings as $ticket_id => $EM_Ticket_Bookings): /* @var $EM_Ticket_Bookings EM_Ticket_Bookings */ ?>
|
347 |
+
<?php
|
348 |
+
$ticket_id = absint($ticket_id); // sanitize for output
|
349 |
+
$EM_Ticket = $EM_Ticket_Bookings->get_ticket();
|
350 |
+
// Use the following for adding extra info, most appropriate place is within the edit area
|
351 |
+
do_action('em_bookings_admin_ticket_bookings_before', $EM_Ticket_Bookings);
|
352 |
+
?>
|
353 |
+
<tr class="em-ticket em-ticket-<?php echo $ticket_id; ?>">
|
354 |
+
<td class="ticket-type">
|
355 |
+
<a class="row-title" href="<?php echo em_add_get_params($EM_Event->get_bookings_url(), array('ticket_id'=>$ticket_id)); ?>"><?php echo $EM_Ticket_Bookings->get_ticket()->ticket_name ?></a>
|
356 |
+
</td>
|
357 |
+
<td>
|
358 |
+
<span class="em-booking-single-info"><?php echo $EM_Ticket_Bookings->get_spaces(); ?></span>
|
359 |
+
<div class="em-booking-single-edit">
|
360 |
+
<input name="em_tickets[<?php echo $ticket_id; ?>][spaces]" class="em-ticket-select em-ticket-spaces-<?php echo $ticket_id; ?>" value="<?php echo $EM_Ticket_Bookings->get_spaces(); ?>" data-ticket-id="<?php echo $ticket_id ?>"/>
|
361 |
+
</div>
|
362 |
+
</td>
|
363 |
+
<td><?php echo $EM_Ticket_Bookings->get_price(true,true); ?></td>
|
364 |
+
</tr>
|
365 |
+
<?php do_action('em_bookings_admin_ticket_row', $EM_Ticket_Bookings->get_ticket(), $EM_Booking, $EM_Ticket_Bookings); /* Keeping as legacy support for EM Pro < v3 */ ?>
|
366 |
+
<tbody class="em-ticket-bookings <?php if( !has_action('em_bookings_admin_ticket_booking_row') ) echo 'hidden'; ?> em-ticket-bookings-<?php echo $ticket_id; ?>" data-ticket-id="<?php echo $ticket_id; ?>">
|
367 |
+
<?php
|
368 |
+
// use the following
|
369 |
+
$shown_tickets[] = $ticket_id;
|
370 |
+
$ticket_attendee_num = 1;
|
371 |
+
do_action('em_bookings_admin_ticket_bookings_rows_before', $EM_Ticket_Bookings);
|
372 |
+
?>
|
373 |
+
<?php foreach( $EM_Ticket_Bookings as $ticket_uuid => $EM_Ticket_Booking ): /* @var EM_Ticket_Booking $EM_Ticket_Booking */ ?>
|
374 |
+
<?php do_action('em_bookings_admin_ticket_booking_row_before', $EM_Ticket_Booking, $ticket_attendee_num); ?>
|
375 |
+
<tr class="em-ticket-booking em-ticket-booking-<?php echo absint($EM_Ticket_Booking->ticket_booking_id); ?>"><!-- this will eventually move out into an enveloping element class for all ticket bookings of this ticket -->
|
376 |
+
<td colspan="3">
|
377 |
+
<div>
|
378 |
+
<p class="em-ticket-booking-attendee-number"><?php echo sprintf(esc_html__('Attendee %d', 'events-manager'), $ticket_attendee_num); ?></p>
|
379 |
+
<span class="em-booking-single-edit em-icon em-icon-close em-ticket-booking-remove-trigger em-tooltip" aria-label="<?php esc_html_e('Remove this ticket booking', 'events-manager'); ?>"></span>
|
380 |
+
<?php
|
381 |
+
// create a consistent naming structure for post vars, others can/should add stuff to the uuid part of each ticket booking
|
382 |
+
$name = "";
|
383 |
+
do_action('em_bookings_admin_ticket_booking_row', $EM_Ticket_Booking, $ticket_attendee_num);
|
384 |
+
?>
|
385 |
+
<input name="em_tickets[<?php echo $ticket_id; ?>][ticket_bookings][<?php echo esc_attr($ticket_uuid); ?>][ticket_booking_id]" type="hidden" value="<?php echo absint($EM_Ticket_Booking->ticket_booking_id); ?>">
|
386 |
+
</div>
|
387 |
+
</td>
|
388 |
+
</tr>
|
389 |
+
<?php do_action('em_bookings_admin_ticket_booking_row_after', $EM_Ticket_Booking, $ticket_attendee_num); ?>
|
390 |
+
<?php $ticket_attendee_num++; ?>
|
391 |
+
<?php endforeach; ?>
|
392 |
+
<?php
|
393 |
+
do_action('em_bookings_admin_ticket_bookings_rows_after', $EM_Ticket_Bookings); // want $ticket_attendee_num? count the tickets
|
394 |
+
?>
|
395 |
+
<tr class="em-ticket-booking-template">
|
396 |
+
<td colspan="3">
|
397 |
+
<div>
|
398 |
+
<p class="em-ticket-booking-attendee-number"><?php echo str_replace('%d', '#NUM#', esc_html__('Attendee %d', 'events-manager')); ?></p>
|
399 |
+
<?php do_action('em_bookings_admin_ticket_booking_row_template', $EM_Ticket, $EM_Booking); ?>
|
400 |
+
</div>
|
401 |
+
</td>
|
402 |
+
</tr>
|
403 |
+
<?php
|
404 |
+
// Use the following for adding extra info, most appropriate place is within the edit area
|
405 |
+
do_action('em_bookings_admin_ticket_bookings_after', $EM_Ticket_Bookings);
|
406 |
+
?>
|
407 |
+
</tbody>
|
408 |
+
<?php endforeach; ?>
|
409 |
+
|
410 |
+
<tfoot>
|
411 |
+
<?php
|
412 |
+
do_action('em_bookings_admin_ticket_totals_header');
|
413 |
+
$price_summary = $EM_Booking->get_price_summary_array();
|
414 |
+
//we should now have an array of information including base price, taxes and post/pre tax discounts
|
415 |
+
?>
|
416 |
+
<tr>
|
417 |
+
<th><?php esc_html_e('Price','events-manager'); ?></th>
|
418 |
+
<th><?php echo sprintf(__('%d Spaces','events-manager'), $EM_Booking->get_spaces()); ?></th>
|
419 |
+
<th><?php echo $EM_Booking->get_price_base(true); ?></th>
|
420 |
+
</tr>
|
421 |
+
<?php if( count($price_summary['discounts_pre_tax']) > 0 ): ?>
|
422 |
+
<?php foreach( $price_summary['discounts_pre_tax'] as $discount_summary ): ?>
|
423 |
+
<tr>
|
424 |
+
<th><?php echo $discount_summary['name']; ?></th>
|
425 |
+
<th><?php echo $discount_summary['adjustment']; ?></th>
|
426 |
+
<th>- <?php echo $discount_summary['amount']; ?></th>
|
427 |
+
</tr>
|
428 |
+
<?php endforeach; ?>
|
429 |
+
<?php endif; ?>
|
430 |
+
<?php if( count($price_summary['surcharges_pre_tax']) > 0 ): ?>
|
431 |
+
<?php foreach( $price_summary['surcharges_pre_tax'] as $surcharge_summary ): ?>
|
432 |
+
<tr>
|
433 |
+
<th><?php echo $surcharge_summary['name']; ?></th>
|
434 |
+
<th><?php echo $surcharge_summary['adjustment']; ?></th>
|
435 |
+
<th><?php echo $surcharge_summary['amount']; ?></th>
|
436 |
+
</tr>
|
437 |
+
<?php endforeach; ?>
|
438 |
+
<?php endif; ?>
|
439 |
+
<?php if( !empty($price_summary['taxes']['amount']) ): ?>
|
440 |
+
<tr>
|
441 |
+
<th><?php esc_html_e('Tax','events-manager'); ?></th>
|
442 |
+
<th>
|
443 |
+
<span class="em-booking-single-info"><?php echo $price_summary['taxes']['rate'] ?></span>
|
444 |
+
<div class="em-booking-single-edit"><input name="booking_tax_rate" value="<?php echo esc_attr($EM_Booking->get_tax_rate()); ?>">%</div>
|
445 |
+
</th>
|
446 |
+
<th><?php echo $price_summary['taxes']['amount']; ?></th>
|
447 |
+
</tr>
|
448 |
+
<?php endif; ?>
|
449 |
+
<?php if( count($price_summary['discounts_post_tax']) > 0 ): ?>
|
450 |
+
<?php foreach( $price_summary['discounts_post_tax'] as $discount_summary ): ?>
|
451 |
+
<tr>
|
452 |
+
<th><?php echo $discount_summary['name']; ?></th>
|
453 |
+
<th><?php echo $discount_summary['adjustment']; ?></th>
|
454 |
+
<th>- <?php echo $discount_summary['amount']; ?></th>
|
455 |
+
</tr>
|
456 |
+
<?php endforeach; ?>
|
457 |
+
<?php endif; ?>
|
458 |
+
<?php if( count($price_summary['surcharges_post_tax']) > 0 ): ?>
|
459 |
+
<?php foreach( $price_summary['surcharges_post_tax'] as $surcharge_summary ): ?>
|
460 |
+
<tr>
|
461 |
+
<th><?php echo $surcharge_summary['name']; ?></th>
|
462 |
+
<th><?php echo $surcharge_summary['adjustment']; ?></th>
|
463 |
+
<th><?php echo $surcharge_summary['amount']; ?></th>
|
464 |
+
</tr>
|
465 |
+
<?php endforeach; ?>
|
466 |
+
<?php endif; ?>
|
467 |
+
<tr class="em-hr">
|
468 |
+
<th><?php esc_html_e('Total Price','events-manager'); ?></th>
|
469 |
+
<th> </th>
|
470 |
+
<th><?php echo $price_summary['total']; ?></th>
|
471 |
+
</tr>
|
472 |
+
<?php do_action('em_bookings_admin_ticket_totals_footer', $EM_Booking); ?>
|
473 |
+
</tfoot>
|
474 |
+
</table>
|
475 |
+
<table class="em-form-fields" cellspacing="0" cellpadding="0">
|
476 |
+
<?php if( !has_action('em_bookings_single_custom') ): //default behavior ?>
|
477 |
+
<tr>
|
478 |
+
<th><?php esc_html_e('Comment','events-manager'); ?></th>
|
479 |
+
<td>
|
480 |
+
<span class="em-booking-single-info"><?php echo esc_html($EM_Booking->booking_comment); ?></span>
|
481 |
+
<div class="em-booking-single-edit"><textarea name="booking_comment"><?php echo esc_html($EM_Booking->booking_comment); ?></textarea></div>
|
482 |
+
</td>
|
483 |
+
</tr>
|
484 |
+
<?php else: do_action('em_bookings_single_custom',$EM_Booking); //do your own thing, e.g. pro ?>
|
485 |
+
<?php endif; ?>
|
486 |
+
</table>
|
487 |
+
<p class="em-booking-single-info">
|
488 |
+
<input type="button" class="button-secondary em-button em-booking-submit-modify" id="em-booking-submit-modify" value="<?php esc_attr_e('Modify Booking', 'events-manager'); ?>" />
|
489 |
+
</p>
|
490 |
+
<p class="em-booking-single-edit">
|
491 |
+
<em><?php _e('<strong>Notes:</strong> Ticket availability not taken into account (i.e. you can overbook). Emails are not resent automatically.','events-manager'); ?></em>
|
492 |
+
<br /><br />
|
493 |
+
<input type="submit" class="button-primary em-button em-booking-submit" id="em-booking-submit" value="<?php esc_attr_e('Submit Changes', 'events-manager'); ?>" />
|
494 |
+
<input type="button" class="button-secondary em-button em-booking-submit-cancel" id="em-booking-submit-cancel" value="<?php esc_attr_e('Cancel', 'events-manager'); ?>" />
|
495 |
+
<input type='hidden' name='action' value='booking_save'/>
|
496 |
+
<input type='hidden' name='booking_id' value='<?php echo $EM_Booking->booking_id; ?>'/>
|
497 |
+
<input type='hidden' name='event_id' value='<?php echo $EM_Event->event_id; ?>'/>
|
498 |
+
<input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_save_'.$EM_Booking->booking_id); ?>'/>
|
499 |
+
</p>
|
500 |
+
</form>
|
501 |
+
<script type="text/javascript">
|
502 |
+
jQuery(document).ready( function($){
|
503 |
+
$('#em-booking-submit-modify').on('click', function(){
|
504 |
+
$('.em-booking-single-info').hide();
|
505 |
+
$('.em-booking-single-edit').show();
|
506 |
+
});
|
507 |
+
$('#em-booking-submit-cancel').on('click', function(){
|
508 |
+
$('.em-booking-single-info').show();
|
509 |
+
$('.em-booking-single-edit').hide();
|
510 |
+
});
|
511 |
+
$('.em-booking-single-info').show();
|
512 |
+
$('.em-booking-single-edit').hide();
|
513 |
+
|
514 |
+
$('#em-booking-submit-status-modify').on('click', function(){
|
515 |
+
$('.em-booking-single-status-info').hide();
|
516 |
+
$('.em-booking-single-status-edit').show();
|
517 |
+
});
|
518 |
+
$('#em-booking-submit-status-cancel').on('click', function(){
|
519 |
+
$('.em-booking-single-status-info').show();
|
520 |
+
$('.em-booking-single-status-edit').hide();
|
521 |
+
});
|
522 |
+
$('.em-booking-single-status-info').show();
|
523 |
+
$('.em-booking-single-status-edit').hide();
|
524 |
+
});
|
525 |
+
</script>
|
526 |
+
<?php do_action('em_bookings_single_details_footer', $EM_Booking); ?>
|
527 |
+
</div>
|
528 |
+
</div>
|
529 |
+
<div id="em-booking-notes" class="postbox">
|
530 |
+
<h3>
|
531 |
+
<?php esc_html_e( 'Booking Notes', 'events-manager'); ?>
|
532 |
+
</h3>
|
533 |
+
<div class="inside">
|
534 |
+
<p><?php esc_html_e('You can add private notes below for internal reference that only event managers will see.','events-manager'); ?></p>
|
535 |
+
<?php foreach( $EM_Booking->get_notes() as $note ):
|
536 |
+
$user = new EM_Person($note['author']);
|
537 |
+
?>
|
538 |
+
<div>
|
539 |
+
<?php echo sprintf(esc_html_x('%1$s - %2$s wrote','[Date] - [Name] wrote','events-manager'), date(get_option('date_format'), $note['timestamp']), $user->get_name()); ?>:
|
540 |
+
<p style="background:#efefef; padding:5px;"><?php echo nl2br($note['note']); ?></p>
|
541 |
+
</div>
|
542 |
+
<?php endforeach; ?>
|
543 |
+
<form method="post" action="" style="padding:5px;">
|
544 |
+
<textarea class="widefat" rows="5" name="booking_note"></textarea>
|
545 |
+
<input type="hidden" name="action" value="bookings_add_note" />
|
546 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('bookings_add_note'); ?>" />
|
547 |
+
<input type="submit" class="em-button button-primary" value="<?php esc_html_e('Add Note', 'events-manager'); ?>" />
|
548 |
+
</form>
|
549 |
+
</div>
|
550 |
+
</div>
|
551 |
+
<?php do_action('em_bookings_single_metabox_footer', $EM_Booking); ?>
|
552 |
+
</div>
|
553 |
+
</div>
|
554 |
+
<br style="clear:both;" />
|
555 |
+
<?php do_action('em_bookings_single_footer', $EM_Booking); ?>
|
556 |
+
</div>
|
557 |
+
</div>
|
558 |
+
<?php
|
559 |
+
|
560 |
+
}
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Shows all bookings made by one person.
|
564 |
+
*/
|
565 |
+
function em_bookings_person(){
|
566 |
+
global $EM_Person, $EM_Notices;
|
567 |
+
$EM_Person->get_bookings();
|
568 |
+
$has_booking = false;
|
569 |
+
foreach($EM_Person->get_bookings() as $EM_Booking){
|
570 |
+
if($EM_Booking->can_manage('manage_bookings','manage_others_bookings')){
|
571 |
+
$has_booking = true;
|
572 |
+
}
|
573 |
+
}
|
574 |
+
if( !$has_booking && !current_user_can('manage_others_bookings') ){
|
575 |
+
?>
|
576 |
+
<div class="wrap <?php em_template_classes('bookings-admin'); ?>">
|
577 |
+
<h2><?php esc_html_e('Unauthorized Access','events-manager'); ?></h2>
|
578 |
+
<p><?php esc_html_e('You do not have the rights to manage this event.','events-manager'); ?></p>
|
579 |
+
</div>
|
580 |
+
<?php
|
581 |
+
return false;
|
582 |
+
}
|
583 |
+
$header_button_classes = is_admin() ? 'page-title-action':'button add-new-h2';
|
584 |
+
?>
|
585 |
+
<div class='em-bookings-admin-person <?php em_template_classes('bookings-admin'); ?>'>
|
586 |
+
<div class="input">
|
587 |
+
<?php if( is_admin() ): ?><h1 class="wp-heading-inline"><?php else: ?><h2><?php endif; ?>
|
588 |
+
<?php esc_html_e('Manage Person\'s Booking', 'events-manager'); ?>
|
589 |
+
<?php if( is_admin() ): ?></h1><?php endif; ?>
|
590 |
+
<?php if( current_user_can('edit_users') ) : ?>
|
591 |
+
<a href="<?php echo admin_url('user-edit.php?user_id='.$EM_Person->ID); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Edit User','events-manager') ?></a>
|
592 |
+
<?php endif; ?>
|
593 |
+
<?php if( current_user_can('delete_users') ) : ?>
|
594 |
+
<a href="<?php echo wp_nonce_url( admin_url("users.php?action=delete&user=$EM_Person->ID"), 'bulk-users' ); ?>" class="<?php echo $header_button_classes; ?>"><?php esc_html_e('Delete User','events-manager') ?></a>
|
595 |
+
<?php endif; ?>
|
596 |
+
<?php if( !is_admin() ): ?></h2><?php else: ?><hr class="wp-header-end" /><?php endif; ?>
|
597 |
+
<?php if( !is_admin() ) echo $EM_Notices; ?>
|
598 |
+
<?php do_action('em_bookings_person_header'); ?>
|
599 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
600 |
+
<div id="post-body">
|
601 |
+
<div id="post-body-content">
|
602 |
+
<div id="event_name" class="stuffbox">
|
603 |
+
<h3>
|
604 |
+
<?php esc_html_e( 'Personal Details', 'events-manager'); ?>
|
605 |
+
</h3>
|
606 |
+
<div class="inside">
|
607 |
+
<?php echo $EM_Person->display_summary(); ?>
|
608 |
+
</div>
|
609 |
+
</div>
|
610 |
+
</div>
|
611 |
+
</div>
|
612 |
+
</div>
|
613 |
+
<br style="clear:both;" />
|
614 |
+
<?php do_action('em_bookings_person_body_1'); ?>
|
615 |
+
<h2><?php esc_html_e('Past And Present Bookings','events-manager'); ?></h2>
|
616 |
+
<?php
|
617 |
+
$EM_Bookings_Table = new EM_Bookings_Table();
|
618 |
+
$EM_Bookings_Table->status = 'all';
|
619 |
+
$EM_Bookings_Table->scope = 'all';
|
620 |
+
$EM_Bookings_Table->output();
|
621 |
+
?>
|
622 |
+
<?php do_action('em_bookings_person_footer', $EM_Person); ?>
|
623 |
+
</div>
|
624 |
+
</div>
|
625 |
+
<?php
|
626 |
+
}
|
627 |
+
|
628 |
+
function em_printable_booking_report() {
|
629 |
+
global $EM_Event;
|
630 |
+
//check that user can access this page
|
631 |
+
if( isset($_GET['page']) && $_GET['page']=='events-manager-bookings' && isset($_GET['action']) && $_GET['action'] == 'bookings_report' && is_object($EM_Event)){
|
632 |
+
if( is_object($EM_Event) && !$EM_Event->can_manage('edit_events','edit_others_events') ){
|
633 |
+
?>
|
634 |
+
<div class="wrap <?php em_template_classes('bookings-admin'); ?>">
|
635 |
+
<h2><?php esc_html_e('Unauthorized Access','events-manager'); ?></h2>
|
636 |
+
<p><?php esc_html_e('You do not have the rights to manage this event.','events-manager'); ?></p>
|
637 |
+
</div>
|
638 |
+
<?php
|
639 |
+
return false;
|
640 |
+
}
|
641 |
+
em_locate_template('templates/bookings-event-printable.php', true);
|
642 |
+
die();
|
643 |
+
}
|
644 |
+
}
|
645 |
+
add_action('admin_init', 'em_printable_booking_report');
|
646 |
+
?>
|
trunk/admin/em-data-privacy.php
ADDED
@@ -0,0 +1,531 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* This file deals with new privacy tools included in WP 4.9.6 and in line with aiding users with conforming to the GPDR rules.
|
4 |
+
* Note that consent mechanisms are not included here and will be baked directly into the templates or Pro booking forms.
|
5 |
+
*/
|
6 |
+
class EM_Data_Privacy {
|
7 |
+
|
8 |
+
public static function init(){
|
9 |
+
add_action( 'admin_init', 'EM_Data_Privacy::privacy_policy_content' );
|
10 |
+
add_filter( 'wp_privacy_personal_data_erasers', 'EM_Data_Privacy::register_eraser', 10 );
|
11 |
+
add_filter( 'wp_privacy_personal_data_exporters', 'EM_Data_Privacy::register_exporter', 10 );
|
12 |
+
add_action( 'wp_privacy_personal_data_export_file_created', 'EM_Data_Privacy::export_cleanup');
|
13 |
+
}
|
14 |
+
|
15 |
+
public static function privacy_policy_content() {
|
16 |
+
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$content = array();
|
21 |
+
$content[] = sprintf(
|
22 |
+
__('We use Google services to generate maps and provide autocompletion when searching for events by location, which may collect data via your browser in accordance to Google\'s <a href="%s">privacy policy</a>.', 'events-manager' ),
|
23 |
+
'https://policies.google.com/privacy'
|
24 |
+
);
|
25 |
+
$content[] = __('We collect and store information you submit to us when making a booking, for the purpose of reserving your requested spaces at our event and maintaining a record of attendance.', 'events-manager' );
|
26 |
+
$content[] = __('We collect and store information you submit to us about events (and corresponding locations) you would like to publish on our site.', 'events-manager' );
|
27 |
+
$content[] = __('We may use cookies to temporarily store information about a booking in progress as well as any error/confirmation messages whilst submitting or managing your events and locations.', 'events-manager' );
|
28 |
+
|
29 |
+
wp_add_privacy_policy_content(
|
30 |
+
__('Events Manager', 'events-manager'),
|
31 |
+
wp_kses_post( '<p>'. implode('</p><p>', $content) .'</p>' )
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
public static function register_eraser( $erasers ) {
|
36 |
+
if( get_option('dbem_data_privacy_erase_bookings') ){
|
37 |
+
$erasers['events-manager-bookings'] = array(
|
38 |
+
'eraser_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Bookings', 'events-manager'),
|
39 |
+
'callback' => 'EM_Data_Privacy::erase_bookings',
|
40 |
+
);
|
41 |
+
}
|
42 |
+
if( get_option('dbem_data_privacy_erase_events') ){
|
43 |
+
$erasers['events-manager-recurring-events'] = array(
|
44 |
+
'eraser_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Recurring Events', 'events-manager'),
|
45 |
+
'callback' => 'EM_Data_Privacy::erase_recurring_events',
|
46 |
+
);
|
47 |
+
$erasers['events-manager-events'] = array(
|
48 |
+
'eraser_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Events', 'events-manager'),
|
49 |
+
'callback' => 'EM_Data_Privacy::erase_events',
|
50 |
+
);
|
51 |
+
}
|
52 |
+
if( get_option('dbem_data_privacy_erase_locations') ){
|
53 |
+
$erasers['events-manager-locations'] = array(
|
54 |
+
'eraser_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Locations', 'events-manager'),
|
55 |
+
'callback' => 'EM_Data_Privacy::erase_locations',
|
56 |
+
);
|
57 |
+
}
|
58 |
+
//in this case we don't register location deletion because we only need to handle anonymous events, locations submitted anonymously shouldn't have any personal data associated with it (unless a user submitted their home address anonymously!)
|
59 |
+
return $erasers;
|
60 |
+
}
|
61 |
+
|
62 |
+
public static function erase_bookings( $email_address, $page = 1 ) {
|
63 |
+
$page = (int) $page;
|
64 |
+
$limit = apply_filters('em_data_privacy_export_limit', 100);
|
65 |
+
$messages = array();
|
66 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
67 |
+
|
68 |
+
if( $user !== false && get_option('dbem_data_privacy_erase_bookings') == 2 ){
|
69 |
+
//we're only deleting anonymous bookings, and letting WP handle user/booking deletion the traditional way for registered accounts
|
70 |
+
$done = true;
|
71 |
+
}else{
|
72 |
+
//get items to erase
|
73 |
+
$booking_ids = self::get_bookings($email_address, $page);
|
74 |
+
|
75 |
+
$items_removed = $items_retained = false;
|
76 |
+
foreach ( $booking_ids as $booking_id ) {
|
77 |
+
$EM_Booking = em_get_booking($booking_id);
|
78 |
+
if( $EM_Booking->delete() ){
|
79 |
+
$items_removed = true;
|
80 |
+
}else{
|
81 |
+
$items_retained = true;
|
82 |
+
$messages = array_merge($messages, $EM_Booking->get_errors());
|
83 |
+
}
|
84 |
+
}
|
85 |
+
if( $items_removed ) add_action('em_data_privacy_bookings_deleted', $booking_ids);
|
86 |
+
|
87 |
+
// Tell core if we have more comments to work on still
|
88 |
+
$done = count( $booking_ids ) < $limit;
|
89 |
+
}
|
90 |
+
return array(
|
91 |
+
'items_removed' => $items_removed,
|
92 |
+
'items_retained' => $items_retained, // always false in this example
|
93 |
+
'messages' => $messages, // no messages in this example
|
94 |
+
'done' => $done,
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
public static function erase_recurring_events( $email_address, $page = 1 ) {
|
99 |
+
return self::erase_events( $email_address, $page, 'event-recurring');
|
100 |
+
}
|
101 |
+
|
102 |
+
public static function erase_events( $email_address, $page = 1, $post_type = false ) {
|
103 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
104 |
+
if( !$post_type ) $post_type = EM_POST_TYPE_EVENT; //default to event
|
105 |
+
$page = (int) $page;
|
106 |
+
$limit = apply_filters('em_data_privacy_erase_limit', 100);
|
107 |
+
$items_removed = $items_retained = false;
|
108 |
+
$messages = array();
|
109 |
+
|
110 |
+
if( $user !== false && get_option('dbem_data_privacy_erase_events') == 2 ){
|
111 |
+
//we're only deleting anonymous events, and letting WP handle CPT deletion the traditional way for registered accounts
|
112 |
+
$done = true;
|
113 |
+
}else{
|
114 |
+
//get event IDs submitted by user or "anonymously" by email
|
115 |
+
$events = self::get_cpts($email_address, $page, $post_type);
|
116 |
+
|
117 |
+
foreach( $events as $post_id ){
|
118 |
+
$EM_Event = em_get_event($post_id, 'post_id');
|
119 |
+
//erase the location first
|
120 |
+
$EM_Location = $EM_Event->get_location();
|
121 |
+
if( $EM_Location->location_id && get_option('dbem_data_privacy_erase_locations', 2) ){
|
122 |
+
//prior to 5.9.3 locations submitted alongside anonymous events didn't store email info, so for older locations we can only assume if the location is guest submitted and only linked to this one event
|
123 |
+
$user_probably_owns_location = $user === false && empty($EM_Location->owner_email) && $EM_Location->location_owner == get_option('dbem_events_anonymous_user');
|
124 |
+
if( $user_probably_owns_location ){
|
125 |
+
//depending on settings delete location only if it has no other events (eventually if we're deleting the last event of this user with the same location, it'll only have one event)
|
126 |
+
if( get_option('dbem_data_privacy_erase_locations', 2) == 1 || EM_Events::count(array('location_id' => $EM_Location->location_id, 'status' => 'all')) <= 1 ){
|
127 |
+
if( $EM_Location->delete(true) ){
|
128 |
+
$items_removed = true;
|
129 |
+
}else{
|
130 |
+
$items_retained = true;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
//now erase the event
|
136 |
+
if( $EM_Event->delete(true) ){
|
137 |
+
$items_removed = true;
|
138 |
+
}else{
|
139 |
+
$items_retained = true;
|
140 |
+
$messages = array_merge($messages, $EM_Event->get_errors());
|
141 |
+
}
|
142 |
+
}
|
143 |
+
// Tell core if we have more comments to work on still
|
144 |
+
$done = count( $events ) < $limit;
|
145 |
+
}
|
146 |
+
return array(
|
147 |
+
'items_removed' => $items_removed,
|
148 |
+
'items_retained' => $items_retained, // always false in this example
|
149 |
+
'messages' => $messages, // no messages in this example
|
150 |
+
'done' => $done,
|
151 |
+
);
|
152 |
+
}
|
153 |
+
|
154 |
+
public static function erase_locations( $email_address, $page = 1 ) {
|
155 |
+
$page = (int) $page;
|
156 |
+
$limit = apply_filters('em_data_privacy_erase_limit', 100);
|
157 |
+
$items_removed = $items_retained = false;
|
158 |
+
$messages = array();
|
159 |
+
|
160 |
+
$locations_count = 0;
|
161 |
+
$locations = self::get_cpts($email_address, $page, EM_POST_TYPE_LOCATION);
|
162 |
+
foreach( $locations as $post_id ){
|
163 |
+
$EM_Location = em_get_location( $post_id, 'post_id' ); /* @var EM_Location $EM_Location */
|
164 |
+
if( $EM_Location->delete(true) ){
|
165 |
+
$items_removed = true;
|
166 |
+
}else{
|
167 |
+
$items_retained = true;
|
168 |
+
$messages = array_merge($messages, $EM_Location->get_errors());
|
169 |
+
}
|
170 |
+
$locations_count++;
|
171 |
+
}
|
172 |
+
// Tell core if we have more comments to work on still
|
173 |
+
$done = $locations_count < $limit;
|
174 |
+
return array(
|
175 |
+
'items_removed' => $items_removed,
|
176 |
+
'items_retained' => $items_retained, // always false in this example
|
177 |
+
'messages' => $messages, // no messages in this example
|
178 |
+
'done' => $done,
|
179 |
+
);
|
180 |
+
}
|
181 |
+
|
182 |
+
public static function register_exporter( $exporters ) {
|
183 |
+
$exporters['events-manager-user'] = array(
|
184 |
+
'exporter_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' .__( 'Further Information', 'events-manager' ),
|
185 |
+
'callback' => 'EM_Data_Privacy::export_user',
|
186 |
+
);
|
187 |
+
if( get_option('dbem_data_privacy_export_bookings') ){
|
188 |
+
$exporters['events-manager-bookings'] = array(
|
189 |
+
'exporter_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Bookings', 'events-manager'),
|
190 |
+
'callback' => 'EM_Data_Privacy::export_bookings',
|
191 |
+
);
|
192 |
+
}
|
193 |
+
if( get_option('dbem_data_privacy_export_events') ){
|
194 |
+
$exporters['events-manager-recurring-events'] = array(
|
195 |
+
'exporter_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Recurring Events', 'events-manager'),
|
196 |
+
'callback' => 'EM_Data_Privacy::export_recurring_events',
|
197 |
+
);
|
198 |
+
$exporters['events-manager-events'] = array(
|
199 |
+
'exporter_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Events', 'events-manager'),
|
200 |
+
'callback' => 'EM_Data_Privacy::export_events',
|
201 |
+
);
|
202 |
+
}
|
203 |
+
if( get_option('dbem_data_privacy_export_locations') ){
|
204 |
+
$exporters['events-manager-locations'] = array(
|
205 |
+
'exporter_friendly_name' => __( 'Events Manager', 'events-manager' ) . ' - ' . __('Locations', 'events-manager'),
|
206 |
+
'callback' => 'EM_Data_Privacy::export_locations',
|
207 |
+
);
|
208 |
+
}
|
209 |
+
return $exporters;
|
210 |
+
}
|
211 |
+
|
212 |
+
public static function export_cleanup(){
|
213 |
+
delete_post_meta( absint($_REQUEST['id']), '_em_locations_exported');
|
214 |
+
delete_post_meta( absint($_REQUEST['id']), '_em_bookings_exported' );
|
215 |
+
}
|
216 |
+
|
217 |
+
public static function export_user( $email_address ){
|
218 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
219 |
+
$export_items = array();
|
220 |
+
if( $user !== false ){
|
221 |
+
//we add to the WP User section
|
222 |
+
$data_to_export[] = array(
|
223 |
+
'group_id' => 'user',
|
224 |
+
'group_label' => __( 'User' ),
|
225 |
+
'item_id' => "user-{$user->ID}",
|
226 |
+
'data' => array(),
|
227 |
+
);
|
228 |
+
$dbem_phone = get_user_meta($user->ID, 'dbem_phone', true);
|
229 |
+
if( !empty($dbem_phone) ){
|
230 |
+
$export_item['data'][] = array( 'name' => __('Phone', 'events-manager'), 'value' => $dbem_phone );
|
231 |
+
}
|
232 |
+
$export_item = apply_filters('em_data_privacy_export_user', $export_item, $user);
|
233 |
+
if( !empty($export_item['data']) ){
|
234 |
+
$export_items[] = $export_item;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
return array(
|
238 |
+
'data' => $export_items,
|
239 |
+
'done' => true,
|
240 |
+
);
|
241 |
+
}
|
242 |
+
|
243 |
+
public static function export_bookings( $email_address, $page = 1 ) {
|
244 |
+
$page = (int) $page;
|
245 |
+
$limit = apply_filters('em_data_privacy_export_limit', 100);
|
246 |
+
|
247 |
+
$export_items = array();
|
248 |
+
$items_count = 0;
|
249 |
+
|
250 |
+
//check if we're only exporting bookings to those who made anonymous bookings
|
251 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
252 |
+
if( $user !== false && get_option('dbem_data_privacy_export_bookings') == 2 ) return array( 'data' => $export_items, 'done' => true ); //return if user is registered and we're only exporting anon bookings
|
253 |
+
|
254 |
+
$bookings = self::get_bookings($email_address, $page);
|
255 |
+
|
256 |
+
$booking_export_default = array(
|
257 |
+
'group_id' => 'events-manager-bookings',
|
258 |
+
'group_label' => __('Bookings', 'events-manager'),
|
259 |
+
'item_id' => 'booking-ID', //replace ID with booking ID
|
260 |
+
'data' => array() // replace this with assoc array of name/value key arrays
|
261 |
+
);
|
262 |
+
$booking_price_adjustments = array(
|
263 |
+
'discounts_pre_tax' => __('Discounts Before Taxes','events-manager'),
|
264 |
+
'surcharges_pre_tax' => __('Surcharges Before Taxes','events-manager'),
|
265 |
+
'discounts_post_tax' => __('Discounts (After Taxes)','events-manager'),
|
266 |
+
'surcharges_post_tax' => __('Surcharges (After Taxes)','events-manager')
|
267 |
+
);
|
268 |
+
|
269 |
+
foreach ( $bookings as $booking_id ) {
|
270 |
+
$EM_Booking = em_get_booking($booking_id);
|
271 |
+
$export_item = $booking_export_default;
|
272 |
+
$export_item['item_id'] = 'booking-'.$EM_Booking->booking_id;
|
273 |
+
$export_item['data']['status'] = array('name' => __('Status','events-manager'), 'value' => $EM_Booking->get_status() );
|
274 |
+
$export_item['data']['date'] = array('name' => __('Date','events-manager'), 'value' => $EM_Booking->date()->getDateTime() . ' ' . $EM_Booking->date()->getTimezone()->getName() );
|
275 |
+
$export_item['data']['event'] = array('name' => __('Event','events-manager'), 'value' => $EM_Booking->get_event()->output('#_EVENTLINK - #_EVENTDATES @ #_EVENTTIMES') );
|
276 |
+
if( $EM_Booking->person_id == 0 ){
|
277 |
+
foreach( $EM_Booking->get_person()->get_summary() as $key => $info ){
|
278 |
+
$export_item['data']['field-'.$key] = $info;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
$booking_tickets = array();
|
282 |
+
foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking){ /* @var EM_Ticket_Booking $EM_Ticket_Booking */
|
283 |
+
$booking_tickets[] = $EM_Ticket_Booking->get_ticket()->ticket_name . ' x '. $EM_Ticket_Booking->get_spaces() . ' @ ' . $EM_Ticket_Booking->get_price(true);
|
284 |
+
}
|
285 |
+
$export_item['data']['tickets'] = array('name' => __('Tickets', 'events-manager-pro'), 'value' => implode('<br>', $booking_tickets));
|
286 |
+
$export_item['data']['sub-total'] = array('name' => __('Sub Total','events-manager'), 'value' => $EM_Booking->get_price_base(true));
|
287 |
+
$price_summary = $EM_Booking->get_price_summary_array();
|
288 |
+
foreach( $booking_price_adjustments as $adjustment_key => $adjustment_title ){
|
289 |
+
if( count($price_summary[$adjustment_key]) > 0 ){
|
290 |
+
$adjustments = array();
|
291 |
+
foreach( $price_summary[$adjustment_key] as $adjustment ){
|
292 |
+
$adjustments[] = "{$adjustment['name']} @ {$adjustment['amount']}";
|
293 |
+
}
|
294 |
+
$export_item['data'][$adjustment_key] = array('name' => $adjustment_title, 'value' => implode('<br>', $adjustments));
|
295 |
+
}
|
296 |
+
}
|
297 |
+
if( !empty($price_summary['taxes']['amount']) ){
|
298 |
+
$export_item['data']['taxes'] = array('name' => __('Taxes','events-manager'), 'value' => "({$price_summary['taxes']['rate']}) {$price_summary['taxes']['amount']}");
|
299 |
+
}
|
300 |
+
$export_item['data']['total'] = array('name' => __('Total Price','events-manager'), 'value' => $price_summary['total']);
|
301 |
+
//booking notes - can be exempt with a filter since maybe notes have private info
|
302 |
+
if( apply_filters('em_data_privacy_export_bookings_include_notes', true, $EM_Booking) ){
|
303 |
+
$booking_notes = $EM_Booking->get_notes();
|
304 |
+
if( !empty($booking_notes) ){
|
305 |
+
$booking_notes_data = array();
|
306 |
+
foreach( $booking_notes as $booking_note ){
|
307 |
+
$booking_notes_data[] = date(get_option('date_format'), $booking_note['timestamp']) .' - '. $booking_note['note'];
|
308 |
+
}
|
309 |
+
$export_item['data']['notes'] = array('name' => __( 'Booking Notes', 'events-manager'), 'value' => implode('<br><br>', $booking_notes_data));
|
310 |
+
}
|
311 |
+
}
|
312 |
+
$export_item = apply_filters('em_data_privacy_export_bookings_item', $export_item, $EM_Booking);
|
313 |
+
$export_items[] = $export_item;
|
314 |
+
$export_items = apply_filters('em_data_privacy_export_bookings_items_after_item', $export_items, $export_item, $EM_Booking); //could be used for cross-referencing and add-ing other groups e.g. Multiple Bookings in Pro
|
315 |
+
$items_count++;
|
316 |
+
if( $items_count == $limit ) break;
|
317 |
+
}
|
318 |
+
|
319 |
+
$done = $items_count < $limit; //if we didn't reach limit of bookings then we must be done
|
320 |
+
return array(
|
321 |
+
'data' => $export_items,
|
322 |
+
'done' => $done,
|
323 |
+
);
|
324 |
+
}
|
325 |
+
|
326 |
+
public static function export_recurring_events( $email_address, $page = 1){
|
327 |
+
return self::export_events( $email_address, $page, 'event-recurring' );
|
328 |
+
}
|
329 |
+
|
330 |
+
public static function export_events( $email_address, $page = 1, $post_type = false ) {
|
331 |
+
if( !$post_type ) $post_type = EM_POST_TYPE_EVENT; //default to event
|
332 |
+
$page = (int) $page;
|
333 |
+
$limit = apply_filters('em_data_privacy_export_limit', 100);
|
334 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
335 |
+
$export_items = array();
|
336 |
+
$items_count = 0;
|
337 |
+
|
338 |
+
//check if we're only exporting events to those who submitted anonymously
|
339 |
+
if( $user !== false && get_option('dbem_data_privacy_export_events') == 2 ) return array( 'data' => $export_items, 'done' => true ); //return if user is registered and we're only exporting anon events
|
340 |
+
|
341 |
+
//prepare some location stuff for use within events
|
342 |
+
$locations_export_default = array(
|
343 |
+
'group_id' => 'events-manager-'.EM_POST_TYPE_LOCATION,
|
344 |
+
'group_label' => __('Locations', 'events-manager'),
|
345 |
+
'item_id' => 'location-post-ID', //replace ID with booking ID
|
346 |
+
'data' => array() // replace this with assoc array of name/value key arrays
|
347 |
+
);
|
348 |
+
$locations_exported = get_post_meta( absint($_REQUEST['id']), '_em_locations_exported', true);
|
349 |
+
if( empty($locations_exported) ) $locations_exported = array();
|
350 |
+
|
351 |
+
//EVENTS
|
352 |
+
$event_export_default = array(
|
353 |
+
'group_id' => 'events-manager-'.$post_type,
|
354 |
+
'item_id' => 'event-post-ID', //replace ID with booking ID
|
355 |
+
'data' => array() // replace this with assoc array of name/value key arrays
|
356 |
+
);
|
357 |
+
$event_export_default['group_label'] = $post_type == 'event-recurring' ? __('Recurring Events', 'events-manager'):__('Events', 'events-manager');
|
358 |
+
|
359 |
+
//get event IDs submitted by user or "anonymously" by email
|
360 |
+
$events = self::get_cpts($email_address, $page, $post_type);
|
361 |
+
|
362 |
+
foreach( $events as $post_id ){
|
363 |
+
$EM_Event = em_get_event($post_id, 'post_id');
|
364 |
+
$export_item = $event_export_default;
|
365 |
+
$export_item['item_id'] = 'event-post-'.$EM_Event->post_id;
|
366 |
+
$export_item['data'][] = array('name' => __('Event Name','events-manager'), 'value' => $EM_Event->event_name );
|
367 |
+
$export_item['data'][] = array('name' => sprintf(__('%s Status','events-manager'), __('Event','events-manager')), 'value' => $EM_Event->post_status );
|
368 |
+
if( $post_type == EM_POST_TYPE_EVENT && $EM_Event->event_status == 1 ){
|
369 |
+
$export_item['data'][] = array('name' => sprintf(__('%s URL','events-manager'), __('Event','events-manager')), 'value' => $EM_Event->get_permalink() );
|
370 |
+
}
|
371 |
+
if( $post_type == 'event-recurring' ){
|
372 |
+
$export_item['data'][] = array('name' => __('When','events-manager'), 'value' => $EM_Event->output('#_EVENTDATES @ #_EVENTTIMES').'<br>'.$EM_Event->get_recurrence_description() );
|
373 |
+
}else{
|
374 |
+
$export_item['data'][] = array('name' => __('When','events-manager'), 'value' => $EM_Event->output('#_EVENTDATES @ #_EVENTTIMES') );
|
375 |
+
}
|
376 |
+
$export_item['data'][] = array('name' => __('Timezone','events-manager'), 'value' => $EM_Event->start()->getTimezone()->getName() );
|
377 |
+
if( !empty($EM_Event->event_owner_name) ) $export_item['data'][] = array('name' => __('Name','events-manager'), 'value' => $EM_Event->event_owner_name );
|
378 |
+
if( $EM_Event->get_location()->location_id ){
|
379 |
+
$EM_Location = $EM_Event->get_location();
|
380 |
+
$export_item['data'][] = array('name' => __('Location','events-manager'), 'value' => $EM_Location->location_name . ', '. $EM_Location->get_full_address() .', '. $EM_Location->location_country);
|
381 |
+
//put this location as a new export item
|
382 |
+
$already_exported = in_array($EM_Location->location_id, $locations_exported);
|
383 |
+
$user_probably_owns_location = $user === false && empty($EM_Location->owner_email) && $EM_Location->location_owner == get_option('dbem_events_anonymous_user');
|
384 |
+
$user_submitted_location = $user === false && $EM_Location->owner_email == $email_address;
|
385 |
+
$user_owns_location = $user !== false && $EM_Location->location_owner == $user->ID;
|
386 |
+
if( !$already_exported && ($user_owns_location || $user_submitted_location || $user_probably_owns_location) ){
|
387 |
+
$location_export_item = $locations_export_default;
|
388 |
+
$location_export_item['item_id'] = 'location-post-'.$EM_Location->post_id;
|
389 |
+
$location_export_item['data'][] = array('name' => __('Name','events-manager'), 'value' => $EM_Location->location_name );
|
390 |
+
$location_export_item['data'][] = array('name' => __('Address','events-manager'), 'value' => $EM_Location->get_full_address() .', '. $EM_Location->location_country );
|
391 |
+
$location_export_item['data'][] = array('name' => __('Coordinates','events-manager'), 'value' => $EM_Location->location_latitude .', '. $EM_Location->location_longitude );
|
392 |
+
$location_export_item['data'][] = array('name' => sprintf(__('%s Status','events-manager'), __('Location','events-manager')), 'value' => $EM_Location->post_status );
|
393 |
+
if( $EM_Location->post_status == 'publish' ){
|
394 |
+
$location_export_item['data'][] = array('name' => sprintf(__('%s URL','events-manager'), __('Location','events-manager')), 'value' => $EM_Location->get_permalink() );
|
395 |
+
}
|
396 |
+
foreach( $EM_Location->location_attributes as $k => $v ){
|
397 |
+
$location_export_item['data'][] = array('name' => $k, 'value' => $v);
|
398 |
+
}
|
399 |
+
$location_export_item = apply_filters('em_data_privacy_export_locations_item', $location_export_item, $EM_Location);
|
400 |
+
$export_items[] = $location_export_item;
|
401 |
+
$export_items = apply_filters('em_data_privacy_export_locations_items_after_item', $export_items, $location_export_item, $EM_Location); //could be used for cross-referencing and add-ing other groups e.g. Multiple Bookings in Pro
|
402 |
+
$items_count++;
|
403 |
+
$locations_exported[] = $EM_Location->location_id;
|
404 |
+
}
|
405 |
+
}
|
406 |
+
if( $EM_Event->event_rsvp ){
|
407 |
+
$tickets = array();
|
408 |
+
foreach( $EM_Event->get_tickets() as $EM_Ticket ){ /* @var EM_Ticket $EM_Ticket */
|
409 |
+
$ticket = array($EM_Ticket->ticket_name, $EM_Ticket->ticket_description, $EM_Ticket->get_price(true));
|
410 |
+
if( empty($EM_Ticket->ticket_description) ) unset($ticket[1]);
|
411 |
+
$tickets[] = implode( ' - ', $ticket);
|
412 |
+
}
|
413 |
+
$export_item['data'][] = array('name' => __('Tickets','events-manager'), 'value' => implode('<br>', $tickets) );
|
414 |
+
}
|
415 |
+
foreach( $EM_Event->event_attributes as $k => $v ){
|
416 |
+
$export_item['data'][] = array('name' => $k, 'value' => $v);
|
417 |
+
}
|
418 |
+
$export_item = apply_filters('em_data_privacy_export_events_item', $export_item, $EM_Event);
|
419 |
+
$export_items[] = $export_item;
|
420 |
+
$export_items = apply_filters('em_data_privacy_export_events_items_after_item', $export_items, $export_item, $EM_Event); //could be used for cross-referencing and add-ing other groups e.g. Multiple Bookings in Pro
|
421 |
+
$items_count++;
|
422 |
+
if( $items_count >= $limit ) break;
|
423 |
+
}
|
424 |
+
|
425 |
+
$done = $items_count < $limit; //if we didn't reach limit of bookings then we must be done
|
426 |
+
update_post_meta( absint($_REQUEST['id']), '_em_locations_exported', $locations_exported);
|
427 |
+
return array(
|
428 |
+
'data' => $export_items,
|
429 |
+
'done' => $done,
|
430 |
+
);
|
431 |
+
}
|
432 |
+
|
433 |
+
public static function export_locations( $email_address, $page = 1 ) {
|
434 |
+
$page = (int) $page;
|
435 |
+
$limit = apply_filters('em_data_privacy_export_limit', 100);
|
436 |
+
$offset = ($page -1) * $limit;
|
437 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
438 |
+
$export_items = array();
|
439 |
+
$items_count = 0;
|
440 |
+
|
441 |
+
$locations_export_default = array(
|
442 |
+
'group_id' => 'events-manager-'.EM_POST_TYPE_LOCATION,
|
443 |
+
'group_label' => __('Locations', 'events-manager'),
|
444 |
+
'item_id' => 'location-post-ID', //replace ID with booking ID
|
445 |
+
'data' => array() // replace this with assoc array of name/value key arrays
|
446 |
+
);
|
447 |
+
|
448 |
+
//Locations - previous to 5.9.4 locations submitted anonymously did nint include
|
449 |
+
$locations_exported = get_post_meta( absint($_REQUEST['id']), '_em_locations_exported', true );
|
450 |
+
if( empty($locations_exported) ) $locations_exported = array();
|
451 |
+
|
452 |
+
$locations = self::get_cpts($email_address, $page, EM_POST_TYPE_LOCATION);
|
453 |
+
foreach( $locations as $post_id ){
|
454 |
+
$EM_Location = em_get_location( $post_id, 'post_id' ); /* @var EM_Location $EM_Location */
|
455 |
+
if( !in_array($EM_Location->location_id, $locations_exported) ){
|
456 |
+
$location_export_item = $locations_export_default;
|
457 |
+
$location_export_item['item_id'] = 'event-post-'.$EM_Location->post_id;
|
458 |
+
$location_export_item['data'][] = array('name' => __('Name','events-manager'), 'value' => $EM_Location->location_name );
|
459 |
+
$location_export_item['data'][] = array('name' => sprintf(__('%s Status','events-manager'), __('Location','events-manager')), 'value' => $EM_Location->post_status );
|
460 |
+
if( $EM_Location->post_status == 'publish' ){
|
461 |
+
$location_export_item['data'][] = array('name' => sprintf(__('%s URL','events-manager'), __('Location','events-manager')), 'value' => $EM_Location->get_permalink() );
|
462 |
+
}
|
463 |
+
$location_export_item['data'][] = array('name' => __('Address','events-manager'), 'value' => $EM_Location->get_full_address() .', '. $EM_Location->location_country );
|
464 |
+
$location_export_item['data'][] = array('name' => __('Coordinates','events-manager'), 'value' => $EM_Location->location_latitude .', '. $EM_Location->location_longitude );
|
465 |
+
foreach( $EM_Location->location_attributes as $k => $v ){
|
466 |
+
$location_export_item['data'][] = array('name' => $k, 'value' => $v);
|
467 |
+
}
|
468 |
+
$location_export_item = apply_filters('em_data_privacy_export_locations_item', $location_export_item, $EM_Location);
|
469 |
+
$export_items[] = $location_export_item;
|
470 |
+
$export_items = apply_filters('em_data_privacy_export_locations_items_after_item', $export_items, $location_export_item, $EM_Location); //could be used for cross-referencing and add-ing other groups e.g. Multiple Bookings in Pro
|
471 |
+
$locations_exported[] = $EM_Location->location_id;
|
472 |
+
$items_count++;
|
473 |
+
if( $items_count == $limit ) break;
|
474 |
+
}
|
475 |
+
}
|
476 |
+
update_post_meta( absint($_REQUEST['id']), '_em_locations_exported', $locations_exported );
|
477 |
+
$done = $items_count < $limit; //if we didn't reach limit of bookings then we must be done
|
478 |
+
return array(
|
479 |
+
'data' => $export_items,
|
480 |
+
'done' => $done,
|
481 |
+
);
|
482 |
+
}
|
483 |
+
|
484 |
+
public static function get_cpts($email_address, $page, $post_type ){
|
485 |
+
global $wpdb;
|
486 |
+
$page = (int) $page;
|
487 |
+
$limit = apply_filters('em_data_privacy_export_limit', 100);
|
488 |
+
$offset = ($page -1) * $limit;
|
489 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
490 |
+
$anon_email_key = $post_type == EM_POST_TYPE_LOCATION ? '_owner_email':'_event_owner_email';
|
491 |
+
//get event IDs submitted by user or "anonymously" by email
|
492 |
+
$events = array();
|
493 |
+
if( $user !== false ){
|
494 |
+
$sql = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_author = %d AND post_type = %s LIMIT %d OFFSET %d", $user->ID, $post_type, $limit, $offset);
|
495 |
+
$events = $wpdb->get_col($sql);
|
496 |
+
}
|
497 |
+
//if user ever submitted anonymous events with same email, we also process these
|
498 |
+
$sql = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE ID IN (SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key=%s AND meta_value=%s) AND post_type = %s LIMIT %d OFFSET %d", $anon_email_key, $email_address, $post_type, $limit, $offset);
|
499 |
+
$events = array_merge($events, $wpdb->get_col($sql));
|
500 |
+
return $events;
|
501 |
+
}
|
502 |
+
|
503 |
+
public static function get_bookings( $email_address, $page ){
|
504 |
+
global $wpdb;
|
505 |
+
$page = (int) $page;
|
506 |
+
$limit = apply_filters('em_data_privacy_export_limit', 100);
|
507 |
+
$offset = ($page -1) * $limit;
|
508 |
+
$user = get_user_by('email', $email_address); //is user or no-user?
|
509 |
+
|
510 |
+
$conditions = array();
|
511 |
+
if( $user !== false ){
|
512 |
+
$conditions[] = $wpdb->prepare('person_id = %d', $user->ID);
|
513 |
+
}
|
514 |
+
$conditions[] = $wpdb->prepare('person_id=0 AND booking_meta LIKE %s', "%\"user_email\";s:".strlen($email_address).":\"$email_address\"%"); //find any booking that may have their email, anonymous or previous email address.
|
515 |
+
$bookings = $wpdb->get_col('SELECT booking_id FROM '.EM_BOOKINGS_TABLE.' WHERE '. implode(' OR ', $conditions) .' LIMIT '.$limit . ' OFFSET '.$offset);
|
516 |
+
|
517 |
+
return $bookings;
|
518 |
+
|
519 |
+
}
|
520 |
+
}
|
521 |
+
EM_Data_Privacy::init();
|
522 |
+
/*
|
523 |
+
add_action('admin_init', function(){
|
524 |
+
$data = EM_Data_Privacy::exporter('subscriber@netweblogic.com');
|
525 |
+
echo "<table>";
|
526 |
+
foreach( $data['data'] as $items ){
|
527 |
+
foreach($items['data'] as $item) echo "<tr><th>{$item['name']}</th><td>{$item['value']}</td>";
|
528 |
+
}
|
529 |
+
echo "</table>";
|
530 |
+
die();
|
531 |
+
}); //*/
|
trunk/admin/em-docs.php
ADDED
@@ -0,0 +1,464 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function em_docs_init($force_init = false){
|
4 |
+
global $pagenow;
|
5 |
+
if( ($pagenow == 'edit.php' && !empty($_GET['page']) && $_GET['page']=='events-manager-help' && class_exists('EM_Event')) || $force_init){
|
6 |
+
add_action('wp_head', 'emd_head');
|
7 |
+
//Generate the docs
|
8 |
+
global $EM_Documentation;
|
9 |
+
$EM_Documentation = array(
|
10 |
+
'arguments' => array(
|
11 |
+
'events' => array(
|
12 |
+
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','events')),
|
13 |
+
'bookings' => array( 'desc'=> 'Include only events with bookings enabled. Use \'user\' to show events a logged in user has booked.'.'1 = yes, 0 = no'),
|
14 |
+
'category' => array( 'desc'=> str_replace('%s','categories', 'Supply a single id, slug or comma-separated ids or slugs (e.g. "1,%s-slug,3") to limit the search to events in any of these %s. You can also use negative numbers and slugs to exclude specific %s (e.g. -1,-exclude-%s,-3). If you mix inclusions and exclusions, all events with included %s AND without excluded %s will be shown. You can also use & to separate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0),
|
15 |
+
'event' => array( 'desc'=> sprintf('Supply a single id or comma-separated ids (e.g. "1,2,3") to limit the search to %s with the %s.','events', 'event_id(s)'), 'default'=>0),
|
16 |
+
'group' => array( 'desc' => 'Limit search to events belonging to a specific group id (BuddyPress only). Using \'my\' will show events belonging to groups the logged in user is a member of.'),
|
17 |
+
'near' => array('desc'=>'Accepts a comma-separated coordinates (e.g. 1,1) value, which searches for events or locations located near this coordinate.'),
|
18 |
+
'near_unit' => array('desc'=>'The distance unit used when a near attribute is provided.', 'default'=>'mi', 'args'=>'mi or km'),
|
19 |
+
'near_distance' => array('desc'=>'The radius distance when searching with the near attribute. near_unit will determine whether this is in miles or kilometers.'),
|
20 |
+
'owner' => array('desc'=> 'Limits returned results to a specific owner, identified by their user id (e.g. list events or locations owned by user)', 'default'=>0),
|
21 |
+
'post_id' => array( 'desc' => sprintf('Supply a single id or comma-separated ids (e.g. "1,2,3") to limit the search to %s with the %s.','events', 'post_id(s)')),
|
22 |
+
'private' => array( 'desc' => sprintf('Display private %s within your list?','events'), 'args' => '1 = yes, 0 = no', 'default' => 'If user can view private events, 1, otherwise 0.'),
|
23 |
+
'private_only' => array( 'desc' =>sprintf('Display only private %s ?','events'), 'args' => '1 = yes, 0 = no', 'default' => '0'),
|
24 |
+
'recurrences' => array( 'desc'=> 'Show only recurrences if set to 1 or non-recurrences if set to 0, shows all events if not used.'),
|
25 |
+
'recurrence' => array( 'desc'=> 'If set to the event id of the recurring event, this will show only events this event recurrences.', 'default'=>0),
|
26 |
+
'recurring' => array( 'desc'=> 'If set to 1, will only show recurring event templates. Only useful if you know what you\'re doing, use recurrence or recurrences if you want to filter event recurrences.', 'default'=>0),
|
27 |
+
'scope' => array( 'desc'=> 'Choose the time frame of events to show. Additionally you can supply dates (in format of YYYY-MM-DD), either single for events on a specific date or two dates separated by a comma (e.g. 2010-12-25,2010-12-31) for events ocurring between these dates.', 'default'=>'future', 'args'=>array("future", "past", "today", "tomorrow", 'week', 'this-week', "month", 'this-month', "next-month", "1-months", "2-months", "3-months", "6-months", "12-months","all")),
|
28 |
+
'search' => array( 'desc'=> 'Do a search for this string within event name, details and location address.' ),
|
29 |
+
'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','events'), 'default'=>1),
|
30 |
+
'tag' => array( 'desc'=> str_replace('%s', 'tags', 'Supply a single id, slug or comma-separated ids or slugs (e.g. "1,%s-slug,3") to limit the search to events in any of these %s. You can also use negative numbers and slugs to exclude specific %s (e.g. -1,-exclude-%s,-3). If you mix inclusions and exclusions, all events with included %s AND without excluded %s will be shown. You can also use & to separate ids and slugs, in which case events must contain (or not contain) both %s to be shown.'), 'default'=>0),
|
31 |
+
'year' => array( 'desc'=> 'If set to a year (e.g. 2010) only events that start or end during this year/month will be returned. Does not work as intended if used with scope.', 'default'=>''),
|
32 |
+
'has_location' => array( 'desc'=> 'When set to true, only events WITH an assigned location will be shown, has priority over no_location.', 'default'=>''),
|
33 |
+
'no_location' => array( 'desc'=> 'When set to true, only events WITHOUT an assigned location will be shown.', 'default'=>''),
|
34 |
+
'groupby' => array( 'desc'=> 'Show one event for each unique value of the provide field name, along with events contaning no defined value for that field. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>0, 'args'=>'Database field name from the wp_em_events or wp_em_locations tables, e.g. <code>event_name</code> or <code>location_name</code>', 'since'=>'5.8'),
|
35 |
+
'groupby_orderby' => array( 'desc'=> 'When groupby is defined, the fields defined here will determine the sorting of events in each group. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>'event_start_date,event_start_time', 'args'=>'Database fields (comma-seperated) in the wp_em_events and wp_em_locations tables, e.g. <code>event_start_date,event_start_time</code> or <code>location_name</code>', 'since'=>'5.8'),
|
36 |
+
'groupby_order' => array( 'desc'=> 'Indicates the alphabeitcal/numerical/date order of the sorting in groupby_orderby. Choose between ASC (ascending) and DESC (descending), case insensitive.', 'default'=>'ASC', 'since'=>'5.8'),
|
37 |
+
),
|
38 |
+
'locations' => array(
|
39 |
+
'blog' => array( 'desc' => sprintf('Limit search to %s created in a specific blog id (MultiSite only)','locations')),
|
40 |
+
'country' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Country'), 'default' => 'none', 'args'=>'Use two-character country codes as defined in <a href="http://countrycode.org/">countrycode.org</a>, can be comma-separated e.g. US,GB,ES'),
|
41 |
+
'eventful' => array( 'desc'=> 'If set to 1 will only show locations that have at least one event occurring during the scope.', 'default' => 0),
|
42 |
+
'eventless' => array( 'desc'=> 'If set to 1 will only show locations that have no events occurring during the scope.', 'default' => 0),
|
43 |
+
'location' => array( 'desc'=> sprintf('Supply a single id or comma-separated ids (e.g. "1,2,3") to limit the search to %s with the %s.','locations', 'location_id(s)'), 'default'=>0),
|
44 |
+
'near' => array('desc'=>'Accepts a comma-separated coordinates (e.g. 1,1) value, which searches for events or locations located near this coordinate.'),
|
45 |
+
'near_unit' => array('desc'=>'The distance unit used when a near attribute is provided.', 'default'=>'mi', 'args'=>'mi or km'),
|
46 |
+
'near_distance' => array('desc'=>'The radius distance when searching with the near attribute. near_unit will determine whether this is in miles or kilometers.'),
|
47 |
+
'owner' => array('desc'=> 'Limits returned results to a specific owner, identified by their user id (e.g. list events or locations owned by user)', 'default'=>0),
|
48 |
+
'post_id' => array( 'desc' => sprintf('Supply a single id or comma-separated ids (e.g. "1,2,3") to limit the search to %s with the %s.','locations', 'post_id(s)')),
|
49 |
+
'postcode' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Postcode'), 'default' => 'none'),
|
50 |
+
'private' => array( 'desc' => sprintf('Display private %s within your list?','locations'), 'args' => '1 = yes, 0 = no', 'default' => 'If user can view private locations, 1, otherwise 0.'),
|
51 |
+
'private_only' => array( 'desc' =>sprintf('Display only private %s ?','locations'), 'args' => '1 = yes, 0 = no', 'default' => '0'),
|
52 |
+
'region' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Region'), 'default' => 'none'),
|
53 |
+
'scope' => array( 'default' => 'all'),
|
54 |
+
'state' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','State'), 'default' => 'none'),
|
55 |
+
'status' => array( 'desc' => sprintf('Limit search to %s with a spefic status (1 is active, 0 is pending approval)','locations'), 'default'=>1),
|
56 |
+
'town' => array( 'desc'=> sprintf('Search for %s in this %s (no partial matches, case sensitive).','locations','Town'), 'default' => 'none'),
|
57 |
+
'groupby' => array( 'desc'=> 'Show one location for each unique value of the provide field name, along with locations contaning no defined value for that field. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>0, 'args'=>'Database field name from the wp_em_events or wp_em_locations tables, e.g. <code>event_name</code> or <code>location_name</code>', 'since'=>'5.8'),
|
58 |
+
'groupby_orderby' => array( 'desc'=> 'When groupby is defined, the fields defined here will determine the sorting of events in each group. See our <a href="http://wp-events-plugin.com/documentation/event-search-attributes/event-location-grouping-ordering/">grouping documentation</a> for more information.', 'default'=>'event_start_date,event_start_time', 'args'=>'Database fields (comma-seperated) in the wp_em_events and wp_em_locations tables, e.g. <code>location_country,location_town</code> or <code>location_name</code>', 'since'=>'5.8'),
|
59 |
+
'groupby_order' => array( 'desc'=> 'Indicates the alphabeitcal/numerical/date order of the sorting in groupby_orderby. Choose between ASC (ascending) and DESC (descending), case insensitive.', 'default'=>'ASC', 'since'=>'5.8'),
|
60 |
+
),
|
61 |
+
'categories' => array(
|
62 |
+
'' => array( 'desc' => 'See the <a href="http://codex.wordpress.org/Function_Reference/get_terms">WordPress get_terms() Codex</a> for a list of possible search attributes/arguments.'),
|
63 |
+
),
|
64 |
+
'tags' => array(
|
65 |
+
'' => array( 'desc' => 'See the <a href="http://codex.wordpress.org/Function_Reference/get_terms">WordPress get_terms() Codex</a> for a list of possible search attributes/arguments.'),
|
66 |
+
),
|
67 |
+
'calendar' => array(
|
68 |
+
'full' => array( 'desc'=> 'If set to 1 it will display a full calendar that shows event names.', 'default' => 0),
|
69 |
+
'long_events' => array( 'desc'=> 'If set to 1, will show events that last longer than a day.', 'default' => 0),
|
70 |
+
),
|
71 |
+
//The object is commonly shared by all, so entries above overwrite entries here
|
72 |
+
'general' => array(
|
73 |
+
'array' => array( 'desc'=> 'If you supply this as an argument, the returned data will be in an array, not an object (only useful wen using PHP, not shortcodes)', 'default'=>0),
|
74 |
+
'format_header' => array( 'desc'=> sprintf('If you are displaying lists (e.g. listing events), you can supply the %s html and placeholders here.','header'), 'default'=> 'If the <em>format</em> attribute is not provided, the relevant default format will be taken from the settings page.'),
|
75 |
+
'format' => array( 'desc'=> 'If you are displaying some information with the shortcode or function (e.g. listing events), you can supply the html and placeholders here. When providing a custom format value, format_header and format_footer will be blank if not also provided.', 'default'=> 'The relevant default format will be taken from the settings page.'),
|
76 |
+
'format_footer' => array( 'desc'=> sprintf('If you are displaying lists (e.g. listing events), you can supply the %s html and placeholders here.','footer'), 'default'=> 'If the <em>format</em> attribute is not provided, the relevant default format will be taken from the settings page.'),
|
77 |
+
'limit' => array( 'desc'=> 'Limits the amount of values returned to this number.', 'default'=>'0 (no limit)'),
|
78 |
+
'offset' => array( 'desc'=> 'For example, if you have ten results, if you set this to 5, only the last 5 results will be returned. A limit higher than 0 is required for offsets to work.', 'default'=>0),
|
79 |
+
'order' => array( 'desc'=> 'Indicates the alphabeitcal/numerical order of the lists. Choose between ASC (ascending) and DESC (descending).', 'default'=>'ASC'),
|
80 |
+
'orderby' => array( 'desc'=> 'Choose what fields to order your results by. You can supply a single field or multiple comma-separated fields (e.g. "event_start_date,event_name").', 'default'=>0, 'args'=>'Database table fields, e.g. <code>event_name</code> or <code>location_name</code>'),
|
81 |
+
'pagination' => array('desc'=> 'When using a function or shortcode that outputs items (e.g. [events_list] for events, [locations_list] for locations), if the number of items supercede the limit of items to show, setting this to 1 will show page links under the list.', 'default'=>0),
|
82 |
+
'page' => array('desc' => 'Which page shall be shown. Requires pagination to be set to 1 and will override the offset value if also provided.'),
|
83 |
+
'page_queryvar' => array('desc'=>'The default parameter name used to figure out the page number to show is pno, provide a unique name if you want to display two lists on the same page with independent pagination.'),
|
84 |
+
)
|
85 |
+
),
|
86 |
+
'placeholders' => array(
|
87 |
+
'events' => array(
|
88 |
+
'Event Details' => array(
|
89 |
+
'placeholders' => array(
|
90 |
+
'#_EVENTID' => array( 'desc' => 'Shows the event ID number in the wp_em_events table.' ),
|
91 |
+
'#_EVENTPOSTID' => array( 'desc' => 'Shows the event corresponding Post ID in the wp_posts table.' ),
|
92 |
+
'#_EVENTNAME' => array( 'desc' => 'Displays the name of the event.' ),
|
93 |
+
'#_EVENTNOTES' => array( 'desc' => 'Shows the description of the event.' ),
|
94 |
+
'#_EVENTEXCERPT' => array( 'desc' => 'If an excerpt has been added to the event, it will be used. If you added a <a href="http://en.support.wordpress.com/splitting-content/more-tag/">more tag</a> to your event description, only the content before this tag will show.' ),
|
95 |
+
'#_EVENTEXCERPT{words,...}' => array( 'desc' => 'If an excerpt has not been added to the event you can use this format <code>#_EVENTEXCERPT{10,...}</code>, where 10 is the number of words to show and ... is what is used at the cut-off point.' ),
|
96 |
+
'#_EVENTEXCERPTCUT' => array( 'desc' => 'Same as <code>#_EVENTEXCERPT</code> (and also accepts the <code>{words,...}</code> arguments) but will also cut excerpts as well as post content. Default word limit is 55 and cut-off is <code>[...]</code>' ),
|
97 |
+
'#_EVENTIMAGE' => array( 'desc' => 'Shows the event image, if available.' ),
|
98 |
+
'#_EVENTIMAGE{x,y}' => array( 'desc' => 'Shows the event image thumbnail, x and y are width and height respectively, both being numbers e.g. <code>#_EVENTIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized' ),
|
99 |
+
'#_EVENTCATEGORIES' => array( 'desc' => 'Shows a list of category links this event belongs to.' ),
|
100 |
+
'#_EVENTCATEGORIESIMAGES' => array( 'desc' => 'Shows a list of category images this event belongs to. Categories without an image will be ignored.' ),
|
101 |
+
'#_EVENTTAGS' => array( 'desc' => 'Shows a list of tag links this event belongs to.' ),
|
102 |
+
'#_EVENTLOCATION' => array( 'desc' => 'Displays information about the event location, which is different from a physical location. <a href="https://wp-events-plugin.com/documentation/location-types/">See our documentation for more information</a>, as each location type may display different information and will have different additional placeholders.' ),
|
103 |
+
'#_RECURRINGDATERANGE' => array( 'desc' => 'Range of dates between the start/end of the recurring event pattern for an event recurrence, blank for non-recurrences.' ),
|
104 |
+
'#_RECURRINGPATTERN' => array( 'desc' => 'Describes the pattern of a recurring event when used on an event recurrence, blank for non-recurrences.' ),
|
105 |
+
'#_RECURRINGID' => array( 'desc' => 'The event ID of the recurring event template when displayed on a recurrence, blank for non-recurrences.' ),
|
106 |
+
)
|
107 |
+
),
|
108 |
+
'Date and Times' => array(
|
109 |
+
'desc' => 'These are shortcut placeholders for pre-formatted dates and times. See the Custom Date/Time Formatting section below for more refined formatting placeholders.',
|
110 |
+
'placeholders' => array(
|
111 |
+
'#_24HSTARTTIME' => array( 'desc' => 'Displays the start time in a 24 hours format (e.g. 16:30).' ),
|
112 |
+
'#_24HENDTIME' => array( 'desc' => 'Displays the end time in a 24 hours format (e.g. 18:30).' ),
|
113 |
+
'#_12HSTARTTIME' => array( 'desc' => 'Displays the start time in a 12 hours format (e.g. 4:30 PM).' ),
|
114 |
+
'#_12HENDTIME' => array( 'desc' => 'Displays the end time in a 12 hours format (e.g. 6:30 PM).' ),
|
115 |
+
'#_EVENTTIMES' => array( 'desc' => 'Displays either a single time, time-span, or "All Day" depending on your event times. Format is taken from your Events Manager settings page.' ),
|
116 |
+
'#_EVENTDATES' => array( 'desc' => 'Displays either a single date or a date range depending on your event dates. Format is taken from your Events Manager settings page.' ),
|
117 |
+
)
|
118 |
+
),
|
119 |
+
'Custom Date/Time Formatting' => array(
|
120 |
+
'desc' => 'Events Manager allows extremely flexible date formatting by using <a href="http://www.php.net/manual/en/function.date.php">PHP date syntax format characters</a> along with placeholders.',
|
121 |
+
'placeholders' => array(
|
122 |
+
'# or #@' => array( 'desc' => 'Prepend <code>#</code> or <code>#@</code> before a valid PHP date syntax format character to show start and end date/time information respectively (e.g. <code>#F</code> will show the starting month name like "January", #@h shows the end hour).' ),
|
123 |
+
'#_{x} or #@_{x}' => array( 'desc' => 'You can also create a date format without prepending # to each character by wrapping a valid php date() format in <code>#_{}</code> or <code>#@_{}</code> (e.g. <code>#_{d/m/Y}</code>). If there is no end date (or is same as start date), the value is not shown. This is useful if you want to show event end dates only on events that are longer than one day, e.g. <code>#j #M #Y #@_{ \u\n\t\i\l j M Y}</code>.' ),
|
124 |
+
)
|
125 |
+
),
|
126 |
+
'WordPress-relative Timezone Date/Time Placeholders' => array(
|
127 |
+
'desc' => 'These placeholders are extensions of the default Date/Time placholders, but instead will display the time of the event relative to your WordPress timezone rather than the local time of the event itself. Your WordPress site timezone is found in your <em><strong>Dashboard > Settings > General</strong></em> settings page.',
|
128 |
+
'placeholders' => array(
|
129 |
+
'#_24HSTARTTIME_SITE' => array( 'desc' => 'Sames as <code>#_24HSTARTTIME</code> but displays time relative to your site timezone.' ),
|
130 |
+
'#_24HENDTIME_SITE' => array( 'desc' => 'Sames as <code>#_24HENDTIME</code> but displays time relative to your site timezone.' ),
|
131 |
+
'#_12HSTARTTIME_SITE' => array( 'desc' => 'Sames as <code>#_12HSTARTTIME</code> but displays time relative to your site timezone.' ),
|
132 |
+
'#_12HENDTIME_SITE' => array( 'desc' => 'Sames as <code>#_12HENDTIME</code> but displays time relative to your site timezone.' ),
|
133 |
+
'#_EVENTTIMES_SITE' => array( 'desc' => 'Sames as <code>#_EVENTTIMES</code> but displays times relative to your site timezone.' ),
|
134 |
+
'#_EVENTDATES_SITE' => array( 'desc' => 'Sames as <code>#_EVENTDATES</code> but displays dates relative to your site timezone (dates can be different for events near midnight in a different timezone).' ),
|
135 |
+
'#__{x} or #@__{x}' => array( 'desc' => 'Same as <code>#_{x}</code> or <code>#@_{x}</code> but displays the time of the event relative to your WordPress timezone rather than the local time of the event itself.' ),
|
136 |
+
)
|
137 |
+
),
|
138 |
+
'Viewer Timezone Date/Time Placeholders' => array(
|
139 |
+
'desc' => 'These placeholders are extensions of the default Date/Time placholders, but instead will display the time of the event relative to the visitor timezone rather than the local event start time. This time is based on the user browser settings and JavaScript, so this may not always be accurate if a visitor is travelling and does not update their browser timezone, or if they have disabled JS on their browser.',
|
140 |
+
'placeholders' => array(
|
141 |
+
'#_24HSTARTTIME_LOCAL' => array( 'desc' => 'Sames as <code>#_24HSTARTTIME</code> but displays time relative to your visitor browser timezone.' ),
|
142 |
+
'#_24HENDTIME_LOCAL' => array( 'desc' => 'Sames as <code>#_24HENDTIME</code> but displays time relative to your visitor browser timezone.' ),
|
143 |
+
'#_12HSTARTTIME_LOCAL' => array( 'desc' => 'Sames as <code>#_12HSTARTTIME</code> but displays time relative to your visitor browser timezone.' ),
|
144 |
+
'#_12HENDTIME_LOCAL' => array( 'desc' => 'Sames as <code>#_12HENDTIME</code> but displays time relative to your visitor browser timezone.' ),
|
145 |
+
'#_EVENTTIMES_LOCAL' => array( 'desc' => 'Sames as <code>#_EVENTTIMES</code> but displays time relative to your visitor browser timezone.' ),
|
146 |
+
'#_EVENTTIMES_LOCAL{...}' => array( 'desc' => 'Sames as <code>#_EVENTTIMES_LOCAL</code> but displays custom format by replacing <code>...</code> with <a href="https://momentjs.com/docs/#/displaying/"> documented Moment JS formatting syntax</a>.'),
|
147 |
+
'#_EVENTDATES_LOCAL' => array( 'desc' => 'Sames as <code>#_EVENTDATES</code> but displays dates relative to your site timezone (dates can be different for events near midnight in a different timezone).' ),
|
148 |
+
'#_EVENTDATES_LOCAL{...}' => array( 'desc' => 'Sames as <code>#_EVENTDATES_LOCAL</code> but displays custom format by replacing <code>...</code> with <a href="https://momentjs.com/docs/#/displaying/"> documented Moment JS formatting syntax</a>.'),
|
149 |
+
)
|
150 |
+
),
|
151 |
+
'Links/URLs' => array(
|
152 |
+
'placeholders' => array(
|
153 |
+
'#_EVENTIMAGEURL' => array( 'desc' => 'Shows the event image url, if available.' ),
|
154 |
+
'#_EVENTURL' => array( 'desc' => 'Simply prints the event URL. You can use this placeholder to build your own customised links.' ),
|
155 |
+
'#_EVENTLINK' => array( 'desc' => 'Displays the event name with a link to the event page.' ),
|
156 |
+
'#_EDITEVENTLINK' => array( 'desc' => 'Inserts a link to the admin or buddypress (if activated) edit event page, only if a user is logged in and is allowed to edit the event.' ),
|
157 |
+
'#_EDITEVENTURL' => array( 'desc' => 'Inserts a url to the admin or buddypress (if activated) edit event page, only if a user is logged in and is allowed to edit the event.' ),
|
158 |
+
)
|
159 |
+
),
|
160 |
+
'Custom Attributes' => array(
|
161 |
+
'desc' => 'Events Manager allows you to create dynamic attributes to your events, which act as extra information fields for your events (e.g. "Dress Code"). For more information see <a href="http://wp-events-plugin.com/documentation/event-attributes/">our online documentation</a> for more info on attributes.',
|
162 |
+
'placeholders' => array(
|
163 |
+
'#_ATT{key}' => array('desc'=> 'This key will appear as an option when adding attributes to your event.'),
|
164 |
+
'#_ATT{key}{alternative text}' => array('desc'=> 'This key will appear as an option when adding attributes to your event. The text in the second braces will appear if the attribute is not defined or left blank for that event.'),
|
165 |
+
'#_ATT{key}{option 1|option 2|option 3|etc.}' => array('desc'=> 'This key will appear as an option when adding attributes to your event. The second braces are optional and will use a select box with these values as input. If no valid value is defined, the first option is used.'),
|
166 |
+
)
|
167 |
+
),
|
168 |
+
'Bookings' => array(
|
169 |
+
'desc' => 'These placeholders will only show if bookings are enabled for the given event and in the events manager settings page. Spaces placeholders will default to 0',
|
170 |
+
'placeholders' => array(
|
171 |
+
'#_BOOKINGFORM' => array( 'desc' => 'Adds a booking forms for this event.' ),
|
172 |
+
'#_BOOKINGBUTTON' => array( 'desc' => 'A single button that will appear to logged in users, if they click on it a booking will be made. This button will automatically book the first aailable ticket if more than one ticket exists for the event, and will also circumvent any payment requirements. Use in combination with conditional placeholders such as is_free to avoid unpaid bookings.' ),
|
173 |
+
'#_AVAILABLESPACES' => array( 'desc' => 'Shows available spaces for the event.' ),
|
174 |
+
'#_BOOKEDSPACES' => array( 'desc' => 'Shows the amount of currently booked spaces for the event.' ),
|
175 |
+
'#_PENDINGSPACES' => array( 'desc' => 'Shows the amount of pending spaces for the event.' ),
|
176 |
+
'#_SPACES' => array( 'desc' => 'Shows the total spaces for the event.' ),
|
177 |
+
'#_ATTENDEES' => array( 'desc' => 'Shows the list of user avatars attending the event.' ),
|
178 |
+
'#_ATTENDEESLIST' => array( 'desc' => 'Shows the list of people attending the event.' ),
|
179 |
+
'#_ATTENDEESPENDINGLIST' => array( 'desc' => 'Shows the list of people with a pending booking for the event.' ),
|
180 |
+
'#_BOOKINGSURL' => array( 'desc' => 'Shows the url to the admin, front-end or buddypress (if activated) bookings management page for this event. Only shown if user is logged in and able to manage bookings.' ),
|
181 |
+
'#_BOOKINGSLINK' => array( 'desc' => 'Shows a link to the admin, front-end or buddypress (if activated) bookings management page for this event. Only shown if user is logged in and able to manage bookings.' ),
|
182 |
+
'#_EVENTPRICERANGE' => array( 'desc' => 'Shows a "maximum - minimum" price range for available tickets at the time of display, or a single price if there is no range. Once bookings are closed this will show a 0 value, if you have enabled \'Show unavailable tickets\' in your booking settings these will be included. Price is formatted according to currency formatting in your settings page.' ),
|
183 |
+
'#_EVENTPRICERANGEALL' => array( 'desc' => 'Like #_EVENTPRICERANGE but shows all tickets price range whether or not bookings or individual tickets are available.' ),
|
184 |
+
'#_EVENTPRICEMIN' => array( 'desc' => 'Shows the lowest available ticket price for this event. Will display a value of 0 if no ticket is available.' ),
|
185 |
+
'#_EVENTPRICEMAX' => array( 'desc' => 'Shows the highest available ticket price for this event. Will display a value of 0 if no ticket is avaialble.' ),
|
186 |
+
'#_EVENTPRICEMINALL' => array( 'desc' => 'Shows the lowest ticket price for this event, whether available or not.' ),
|
187 |
+
'#_EVENTPRICEMAXALL' => array( 'desc' => 'Shows the highest ticket price for this event, whether available or not.' ),
|
188 |
+
)
|
189 |
+
),
|
190 |
+
'Contact Details' => array(
|
191 |
+
'desc' => 'The values here are taken from the chosen contact for the specific event, or the default contact in the settings page.',
|
192 |
+
'placeholders' => array(
|
193 |
+
'#_CONTACTNAME' => array( 'desc' => 'Name of the contact person for this event (as shown in the dropdown when adding an event).' ),
|
194 |
+
'#_CONTACTUSERNAME' => array( 'desc' => 'Contact person\'s username.' ),
|
195 |
+
'#_CONTACTEMAIL' => array( 'desc' => 'E-mail of the contact person for this event.' ),
|
196 |
+
'#_CONTACTURL' => array( 'desc' => 'Website of the contact person for this event.' ),
|
197 |
+
'#_CONTACTPHONE' => array( 'desc' => 'Phone number of the contact person for this event. Can be set in the user profile page.' ),
|
198 |
+
'#_CONTACTAVATAR' => array( 'desc' => 'Contact person\'s avatar.' ),
|
199 |
+
'#_CONTACTPROFILELINK' => array( 'desc' => 'Contact person\'s "Profile" link. Only works with BuddyPress enabled.' ),
|
200 |
+
'#_CONTACTPROFILEURL' => array( 'desc' => 'Contact person\'s profile url. Only works with BuddyPress enabled.' ),
|
201 |
+
'#_CONTACTID' => array( 'desc' => 'Contact person\'s WordPress user ID.'),
|
202 |
+
'#_CONTACTMETA' => array( 'desc' => 'Display any user meta of a WordPress account by including the meta key, e.g. #_CONTACTMETA{dbem_phone}'),
|
203 |
+
)
|
204 |
+
),
|
205 |
+
'iCal/Calendar' => array(
|
206 |
+
'placeholders' => array(
|
207 |
+
'#_EVENTICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format).' ),
|
208 |
+
'#_EVENTICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format).' ),
|
209 |
+
'#_EVENTWEBCALURL' => array( 'desc' => 'Same as #_EVENTICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
210 |
+
'#_EVENTWEBCALLINK' => array( 'desc' => 'Same as #_EVENTICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
211 |
+
'#_EVENTGCALURL' => array( 'desc' => 'Displays URL which would take the user to Google Calendar and pre-fill their add new event form.' ),
|
212 |
+
'#_EVENTGCALLINK' => array( 'desc' => 'Displays a button which would take the user to Google Calendar and pre-fill their add new event form.' )
|
213 |
+
)
|
214 |
+
),
|
215 |
+
),
|
216 |
+
'event-locations' => array(
|
217 |
+
'Event Location URLs' => array(
|
218 |
+
'placeholders' => array(
|
219 |
+
'#_EVENTLOCATION' => array( 'desc' => 'An HTML link, opens in a new tab.' ),
|
220 |
+
'#_EVENTLOCATION{url}' => array( 'desc' => 'Just the URL.' ),
|
221 |
+
'#_EVENTLOCATION{text}' => array( 'desc' => 'Just the Link Text' ),
|
222 |
+
'#_EVENTLOCATION{_self}' => array( 'desc' => 'Regular HTML link' ),
|
223 |
+
'#_EVENTLOCATION{_parent}' => array( 'desc' => 'HTML link with target=”_parent”' ),
|
224 |
+
'#_EVENTLOCATION{_top}' => array( 'desc' => 'HTML link with target=”_top”' )
|
225 |
+
)
|
226 |
+
),
|
227 |
+
),
|
228 |
+
'categories' => array(
|
229 |
+
'Category Details' => array(
|
230 |
+
'desc' => 'You can use these when displaying categories or for showing the first available category in an event format.',
|
231 |
+
'placeholders' => array(
|
232 |
+
'#_CATEGORYNAME' => array( 'desc' => 'Shows the category name.' ),
|
233 |
+
'#_CATEGORYID' => array( 'desc' => 'Shows the category ID.' ),
|
234 |
+
'#_CATEGORYSLUG' => array( 'desc' => 'Shows the category slug.' ),
|
235 |
+
'#_CATEGORYLINK' => array( 'desc' => 'Category name with a link to the category page.' ),
|
236 |
+
'#_CATEGORYURL' => array( 'desc' => 'URL of the category page.' ),
|
237 |
+
'#_CATEGORYCOLOR' => array( 'desc' => 'Shows the category color (useful for inline styling), in hex format, if no color is defined the default category color from your settings page will be used.' ),
|
238 |
+
'#_CATEGORYIMAGE' => array( 'desc' => 'Shows the category image, if available.' ),
|
239 |
+
'#_CATEGORYIMAGE{x,y}' => array( 'desc' => 'Shows the category image thumbnail if available, x and y are width and height respectively, both being numbers e.g. <code>#_CATEGORYIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
|
240 |
+
'#_CATEGORYIMAGEURL' => array( 'desc' => 'Shows the category image url, if available.' ),
|
241 |
+
'#_CATEGORYNOTES' => array( 'desc' => 'Shows the category description.' )
|
242 |
+
)
|
243 |
+
),
|
244 |
+
'Related Events' => array(
|
245 |
+
'desc' => 'You can show lists of other events belonging to this category. The formatting of the list is the same as a normal events list.',
|
246 |
+
'placeholders' => array(
|
247 |
+
'#_CATEGORYPASTEVENTS' => array( 'desc' => 'Will show a list of all past events with this category.' ),
|
248 |
+
'#_CATEGORYNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events with this category.' ),
|
249 |
+
'#_CATEGORYALLEVENTS' => array( 'desc' => 'Will show a list of all events with this category.' ),
|
250 |
+
'#_CATEGORYNEXTEVENT' => array( 'desc' => 'Will show the next event with this category.' )
|
251 |
+
)
|
252 |
+
),
|
253 |
+
'iCal/RSS Feeds' => array(
|
254 |
+
'placeholders' => array(
|
255 |
+
'#_CATEGORYICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format) which shows all events with this category.', 'since'=>'5.5.2' ),
|
256 |
+
'#_CATEGORYICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events with this category.', 'since'=>'5.5.2' ),
|
257 |
+
'#_CATEGORYWEBCALURL' => array( 'desc' => 'Same as #_CATEGORYICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
258 |
+
'#_CATEGORYWEBCALLINK' => array( 'desc' => 'Same as #_CATEGORYICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
259 |
+
'#_CATEGORYRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' ),
|
260 |
+
'#_CATEGORYRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this category.', 'since'=>'5.5.2' )
|
261 |
+
)
|
262 |
+
)
|
263 |
+
),
|
264 |
+
'tags' => array(
|
265 |
+
'Tag Details' => array(
|
266 |
+
'desc' => 'You can use these when displaying tags or for showing the first available tag in an event format.',
|
267 |
+
'placeholders' => array(
|
268 |
+
'#_TAGNAME' => array( 'desc' => 'Shows the tag name.' ),
|
269 |
+
'#_TAGID' => array( 'desc' => 'Shows the tag ID.' ),
|
270 |
+
'#_TAGSLUG' => array( 'desc' => 'Shows the tag slug.' ),
|
271 |
+
'#_TAGLINK' => array( 'desc' => 'Tag name with a link to the tag page.' ),
|
272 |
+
'#_TAGURL' => array( 'desc' => 'URL of the tag page.' ),
|
273 |
+
'#_TAGNOTES' => array( 'desc' => 'Shows the tag description.' ),
|
274 |
+
'#_TAGCOLOR' => array( 'desc' => 'Shows the tag color (useful for inline styling), in hex format, if no color is defined the default tag color from your settings page will be used.' ),
|
275 |
+
'#_TAGIMAGE' => array( 'desc' => 'Shows the tag image, if available.' ),
|
276 |
+
'#_TAGIMAGE{x,y}' => array( 'desc' => 'Shows the tag image thumbnail if available, x and y are width and height respectively, both being numbers e.g. <code>#_TAGIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
|
277 |
+
'#_TAGIMAGEURL' => array( 'desc' => 'Shows the tag image url, if available.' ),
|
278 |
+
)
|
279 |
+
),
|
280 |
+
'Related Events' => array(
|
281 |
+
'desc' => 'You can show lists of other events belonging to this tag. The formatting of the list is the same as a normal events list.',
|
282 |
+
'placeholders' => array(
|
283 |
+
'#_TAGPASTEVENTS' => array( 'desc' => 'Will show a list of all past events with this tag.' ),
|
284 |
+
'#_TAGNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events with this tag.' ),
|
285 |
+
'#_TAGALLEVENTS' => array( 'desc' => 'Will show a list of all events with this tag.' ),
|
286 |
+
'#_TAGNEXTEVENT' => array( 'desc' => 'Will show the next event with this tag.' )
|
287 |
+
)
|
288 |
+
),
|
289 |
+
'iCal/RSS Feeds' => array(
|
290 |
+
'placeholders' => array(
|
291 |
+
'#_TAGICALURL' => array( 'desc' => 'Displays the URL of the event ical feed (ics file format) which shows all events with this tag.', 'since'=>'5.5.2' ),
|
292 |
+
'#_TAGICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events with this tag.' , 'since'=>'5.5.2'),
|
293 |
+
'#_TAGWEBCALURL' => array( 'desc' => 'Same as #_TAGICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
294 |
+
'#_TAGWEBCALLINK' => array( 'desc' => 'Same as #_TAGICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
295 |
+
'#_TAGRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening in this tag.', 'since'=>'5.5.2' ),
|
296 |
+
'#_TAGRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening in this tag.', 'since'=>'5.5.2' )
|
297 |
+
)
|
298 |
+
)
|
299 |
+
),
|
300 |
+
'locations' => array(
|
301 |
+
'Location Details' => array(
|
302 |
+
'desc' => '',
|
303 |
+
'placeholders' => array(
|
304 |
+
'#_LOCATIONID' => array( 'desc' => 'Shows the event ID number in the wp_em_locations table.' ),
|
305 |
+
'#_LOCATIONPOSTID' => array( 'desc' => 'Shows the location corresponding Post ID in the wp_posts table.' ),
|
306 |
+
'#_LOCATIONNAME' => array( 'desc' => 'Displays the location name.' ),
|
307 |
+
'#_LOCATIONADDRESS' => array( 'desc' => 'Displays the address.' ),
|
308 |
+
'#_LOCATIONTOWN' => array( 'desc' => 'Displays the town.' ),
|
309 |
+
'#_LOCATIONSTATE' => array( 'desc' => 'Displays the state/county.' ),
|
310 |
+
'#_LOCATIONPOSTCODE' => array( 'desc' => 'Displays the postcode.' ),
|
311 |
+
'#_LOCATIONREGION' => array( 'desc' => 'Displays the region.' ),
|
312 |
+
'#_LOCATIONCOUNTRY' => array( 'desc' => 'Displays the country.' ),
|
313 |
+
'#_LOCATIONLONGITUDE' => array( 'desc' => 'Displays the longitude, used for locating in Google Maps.' ),
|
314 |
+
'#_LOCATIONLATITUDE' => array( 'desc' => 'Displays the latitude, used for locating in Google Maps.' ),
|
315 |
+
'#_LOCATIONMAP' => array( 'desc' => 'Displays a google map showing where the location is located (Will not show if maps are disabled in the settings page)' ),
|
316 |
+
'#_LOCATIONNOTES' => array( 'desc' => 'Shows the location description.' ),
|
317 |
+
'#_LOCATIONEXCERPT' => array( 'desc' => 'If an excerpt has been added to the location, it will be used. If you added a <a href="http://en.support.wordpress.com/splitting-content/more-tag/">more tag</a> to your location description, only the content before this tag will show.' ),
|
318 |
+
'#_LOCATIONEXCERPT{words, ...}' => array( 'desc' => 'If an excerpt has not been added to the location, only a specific length is shown, e.g. <code>#_EVENTEXCERPT{10,...}</code> where 10 is the number of words to show and ... is what is used at the cut-off point.' ),
|
319 |
+
'#_LOCATIONEXCERPTCUT' => array( 'desc' => 'Same as <code>#_LOCATIONEXCERPT</code> (and also accepts the <code>{words,...}</code> arguments) but will also cut excerpts as well as post content. Default word limit is 55 and cut-off is <code>[...]</code>' ),
|
320 |
+
'#_LOCATIONIMAGE' => array( 'desc' => 'Shows the location image.' ),
|
321 |
+
'#_LOCATIONIMAGE{x,y}' => array( 'desc' => 'Shows the location image thumbnail, x and y are width and height respectively, both being numbers e.g. <code>#_LOCATIONIMAGE{100,100}</code>. If 0 is used for either width or height, the corresponding dimension will be proportionally sized.' ),
|
322 |
+
'#_LOCATIONIMAGEURL' => array( 'desc' => 'Shows the location image url, if available.' ),
|
323 |
+
'#_LOCATIONFULLLINE' => array( 'desc' => 'Shows a comma-separated line of location information, ommitting blanks (format of address, town, state, postcode, region' ),
|
324 |
+
'#_LOCATIONFULLBR' => array( 'desc' => 'Shows a line-break (br tag) separated location information, ommitting blanks (format of address, town, state, postcode, region' ),
|
325 |
+
)
|
326 |
+
),
|
327 |
+
'Custom Attributes' => array(
|
328 |
+
'desc' => 'Events Manager allows you to create dynamic attributes to your locations, which act as extra information fields for your locations (e.g. "Dress Code"). For more information see <a href="http://wp-events-plugin.com/documentation/event-attributes/">our online documentation</a> for more info on attributes.',
|
329 |
+
'placeholders' => array(
|
330 |
+
'#_LATT{key}' => array('desc'=> 'This key will appear as an option when adding attributes to your location.'),
|
331 |
+
'#_LATT{key}{alternative text}' => array('desc'=> 'This key will appear as an option when adding attributes to your location. The text in the second braces will appear if the attribute is not defined or left blank for that location.'),
|
332 |
+
'#_LATT{key}{option 1|option 2|option 3|etc.}' => array('desc'=> 'This key will appear as an option when adding attributes to your location. The second braces are optional and will use a select box with these values as input. If no valid value is defined, the first option is used.'),
|
333 |
+
)
|
334 |
+
),
|
335 |
+
'Links' => array(
|
336 |
+
'placeholders' => array(
|
337 |
+
'#_LOCATIONURL' => array( 'desc' => 'Simply prints the location URL. You can use this placeholder to build your own customised links.' ),
|
338 |
+
'#_LOCATIONLINK' => array( 'desc' => 'Displays the location name with a link to the location page.' ),
|
339 |
+
'#_EDITLOCATIONLINK' => array( 'desc' => 'Inserts a link to the admin or buddypress (if activated) edit location page, only if a user is logged in and is allowed to edit the location.' ),
|
340 |
+
'#_EDITLOCATIONURL' => array( 'desc' => 'Inserts a url to the admin or buddypress (if activated) edit location page, only if a user is logged in and is allowed to edit the location.' )
|
341 |
+
)
|
342 |
+
),
|
343 |
+
'Related Events' => array(
|
344 |
+
'desc' => 'You can show lists of other events that are being held at this location. The formatting of the list is the same as a normal events list.',
|
345 |
+
'placeholders' => array(
|
346 |
+
'#_LOCATIONPASTEVENTS' => array( 'desc' => 'Will show a list of all past events at this location.' ),
|
347 |
+
'#_LOCATIONNEXTEVENTS' => array( 'desc' => 'Will show a list of all future events at this location.' ),
|
348 |
+
'#_LOCATIONALLEVENTS' => array( 'desc' => 'Will show a list of all events at this location.' ),
|
349 |
+
'#_LOCATIONNEXTEVENT' => array( 'desc' => 'Will show a link to the next event at this location, or the no events message.' ),
|
350 |
+
)
|
351 |
+
),
|
352 |
+
'iCal/RSS Feeds' => array(
|
353 |
+
'placeholders' => array(
|
354 |
+
'#_LOCATIONICALURL' => array( 'desc' => 'Displays the URL of the location ical feed (ics file format) which shows all events happening at that location.', 'since'=>'5.5.2' ),
|
355 |
+
'#_LOCATIONICALLINK' => array( 'desc' => 'Displays an html link to the event ical feed (ics file format) which shows all events happening at that location.', 'since'=>'5.5.2' ),
|
356 |
+
'#_LOCATIONWEBCALURL' => array( 'desc' => 'Same as #_LOCATIONICALURL, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
357 |
+
'#_LOCATIONWEBCALLINK' => array( 'desc' => 'Same as #_LOCATIONICALLINK, but using the <a href="https://en.wikipedia.org/wiki/Webcal">webcal:// protocol</a>, which will open up various calendar apps automatically including iCalendar, Outlook and Google Calendar.', 'since'=>'5.8' ),
|
358 |
+
'#_LOCATIONRSSURL' => array( 'desc' => 'Displays the URL of an RSS feed showing all upcoming events happening at this location.', 'since'=>'5.5.2' ),
|
359 |
+
'#_LOCATIONRSSLINK' => array( 'desc' => 'Displays an html link to an RSS feed showing all upcoming events happening at this location.', 'since'=>'5.5.2' )
|
360 |
+
)
|
361 |
+
)
|
362 |
+
),
|
363 |
+
'bookings' => array(
|
364 |
+
'Individual Booking Information' => array(
|
365 |
+
'desc' => 'When a specific booking is displayed (on screen and on email), you can use these placeholders to show specific information about the booking. Event and Location placeholders are also available in these cases.',
|
366 |
+
'placeholders' => array(
|
367 |
+
'#_BOOKINGID' => array( 'desc' => 'The unique ID of this booking, useful if you are making your own customizations to this plugin.' ),
|
368 |
+
'#_BOOKINGNAME' => array( 'desc' => 'Name of person who made the booking.' ),
|
369 |
+
'#_BOOKINGEMAIL' => array( 'desc' => 'Email of person who made the booking.' ),
|
370 |
+
'#_BOOKINGPHONE' => array( 'desc' => 'Phone number of person who made the booking.' ),
|
371 |
+
'#_BOOKINGSPACES' => array( 'desc' => 'Number of spaces the person has booked.' ),
|
372 |
+
'#_BOOKINGCOMMENT' => array( 'desc' => 'Any specific comments made by the person who made the booking.' ),
|
373 |
+
'#_BOOKINGTICKETNAME' => array( 'desc' => 'Name of the ticket booked. Useful in single ticket mode, if multiple tickets are booked a random ticket is used.' ),
|
374 |
+
'#_BOOKINGTICKETDESCRIPTION' => array( 'desc' => 'Description of the ticket booked. Useful in single ticket mode, if multiple tickets are booked a random ticket is used.' ),
|
375 |
+
'#_BOOKINGTICKETPRICE' => array( 'desc' => 'Booked ticket price with currency symbol (e.g. $ 10.00). Useful in single ticket mode, if multiple tickets are booked a random ticket is used.' ),
|
376 |
+
'#_BOOKINGTICKETS' => array( 'desc' => 'A list of booked tickets. You can modify this by using template files and modifying templates/emails/bookingtickets.php' ),
|
377 |
+
'#_BOOKINGSUMMARY' => array( 'desc' => 'Shows a breakdown of price/quantity booked by ticket, followed by a summary of price totals, taxes, and other discounts applied.' ),
|
378 |
+
'#_BOOKINGFORMCUSTOM{field_id}' => array( 'desc' => sprintf('(<a href="%s">pro only</a>) Shows booking form custom fields. The field_id value must match that of your custom booking form field.','http://wp-events-plugin.com/features/') ),
|
379 |
+
'#_BOOKINGFORMCUSTOMREG{field_id}' => array( 'desc' => sprintf('(<a href="%s">pro only</a>) Shows booking form custom fields that are used for guest user registration. The field_id value must match that of your custom booking form field.','http://wp-events-plugin.com/features/') ),
|
380 |
+
'#_BOOKINGFORMCUSTOMFIELDS' => array( 'desc' => sprintf('(<a href="%s">pro only</a>) Generates a list of booking form custom fields that are used in the booking.','http://wp-events-plugin.com/features/') ),
|
381 |
+
'#_BOOKINGATTENDEES' => array('desc' => sprintf('(<a href="%s">pro only</a>) Generates a list of attendee information displaying the filled in form data for each attendee (requires individual attendee forms enabled for the event). This list is split by ticket type, then by individual attendee.','http://wp-events-plugin.com/features/')), //coupons too!
|
382 |
+
'#_BOOKINGADMINURL' => array( 'desc' => 'URL for admins to view and manage the booking. This should only be used on admin-specific email templates.' ),
|
383 |
+
'#_BOOKINGADMINLINK' => array( 'desc' => 'HTML link for admins to view and manage the booking. This should only be used on admin-specific email templates.' ),
|
384 |
+
)
|
385 |
+
),
|
386 |
+
'Pricing Information' => array(
|
387 |
+
'desc' => '',
|
388 |
+
'placeholders' => array(
|
389 |
+
'#_BOOKINGPRICE' => array( 'desc' => 'Displays booking total price (tax inclusion depends on your booking settings).' ),
|
390 |
+
'#_BOOKINGPRICETAX' => array( 'desc' => 'Displays booking total tax.' ),
|
391 |
+
'#_BOOKINGPRICEWITHOUTTAX' => array( 'desc' => 'Displays booking total without tax.' ),
|
392 |
+
'#_BOOKINGPRICEWITHTAX' => array( 'desc' => 'Displays booking total with tax.' ),
|
393 |
+
)
|
394 |
+
),
|
395 |
+
'Ticket Information' => array(
|
396 |
+
'desc' => '',
|
397 |
+
'placeholders' => array(
|
398 |
+
'#_BOOKINGTICKETS' => array( 'desc' => 'Shows a breakdown of tickets and pricing, defined in the <code>emails/bookingtickets.php</code> template. (See <a href="http://wp-events-plugin.com/documentation/using-template-files/">Using Template Files</a> for more information)' ),
|
399 |
+
'#_BOOKINGTICKETDESCRIPTION' => array( 'desc' => 'Shows the description of the first ticket booked (useful in single ticket mode/events).' ),
|
400 |
+
'#_BOOKINGTICKETPRICE' => array( 'desc' => 'Shows the price of the first ticket booked, tax inclusion depending on your booking settings (useful in single ticket mode/events).' ),
|
401 |
+
'#_BOOKINGTICKETTAX' => array( 'desc' => 'Shows the tax of the first ticket booked (useful in single ticket mode/events).' ),
|
402 |
+
'#_BOOKINGTICKETPRICEWITHTAX' => array( 'desc' => 'Shows the price including tax of the first ticket booked (useful in single ticket mode/events).' ),
|
403 |
+
'#_BOOKINGTICKETPRICEWITHOUTTAX' => array( 'desc' => 'Shows the price excluding tax of the first ticket booked (useful in single ticket mode/events).' ),
|
404 |
+
)
|
405 |
+
),
|
406 |
+
'Links' => array(
|
407 |
+
'desc' => 'People are able to manage their bookings. Below are some placeholder which automatically provides correctly formatted urls',
|
408 |
+
'placeholders' => array(
|
409 |
+
'#_BOOKINGLISTURL' => array( 'desc' => 'URL to page showing that users booked events.' )
|
410 |
+
)
|
411 |
+
),
|
412 |
+
'Gateway-Specific Information' => array(
|
413 |
+
'desc' => 'Information pertaining to speicifc gateways. '. sprintf('Requires <a href="%s">Events Manager Pro</a>','http://wp-events-plugin.com/features/'),
|
414 |
+
'placeholders' => array(
|
415 |
+
'#_BOOKINGTXNID' => array( 'desc' => '<em>Online Payments Only</em> - Prints the transaction ID of this booking if available.' )
|
416 |
+
)
|
417 |
+
),
|
418 |
+
'Coupon Information' => array(
|
419 |
+
'desc' => 'When a booking has been made with a coupon, you can display coupon information using these placeholders. If no coupon is used, nothing will be shown. '.sprintf('Requires <a href="%s">Events Manager Pro</a>','http://wp-events-plugin.com/features/'),
|
420 |
+
'placeholders' => array(
|
421 |
+
'#_BOOKINGCOUPON' => array('desc' => 'Displays the coupon code followed by the amount/percentage discounted.'),
|
422 |
+
'#_BOOKINGCOUPONCODE' => array('desc' => 'Displays the coupon code used.'),
|
423 |
+
'#_BOOKINGCOUPONNAME' => array('desc' => 'Displays the name given to this coupon.'),
|
424 |
+
'#_BOOKINGCOUPONDISCOUNT' => array('desc' => 'Displays amount/percentage discounted (e.g. 25% Off).'),
|
425 |
+
'#_BOOKINGCOUPONDESCRIPTION' => array('desc' => 'Displays the coupon description.'),
|
426 |
+
)
|
427 |
+
),
|
428 |
+
),
|
429 |
+
),
|
430 |
+
//TODO add capabilites explanations
|
431 |
+
'capabilities' => array()
|
432 |
+
);
|
433 |
+
$EM_Documentation = apply_filters('em_documentation', $EM_Documentation);
|
434 |
+
}
|
435 |
+
}
|
436 |
+
add_action('init', 'em_docs_init');
|
437 |
+
|
438 |
+
function em_docs_placeholders($atts){
|
439 |
+
ob_start();
|
440 |
+
?>
|
441 |
+
<div class="em-docs">
|
442 |
+
<?php
|
443 |
+
global $EM_Documentation;
|
444 |
+
$type = $atts['type'];
|
445 |
+
$data = $EM_Documentation['placeholders'][$type];
|
446 |
+
foreach($data as $sectionTitle => $details) : ?>
|
447 |
+
<div>
|
448 |
+
<h3><?php echo $sectionTitle; ?></h3>
|
449 |
+
<?php if( !empty($details['desc']) ): ?>
|
450 |
+
<p><?php echo $details['desc']; ?></p>
|
451 |
+
<?php endif; ?>
|
452 |
+
<dl>
|
453 |
+
<?php foreach($details['placeholders'] as $placeholder => $desc ): ?>
|
454 |
+
<dt><b><?php echo $placeholder; ?></b></dt>
|
455 |
+
<dd><?php echo $desc['desc']; ?></dd>
|
456 |
+
<?php endforeach; ?>
|
457 |
+
</dl>
|
458 |
+
</div>
|
459 |
+
<?php endforeach; ?>
|
460 |
+
</div>
|
461 |
+
<?php
|
462 |
+
return ob_get_clean();
|
463 |
+
}
|
464 |
+
?>
|
trunk/admin/em-help.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Display function for the support page. here we can give links to forums and special upgrade instructions e.g. migration features
|
4 |
+
*/
|
5 |
+
function em_admin_help_page(){
|
6 |
+
global $wpdb;
|
7 |
+
?>
|
8 |
+
<div class="wrap">
|
9 |
+
<h1><?php _e('Getting Help for Events Manager','events-manager'); ?></h1>
|
10 |
+
<div class="em-docs">
|
11 |
+
<h2>Where To Get Help</h2>
|
12 |
+
<p>
|
13 |
+
This page is only a small portion of the event documentation which is here for quick reference. If you're just starting out, we recommend you visit the following places for further support:
|
14 |
+
</p>
|
15 |
+
<ol>
|
16 |
+
<li>New users are strongly encouraged to have a look at our <a href="http://wp-events-plugin.com/documentation/getting-started-guide/">getting started guide</a>.</li>
|
17 |
+
<li>Browse the other documentation pages and <a href="http://wp-events-plugin.com/tutorials/">tutorials</a>.</li>
|
18 |
+
<li>View the <a href="http://wp-events-plugin.com/documentation/faq/">FAQ</a> for general questions and <a href="http://wp-events-plugin.com/documentation/troubleshooting/">Troubleshooting</a> for common issues. These are regularly updated with recent issues.</li>
|
19 |
+
<li>Rather than trying to contact us directly, we request you use the <a href="http://wordpress.org/tags/events-manager?forum_id=10">support forums</a> as others may be experiencing the same issues as you. For faster support via private member forums and extra features please consider <a href="http://wp-events-plugin.com/events-manager-pro/">upgrading to pro</a>.</li>
|
20 |
+
</ol>
|
21 |
+
<p>
|
22 |
+
If you can't find what you're looking for in the documentation, you may find help on our <a href="http://wp-events-plugin.com/forums/">support forums</a>.
|
23 |
+
</p>
|
24 |
+
<h2><?php _e('Placeholders for customizing event pages','events-manager'); ?></h2>
|
25 |
+
<p><?php echo sprintf( __("In the <a href='%s'>settings page</a>, you'll find various textboxes where you can edit how event information looks, such as for event and location lists. Using the placeholders below, you can choose what information should be displayed.",'events-manager'), EM_ADMIN_URL .'&events-manager-options'); ?></p>
|
26 |
+
<a name="event-placeholders"></a>
|
27 |
+
<h3 style="margin-top:20px;"><?php _e('Event Related Placeholders','events-manager'); ?></h3>
|
28 |
+
<?php echo em_docs_placeholders( array('type'=>'events') ); ?>
|
29 |
+
<h3 style="margin-top:20px;"><?php _e('Event Location Placeholders','events-manager'); ?></h3>
|
30 |
+
<?php echo em_docs_placeholders( array('type'=>'event-locations') ); ?>
|
31 |
+
<a name="category-placeholders"></a>
|
32 |
+
<h3><?php _e('Category Related Placeholders','events-manager'); ?></h3>
|
33 |
+
<?php echo em_docs_placeholders( array('type'=>'categories') ); ?>
|
34 |
+
<h3><?php _e('Tag Related Placeholders','events-manager'); ?></h3>
|
35 |
+
<?php echo em_docs_placeholders( array('type'=>'tags') ); ?>
|
36 |
+
<a name="location-placeholders"></a>
|
37 |
+
<h3><?php _e('Location Related Placeholders','events-manager'); ?></h3>
|
38 |
+
<?php echo em_docs_placeholders( array('type'=>'locations') ); ?>
|
39 |
+
<a name="booking-placeholders"></a>
|
40 |
+
<h3><?php _e('Booking Related Placeholders','events-manager'); ?></h3>
|
41 |
+
<?php echo em_docs_placeholders( array('type'=>'bookings') ); ?>
|
42 |
+
</div>
|
43 |
+
<?php
|
44 |
+
|
45 |
+
//Is this a previously imported installation?
|
46 |
+
$old_table_name = $wpdb->prefix.'dbem_events';
|
47 |
+
if( $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") == $old_table_name ){
|
48 |
+
?>
|
49 |
+
<hr style="margin:30px 10px;" />
|
50 |
+
<div class="updated">
|
51 |
+
<h3>Troubleshooting upgrades from version 2.x to 3.x</h3>
|
52 |
+
<p>We notice that you upgraded from version 2, as we are now using new database tables, and we do not delete the old tables in case something went wrong with this upgrade.</p>
|
53 |
+
<p>If something went wrong with the update to version 3 read on:</p>
|
54 |
+
<h4>Scenario 1: the plugin is working, but for some reason the old events weren't imported</h4>
|
55 |
+
<p>You can safely reimport your old events from the previous tables without any risk of deleting them. However, if you click the link below <b>YOU WILL OVERWRITE ANY NEW EVENTS YOU CREATED IN VERSION 3</b></p>
|
56 |
+
<p><a onclick="return confirm('Are you sure you want to do this? Any new changes made since updating will be overwritten by your old ones, and this cannot be undone');" href="<?php echo wp_nonce_url( EM_ADMIN_URL .'&events-manager-help&em_reimport=1', 'em_reimport' ) ?>">Reimport Events from version 2</a></p>
|
57 |
+
<h4>Scenario 2: the plugin is not working, I want to go back to version 2!</h4>
|
58 |
+
<p>You can safely downgrade and will not lose any information.</p>
|
59 |
+
<ol>
|
60 |
+
<li>First of all, <a href='http://downloads.wordpress.org/plugin/events-manager.2.2.2.zip'>dowload a copy of version 2.2</a></li>
|
61 |
+
<li>Deactivate and delete Events Manager in the plugin page</li>
|
62 |
+
<li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/plugin-install.php?tab=upload">Upload the zip file you just downloaded here</a></li>
|
63 |
+
<li>Let the developers know, of any bugs you ran into while upgrading. We'll help you out if there is a simple solution, and will fix reported bugs within days, if not quicker!</li>
|
64 |
+
</ol>
|
65 |
+
</div>
|
66 |
+
<?php
|
67 |
+
}
|
68 |
+
?>
|
69 |
+
</div>
|
70 |
+
<?php
|
71 |
+
}
|
72 |
+
?>
|
trunk/admin/em-ms-locations.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Looks at the request values, saves/updates and then displays the right menu in the admin
|
4 |
+
* @return null
|
5 |
+
*/
|
6 |
+
function em_admin_ms_locations() {
|
7 |
+
//TODO EM_Location is globalized, use it fully here
|
8 |
+
global $EM_Location;
|
9 |
+
//Take actions
|
10 |
+
if( !empty($_REQUEST['action']) && ($_REQUEST['action'] == "edit" || $_REQUEST['action'] == "location_save")) {
|
11 |
+
em_admin_location();
|
12 |
+
} else {
|
13 |
+
// no action, just a locations list
|
14 |
+
em_admin_locations();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
function em_admin_locations($message='', $fill_fields = false) {
|
19 |
+
global $current_site;
|
20 |
+
?>
|
21 |
+
<div class='wrap'>
|
22 |
+
<div id='icon-edit' class='icon32'>
|
23 |
+
<br/>
|
24 |
+
</div>
|
25 |
+
<h2>
|
26 |
+
<?php _e('Locations', 'events-manager'); ?>
|
27 |
+
</h2>
|
28 |
+
<?php em_locations_admin(array('url' => $_SERVER['REQUEST_URI'])); ?>
|
29 |
+
</div>
|
30 |
+
<?php
|
31 |
+
}
|
32 |
+
|
33 |
+
function em_admin_location($message = "") {
|
34 |
+
global $EM_Location;
|
35 |
+
if( empty($EM_Location) || !is_object($EM_Location) ){
|
36 |
+
$title = __('Add location', 'events-manager');
|
37 |
+
$EM_Location = new EM_Location();
|
38 |
+
}else{
|
39 |
+
$title = __('Edit location', 'events-manager');
|
40 |
+
}
|
41 |
+
?>
|
42 |
+
<div class='wrap'>
|
43 |
+
<div id='icon-edit' class='icon32'>
|
44 |
+
<br/>
|
45 |
+
</div>
|
46 |
+
<h2><?php echo $title ?></h2>
|
47 |
+
<?php em_location_form(); ?>
|
48 |
+
</div>
|
49 |
+
<?php
|
50 |
+
}
|
51 |
+
|
52 |
+
?>
|
trunk/admin/em-ms-options.php
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function em_ms_upgrade( $blog_id ){
|
3 |
+
?>
|
4 |
+
<div class="wrap">
|
5 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
6 |
+
<h2><?php esc_html_e('Update Network','events-manager'); ?></h2>
|
7 |
+
<?php
|
8 |
+
$site_updates = EM_Options::site_get('updates');
|
9 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'upgrade_network' && check_admin_referer('em_ms_upgrade') ){
|
10 |
+
global $current_site,$wpdb;
|
11 |
+
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
12 |
+
echo '<ul>';
|
13 |
+
foreach($blog_ids as $blog_id){
|
14 |
+
$plugin_basename = plugin_basename(dirname(dirname(__FILE__)).'/events-manager.php');
|
15 |
+
if( in_array( $plugin_basename, (array) get_blog_option($blog_id, 'active_plugins', array() ) ) || is_plugin_active_for_network($plugin_basename) ){
|
16 |
+
if( EM_VERSION > get_blog_option($blog_id, 'dbem_version', 0) ){
|
17 |
+
switch_to_blog($blog_id);
|
18 |
+
require_once( dirname(__FILE__).'/../em-install.php');
|
19 |
+
em_install();
|
20 |
+
echo "<li>".sprintf(_x('Updated %s.', 'Multisite Blog Update','events-manager'), get_bloginfo('blogname'))."</li>";
|
21 |
+
restore_current_blog();
|
22 |
+
}else{
|
23 |
+
echo "<li>".sprintf(_x('%s is up to date.', 'Multisite Blog Update','events-manager'), get_blog_option($blog_id, 'blogname'))."</li>";
|
24 |
+
}
|
25 |
+
}else{
|
26 |
+
echo "<li>".sprintf(_x('%s does not have Events Manager activated.', 'Multisite Blog Update','events-manager'), get_blog_option($blog_id, 'blogname'))."</li>";
|
27 |
+
}
|
28 |
+
}
|
29 |
+
echo '</ul>';
|
30 |
+
echo "<p>".esc_html__('Update process has finished.', 'events-manager')."</p>";
|
31 |
+
}elseif( !empty($_REQUEST['action']) && !empty($site_updates[$_REQUEST['action']]) ){
|
32 |
+
do_action('em_admin_update_ms_'.$_REQUEST['action']);
|
33 |
+
}else{
|
34 |
+
?>
|
35 |
+
<form action="" method="post">
|
36 |
+
<p><?php esc_html_e('To update your network blogs with the latest Events Manager automatically, click the update button below.','events-manager'); ?></p>
|
37 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('em_ms_upgrade'); ?>" />
|
38 |
+
<input type="hidden" name="action" value="upgrade_network" />
|
39 |
+
<input type="submit" value="<?php esc_attr_e('Update Network','events-manager'); ?>" class="button-primary" />
|
40 |
+
</form>
|
41 |
+
<?php
|
42 |
+
//extra upgrade stuff
|
43 |
+
foreach( $site_updates as $update => $update_data ){
|
44 |
+
do_action('em_admin_update_ms_settings_'.$update, $update_data);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
?>
|
48 |
+
</div>
|
49 |
+
<?php
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Displays network-related options in the network admin section
|
54 |
+
* @uses em_options_save() to save settings
|
55 |
+
*/
|
56 |
+
function em_ms_admin_options_page() {
|
57 |
+
global $wpdb,$EM_Notices;
|
58 |
+
//Check for uninstall/reset request
|
59 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' ){
|
60 |
+
em_admin_options_uninstall_page();
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ){
|
64 |
+
em_admin_options_reset_page();
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
//TODO place all options into an array
|
68 |
+
$tabs_enabled = defined('EM_SETTINGS_TABS') && EM_SETTINGS_TABS;
|
69 |
+
$events_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#event-placeholders">'. __('Event Related Placeholders','events-manager') .'</a>';
|
70 |
+
$locations_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#location-placeholders">'. __('Location Related Placeholders','events-manager') .'</a>';
|
71 |
+
$bookings_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#booking-placeholders">'. __('Booking Related Placeholders','events-manager') .'</a>';
|
72 |
+
$categories_placeholders = '<a href="'.EM_ADMIN_URL .'&events-manager-help#category-placeholders">'. __('Category Related Placeholders','events-manager') .'</a>';
|
73 |
+
$events_placeholder_tip = " ". sprintf(__('This accepts %s and %s placeholders.','events-manager'),$events_placeholders, $locations_placeholders);
|
74 |
+
$locations_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','events-manager'), $locations_placeholders);
|
75 |
+
$categories_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','events-manager'), $categories_placeholders);
|
76 |
+
$bookings_placeholder_tip = " ". sprintf(__('This accepts %s, %s and %s placeholders.','events-manager'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
|
77 |
+
|
78 |
+
global $save_button;
|
79 |
+
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" class="button-primary" name="Submit" value="'. __( 'Save Changes', 'events-manager') .' ('. __('All','events-manager') .')" /></p></td></tr>';
|
80 |
+
//Do some multisite checking here for reuse
|
81 |
+
?>
|
82 |
+
<script type="text/javascript" charset="utf-8"><?php include(EM_DIR.'/includes/js/admin-settings.js'); ?></script>
|
83 |
+
<script type="text/javascript" charset="utf-8">
|
84 |
+
jQuery(document).ready(function($){
|
85 |
+
//events
|
86 |
+
$('input[name="dbem_ms_global_events"]').on('change', function(){
|
87 |
+
if( $('input:radio[name="dbem_ms_global_events"]:checked').val() == 1 ){
|
88 |
+
$("tr#dbem_ms_global_events_links_row").show();
|
89 |
+
$('input:radio[name="dbem_ms_global_events_links"]:checked').trigger('change');
|
90 |
+
}else{
|
91 |
+
$("tr#dbem_ms_global_events_links_row, tr#dbem_ms_events_slug_row").hide();
|
92 |
+
}
|
93 |
+
}).first().trigger('change');
|
94 |
+
$('input[name="dbem_ms_global_events_links"]').on('change', function(){
|
95 |
+
if( $('input:radio[name="dbem_ms_global_events_links"]:checked').val() == 1 ){
|
96 |
+
$("tr#dbem_ms_events_slug_row").hide();
|
97 |
+
}else{
|
98 |
+
$("tr#dbem_ms_events_slug_row").show();
|
99 |
+
}
|
100 |
+
}).first().trigger('change');
|
101 |
+
//locations
|
102 |
+
$('input[name="dbem_ms_mainblog_locations"]').on('change', function(){
|
103 |
+
if( $('input:radio[name="dbem_ms_mainblog_locations"]:checked').val() == 1 ){
|
104 |
+
$("tbody.em-global-locations").hide();
|
105 |
+
}else{
|
106 |
+
$("tbody.em-global-locations").show();
|
107 |
+
}
|
108 |
+
}).first().trigger('change');
|
109 |
+
$('input[name="dbem_ms_global_locations"]').on('change', function(){
|
110 |
+
if( $('input:radio[name="dbem_ms_global_locations"]:checked').val() == 1 ){
|
111 |
+
$("tr#dbem_ms_global_locations_links_row").show();
|
112 |
+
$('input:radio[name="dbem_ms_global_locations_links"]:checked').trigger('change');
|
113 |
+
}else{
|
114 |
+
$("tr#dbem_ms_global_locations_links_row, tr#dbem_ms_locations_slug_row").hide();
|
115 |
+
}
|
116 |
+
}).first().trigger('change');
|
117 |
+
$('input[name="dbem_ms_global_locations_links"]').on('change', function(){
|
118 |
+
if( $('input:radio[name="dbem_ms_global_locations_links"]:checked').val() == 1 ){
|
119 |
+
$("tr#dbem_ms_locations_slug_row").hide();
|
120 |
+
}else{
|
121 |
+
$("tr#dbem_ms_locations_slug_row").show();
|
122 |
+
}
|
123 |
+
});
|
124 |
+
//MS Mode selection hiders
|
125 |
+
$('input[name="dbem_ms_global_table"]').on('change', function(){ //global
|
126 |
+
if( $('input:radio[name="dbem_ms_global_table"]:checked').val() == 1 ){
|
127 |
+
$("tbody.em-global-options").show();
|
128 |
+
$('input:radio[name="dbem_ms_mainblog_locations"]:checked').trigger('change');
|
129 |
+
}else{
|
130 |
+
$("tbody.em-global-options").hide();
|
131 |
+
}
|
132 |
+
}).first().trigger('change');
|
133 |
+
});
|
134 |
+
</script>
|
135 |
+
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
|
136 |
+
<div class="wrap <?php if(empty($tabs_enabled)) echo 'tabs-active' ?>">
|
137 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
138 |
+
<h1 id="em-options-title"><?php _e ( 'Event Manager Options', 'events-manager'); ?></h1>
|
139 |
+
<h2 class="nav-tab-wrapper">
|
140 |
+
<?php
|
141 |
+
if( $tabs_enabled ){
|
142 |
+
$general_tab_link = esc_url(add_query_arg( array('em_tab'=>'general')));
|
143 |
+
}else{
|
144 |
+
$general_tab_link = '';
|
145 |
+
}
|
146 |
+
?>
|
147 |
+
<a href="<?php echo $general_tab_link ?>#general" id="em-menu-general" class="nav-tab nav-tab-active"><?php esc_html_e('General','events-manager'); ?></a>
|
148 |
+
<?php
|
149 |
+
$custom_tabs = apply_filters('em_ms_options_page_tabs', array());
|
150 |
+
foreach( $custom_tabs as $tab_key => $tab_name ){
|
151 |
+
$tab_link = !empty($tabs_enabled) ? esc_url(add_query_arg( array('em_tab'=>$tab_key))) : '';
|
152 |
+
$active_class = !empty($tabs_enabled) && !empty($_GET['em_tab']) && $_GET['em_tab'] == $tab_key ? 'nav-tab-active':'';
|
153 |
+
echo "<a href='$tab_link#$tab_key' id='em-menu-$tab_key' class='nav-tab $active_class'>$tab_name</a>";
|
154 |
+
}
|
155 |
+
?>
|
156 |
+
</h2>
|
157 |
+
<?php echo $EM_Notices; ?>
|
158 |
+
<form id="em-options-form" method="post" action="">
|
159 |
+
<div class="metabox-holder">
|
160 |
+
<!-- // TODO Move style in css -->
|
161 |
+
<div class='postbox-container' style='width: 99.5%'>
|
162 |
+
<div id="">
|
163 |
+
<?php if( !$tabs_enabled || ($tabs_enabled && (empty($_REQUEST['em_tab']) || $_REQUEST['em_tab'] == 'general')) ): //make less changes for now, since we don't have any core tabs to add yet ?>
|
164 |
+
<div class="em-menu-general em-menu-group">
|
165 |
+
<div class="postbox " id="em-opt-ms-options" >
|
166 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Multi Site Options', 'events-manager'); ?></span></h3>
|
167 |
+
<div class="inside">
|
168 |
+
<table class="form-table">
|
169 |
+
<?php
|
170 |
+
em_options_radio_binary ( __( 'Enable global tables mode?', 'events-manager'), 'dbem_ms_global_table', __( 'Setting this to yes will make all events save in the main site event tables (EM must also be activated). This allows you to share events across different blogs, such as showing events in your network whilst allowing users to display and manage their events within their own blog. Bear in mind that activating this will mean old events created on the sub-blogs will not be accessible anymore, and if you switch back they will be but new events created during global events mode will only remain on the main site.','events-manager') );
|
171 |
+
?>
|
172 |
+
<tbody class="em-global-options">
|
173 |
+
<?php
|
174 |
+
global $current_site;
|
175 |
+
$global_slug_tip = __('%s belonging to other sub-sites will have an extra slug prepended to it so that your main site can differentiate between its own %s and those belonging to other sites in your network.','events-manager');
|
176 |
+
$global_link_tip = __( 'When displaying global %s on the main site you have the option of users viewing the %s details on the main site or being directed to the sub-site.','events-manager');
|
177 |
+
$global_post_tip = __( 'Displays %s from all sites on the network by default. You can still restrict %s by blog using shortcodes and template tags coupled with the <code>blog</code> attribute. Requires global tables to be turned on.','events-manager');
|
178 |
+
$global_link_tip2 = __('You <strong>must</strong> have assigned a %s page in your <a href="%s">main blog settings</a> for this to work.','events-manager');
|
179 |
+
$options_page_link = get_admin_url($current_site->blog_id, 'edit.php?post_type='.EM_POST_TYPE_EVENT.'&page=events-manager-options#pages');
|
180 |
+
?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','events-manager'),__('Event','events-manager')); ?></h4></td></tr><?php
|
181 |
+
em_options_radio_binary ( sprintf(__( 'Display global events on main blog?', 'events-manager'), __('events','events-manager')), 'dbem_ms_global_events', sprintf($global_post_tip, __('events','events-manager'), __('events','events-manager')) );
|
182 |
+
em_options_radio_binary ( sprintf(__( 'Link sub-site %s directly to sub-site?', 'events-manager'), __('events','events-manager')), 'dbem_ms_global_events_links', sprintf($global_link_tip, __('events','events-manager'), __('event','events-manager')).sprintf($global_link_tip2, __('event','events-manager'), $options_page_link) );
|
183 |
+
em_options_input_text ( sprintf(__( 'Global %s slug', 'events-manager'),__('event','events-manager')), 'dbem_ms_events_slug', sprintf($global_slug_tip, __('Events','events-manager'), __('events','events-manager')).__('Example:','events-manager').'<code>http://yoursite.com/events/<strong>event</strong>/subsite-event-slug/', EM_EVENT_SLUG );
|
184 |
+
?><tr class="em-header"><td><h4><?php echo sprintf(__('%s Options','events-manager'),__('Location','events-manager')); ?></h4></td></tr><?php
|
185 |
+
em_options_radio_binary ( sprintf(__( 'Locations on main blog?', 'events-manager'), __('locations','events-manager')), 'dbem_ms_mainblog_locations', __('If you would prefer all your locations to belong to your main blog, users in sub-sites will still be able to create locations, but the actual locations are created and reside in the main blog.','events-manager') );
|
186 |
+
?>
|
187 |
+
</tbody>
|
188 |
+
<tbody class="em-global-options em-global-locations">
|
189 |
+
<?php
|
190 |
+
em_options_radio_binary ( sprintf(__( 'Display global %s on main blog?', 'events-manager'), __('locations','events-manager')), 'dbem_ms_global_locations', sprintf($global_post_tip, __('locations','events-manager'), __('locations','events-manager')) );
|
191 |
+
em_options_radio_binary ( sprintf(__( 'Link sub-site %s directly to sub-site?', 'events-manager'), __('locations','events-manager')), 'dbem_ms_global_locations_links', sprintf($global_link_tip, __('locations','events-manager'), __('location','events-manager')).sprintf($global_link_tip2, __('location','events-manager'), $options_page_link) );
|
192 |
+
em_options_input_text ( sprintf(__( 'Global %s slug', 'events-manager'),__('location','events-manager')), 'dbem_ms_locations_slug', sprintf($global_slug_tip, __('Locations','events-manager'), __('locations','events-manager')).__('Example:','events-manager').'<code>http://yoursite.com/locations/<strong>location</strong>/subsite-location-slug/', EM_LOCATION_SLUG );
|
193 |
+
?>
|
194 |
+
</tbody>
|
195 |
+
<?php echo $save_button; ?>
|
196 |
+
</table>
|
197 |
+
|
198 |
+
</div> <!-- . inside -->
|
199 |
+
</div> <!-- .postbox -->
|
200 |
+
|
201 |
+
<?php
|
202 |
+
//including shared MS/non-MS boxes
|
203 |
+
em_admin_option_box_caps();
|
204 |
+
em_admin_option_box_image_sizes();
|
205 |
+
em_admin_option_box_email();
|
206 |
+
em_admin_option_box_uninstall();
|
207 |
+
?>
|
208 |
+
|
209 |
+
<?php do_action('em_ms_options_page_footer'); ?>
|
210 |
+
</div> <!-- .em-menu-general -->
|
211 |
+
<?php endif; ?>
|
212 |
+
<?php
|
213 |
+
//other tabs
|
214 |
+
if( $tabs_enabled ){
|
215 |
+
if( array_key_exists($_REQUEST['em_tab'], $custom_tabs) ){
|
216 |
+
?>
|
217 |
+
<div class="em-menu-bookings em-menu-group">
|
218 |
+
<?php do_action('em_ms_options_page_tab_'. $_REQUEST['em_tab']); ?>
|
219 |
+
</div>
|
220 |
+
<?php
|
221 |
+
}
|
222 |
+
}else{
|
223 |
+
foreach( $custom_tabs as $tab_key => $tab_name ){
|
224 |
+
?>
|
225 |
+
<div class="em-menu-<?php echo esc_attr($tab_key) ?> em-menu-group" style="display:none;">
|
226 |
+
<?php do_action('em_ms_options_page_tab_'. $tab_key); ?>
|
227 |
+
</div>
|
228 |
+
<?php
|
229 |
+
}
|
230 |
+
}
|
231 |
+
?>
|
232 |
+
|
233 |
+
<p class="submit">
|
234 |
+
<input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes', 'events-manager'); ?>" />
|
235 |
+
<input type="hidden" name="em-submitted" value="1" />
|
236 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('events-manager-options'); ?>" />
|
237 |
+
</p>
|
238 |
+
|
239 |
+
</div> <!-- .metabox-sortables -->
|
240 |
+
</div> <!-- .postbox-container -->
|
241 |
+
|
242 |
+
</div> <!-- .metabox-holder -->
|
243 |
+
</form>
|
244 |
+
</div>
|
245 |
+
<?php
|
246 |
+
}
|
247 |
+
?>
|
trunk/admin/em-options.php
ADDED
@@ -0,0 +1,1056 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//Function composing the options subpanel
|
3 |
+
function em_options_save(){
|
4 |
+
global $EM_Notices; /* @var EM_Notices $EM_Notices */
|
5 |
+
/*
|
6 |
+
* Here's the idea, we have an array of all options that need super admin approval if in multi-site mode
|
7 |
+
* since options are only updated here, its one place fit all
|
8 |
+
*/
|
9 |
+
if( current_user_can('manage_options') && !empty($_POST['em-submitted']) && check_admin_referer('events-manager-options','_wpnonce') ){
|
10 |
+
//Build the array of options here
|
11 |
+
EM_Formats::remove_filters(true); // just in case
|
12 |
+
|
13 |
+
foreach ($_POST as $postKey => $postValue){
|
14 |
+
if( $postKey != 'dbem_data' && substr($postKey, 0, 5) == 'dbem_' ){
|
15 |
+
//TODO some more validation/reporting
|
16 |
+
$numeric_options = array('dbem_locations_default_limit','dbem_events_default_limit');
|
17 |
+
if( in_array($postKey, array('dbem_bookings_notify_admin','dbem_event_submitted_email_admin','dbem_js_limit_events_form','dbem_js_limit_search','dbem_js_limit_general','dbem_css_limit_include','dbem_css_limit_exclude','dbem_search_form_geo_distance_options')) ){ $postValue = str_replace(' ', '', $postValue); } //clean up comma separated emails, no spaces needed
|
18 |
+
if( in_array($postKey,$numeric_options) && !is_numeric($postValue) ){
|
19 |
+
//Do nothing, keep old setting.
|
20 |
+
}elseif( ($postKey == 'dbem_category_default_color' || $postKey == 'dbem_tag_default_color') && !sanitize_hex_color($postValue) ){
|
21 |
+
$EM_Notices->add_error( sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>').' '. esc_html__('This setting was not changed.', 'events-manager'), true);
|
22 |
+
}elseif( $postKey == 'dbem_oauth' && is_array($postValue) ){
|
23 |
+
foreach($postValue as $postValue_key=>$postValue_val){
|
24 |
+
EM_Options::set($postValue_key, wp_unslash($postValue_val), 'dbem_oauth');
|
25 |
+
}
|
26 |
+
}else{
|
27 |
+
//TODO slashes being added?
|
28 |
+
if( is_array($postValue) ){
|
29 |
+
foreach($postValue as $postValue_key=>$postValue_val) $postValue[$postValue_key] = wp_unslash($postValue_val);
|
30 |
+
}else{
|
31 |
+
$postValue = wp_unslash($postValue);
|
32 |
+
}
|
33 |
+
update_option($postKey, $postValue);
|
34 |
+
}
|
35 |
+
}elseif( $postKey == 'dbem_data' && is_array($postValue) ){
|
36 |
+
foreach( $postValue as $postK => $postV ){
|
37 |
+
//TODO slashes being added?
|
38 |
+
if( is_array($postV) ){
|
39 |
+
foreach($postV as $postValue_key=>$postValue_val) $postV[$postValue_key] = wp_unslash($postValue_val);
|
40 |
+
}else{
|
41 |
+
$postV = wp_unslash($postV);
|
42 |
+
}
|
43 |
+
EM_Options::set( $postK, $postV );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
// check formatting mode and optimize autoloading of formats from wp_options, first we make it all auto-loadable
|
49 |
+
global $wpdb;
|
50 |
+
$formats_to_autoload = EM_Formats::get_default_formats( true );
|
51 |
+
array_walk($formats_to_autoload, 'sanitize_key');
|
52 |
+
$wpdb->query("UPDATE {$wpdb->options} SET autoload='yes' WHERE option_name IN ('". implode("','", $formats_to_autoload) ."')");
|
53 |
+
if( get_option('dbem_advanced_formatting') < 2 ){
|
54 |
+
// now we make only the ones that we're loading from files directly non-autoloadable
|
55 |
+
$formats_to_not_autoload = EM_Formats::get_default_formats();
|
56 |
+
array_walk($formats_to_not_autoload, 'sanitize_key');
|
57 |
+
$wpdb->query("UPDATE {$wpdb->options} SET autoload='no' WHERE option_name IN ('". implode("','", $formats_to_not_autoload) ."')");
|
58 |
+
}// if set to 2 then we're just autoloading everything anyway
|
59 |
+
if( get_option('dbem_advanced_formatting') == 1 ){
|
60 |
+
$wpdb->query("UPDATE {$wpdb->options} SET autoload='yes' WHERE option_name='dbem_advanced_formatting_modes'");
|
61 |
+
}else{
|
62 |
+
$wpdb->query("UPDATE {$wpdb->options} SET autoload='no' WHERE option_name='dbem_advanced_formatting_modes'");
|
63 |
+
}
|
64 |
+
|
65 |
+
//set capabilities
|
66 |
+
if( !empty($_POST['em_capabilities']) && is_array($_POST['em_capabilities']) && (!is_multisite() || is_multisite() && em_wp_is_super_admin()) ){
|
67 |
+
global $em_capabilities_array, $wp_roles;
|
68 |
+
if( is_multisite() && is_network_admin() && $_POST['dbem_ms_global_caps'] == 1 ){
|
69 |
+
//apply_caps_to_blog
|
70 |
+
global $current_site,$wpdb;
|
71 |
+
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
72 |
+
foreach($blog_ids as $blog_id){
|
73 |
+
switch_to_blog($blog_id);
|
74 |
+
//normal blog role application
|
75 |
+
foreach( $wp_roles->role_objects as $role_name => $role ){
|
76 |
+
foreach( array_keys($em_capabilities_array) as $capability){
|
77 |
+
if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){
|
78 |
+
$role->add_cap($capability);
|
79 |
+
}else{
|
80 |
+
$role->remove_cap($capability);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
restore_current_blog();
|
85 |
+
}
|
86 |
+
}elseif( !is_network_admin() ){
|
87 |
+
//normal blog role application
|
88 |
+
foreach( $wp_roles->role_objects as $role_name => $role ){
|
89 |
+
foreach( array_keys($em_capabilities_array) as $capability){
|
90 |
+
if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){
|
91 |
+
$role->add_cap($capability);
|
92 |
+
}else{
|
93 |
+
$role->remove_cap($capability);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
update_option('dbem_flush_needed',1);
|
100 |
+
do_action('em_options_save');
|
101 |
+
$EM_Notices->add_confirm('<strong>'.__('Changes saved.', 'events-manager').'</strong>', true);
|
102 |
+
$referrer = em_wp_get_referer();
|
103 |
+
//add tab hash path to url if supplied
|
104 |
+
if( !empty($_REQUEST['tab_path']) ){
|
105 |
+
$referrer_array = explode('#', $referrer);
|
106 |
+
$referrer = esc_url_raw($referrer_array[0] . '#' . $_REQUEST['tab_path']);
|
107 |
+
}
|
108 |
+
wp_safe_redirect($referrer);
|
109 |
+
exit();
|
110 |
+
}
|
111 |
+
//Uninstall
|
112 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' && current_user_can('activate_plugins') && !empty($_REQUEST['confirmed']) && check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
|
113 |
+
if( check_admin_referer('em_uninstall_'.get_current_user_id().'_confirmed','_wpnonce2') ){
|
114 |
+
//We have a go to uninstall
|
115 |
+
global $wpdb;
|
116 |
+
//delete EM posts
|
117 |
+
remove_action('before_delete_post',array('EM_Location_Post_Admin','before_delete_post'),10,1);
|
118 |
+
remove_action('before_delete_post',array('EM_Event_Post_Admin','before_delete_post'),10,1);
|
119 |
+
remove_action('before_delete_post',array('EM_Event_Recurring_Post_Admin','before_delete_post'),10,1);
|
120 |
+
$post_ids = $wpdb->get_col('SELECT ID FROM '.$wpdb->posts." WHERE post_type IN ('".EM_POST_TYPE_EVENT."','".EM_POST_TYPE_LOCATION."','event-recurring')");
|
121 |
+
foreach($post_ids as $post_id){
|
122 |
+
wp_delete_post($post_id);
|
123 |
+
}
|
124 |
+
//delete categories
|
125 |
+
$cat_terms = get_terms(EM_TAXONOMY_CATEGORY, array('hide_empty'=>false));
|
126 |
+
foreach($cat_terms as $cat_term){
|
127 |
+
wp_delete_term($cat_term->term_id, EM_TAXONOMY_CATEGORY);
|
128 |
+
}
|
129 |
+
$tag_terms = get_terms(EM_TAXONOMY_TAG, array('hide_empty'=>false));
|
130 |
+
foreach($tag_terms as $tag_term){
|
131 |
+
wp_delete_term($tag_term->term_id, EM_TAXONOMY_TAG);
|
132 |
+
}
|
133 |
+
//delete EM tables
|
134 |
+
$wpdb->query('DROP TABLE '.EM_EVENTS_TABLE);
|
135 |
+
$wpdb->query('DROP TABLE '.EM_BOOKINGS_TABLE);
|
136 |
+
$wpdb->query('DROP TABLE '.EM_LOCATIONS_TABLE);
|
137 |
+
$wpdb->query('DROP TABLE '.EM_TICKETS_TABLE);
|
138 |
+
$wpdb->query('DROP TABLE '.EM_TICKETS_BOOKINGS_TABLE);
|
139 |
+
$wpdb->query('DROP TABLE '.EM_RECURRENCE_TABLE);
|
140 |
+
$wpdb->query('DROP TABLE '.EM_META_TABLE);
|
141 |
+
|
142 |
+
//delete options
|
143 |
+
$wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\'');
|
144 |
+
//deactivate and go!
|
145 |
+
deactivate_plugins(array('events-manager/events-manager.php','events-manager-pro/events-manager-pro.php'), true);
|
146 |
+
wp_safe_redirect(admin_url('plugins.php?deactivate=true'));
|
147 |
+
exit();
|
148 |
+
}
|
149 |
+
}
|
150 |
+
//Reset
|
151 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && !empty($_REQUEST['confirmed']) && check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
|
152 |
+
if( check_admin_referer('em_reset_'.get_current_user_id().'_confirmed','_wpnonce2') ){
|
153 |
+
//We have a go to uninstall
|
154 |
+
global $wpdb;
|
155 |
+
//delete options
|
156 |
+
$wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\'');
|
157 |
+
//reset capabilities
|
158 |
+
global $em_capabilities_array, $wp_roles;
|
159 |
+
foreach( $wp_roles->role_objects as $role_name => $role ){
|
160 |
+
foreach( array_keys($em_capabilities_array) as $capability){
|
161 |
+
$role->remove_cap($capability);
|
162 |
+
}
|
163 |
+
}
|
164 |
+
//go back to plugin options page
|
165 |
+
$EM_Notices->add_confirm(__('Settings have been reset back to default. Your events, locations and categories have not been modified.','events-manager'), true);
|
166 |
+
wp_safe_redirect(em_wp_get_referer());
|
167 |
+
exit();
|
168 |
+
}
|
169 |
+
}
|
170 |
+
//Cleanup Event Orphans
|
171 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'cleanup_event_orphans' && check_admin_referer('em_cleanup_event_orphans_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
|
172 |
+
//Firstly, get all orphans
|
173 |
+
global $wpdb;
|
174 |
+
$sql = 'SELECT event_id FROM '.EM_EVENTS_TABLE.' WHERE post_id NOT IN (SELECT ID FROM ' .$wpdb->posts. ' WHERE post_type="'. EM_POST_TYPE_EVENT .'" OR post_type="event-recurring")';
|
175 |
+
if( EM_MS_GLOBAL ){
|
176 |
+
if( is_main_site() ){
|
177 |
+
$sql .= $wpdb->prepare(' AND (blog_id=%d or blog_id IS NULL)', get_current_blog_id());
|
178 |
+
}else{
|
179 |
+
$sql .= $wpdb->prepare(' AND blog_id=%d', get_current_blog_id());
|
180 |
+
}
|
181 |
+
}
|
182 |
+
$results = $wpdb->get_col($sql);
|
183 |
+
$deleted_events = 0;
|
184 |
+
foreach( $results as $event_id ){
|
185 |
+
$EM_Event = new EM_Event($event_id);
|
186 |
+
if( !empty($EM_Event->orphaned_event) && $EM_Event->delete() ){
|
187 |
+
$deleted_events++;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
//go back to plugin options page
|
191 |
+
$EM_Notices->add_confirm(sprintf(__('Found %d orphaned events, deleted %d successfully','events-manager'), count($results), $deleted_events), true);
|
192 |
+
wp_safe_redirect(em_wp_get_referer());
|
193 |
+
exit();
|
194 |
+
}
|
195 |
+
//Force Update Recheck - Workaround for now
|
196 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'recheck_updates' && check_admin_referer('em_recheck_updates_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
|
197 |
+
//force recheck of plugin updates, to refresh dl links
|
198 |
+
delete_transient('update_plugins');
|
199 |
+
delete_site_transient('update_plugins');
|
200 |
+
$EM_Notices->add_confirm(__('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','events-manager'), true);
|
201 |
+
wp_safe_redirect(em_wp_get_referer());
|
202 |
+
exit();
|
203 |
+
}
|
204 |
+
//Flag version checking to look at trunk, not tag
|
205 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'check_devs' && check_admin_referer('em_check_devs_wpnonce') && em_wp_is_super_admin() ){
|
206 |
+
//delete transients, and add a flag to recheck dev version next time round
|
207 |
+
delete_transient('update_plugins');
|
208 |
+
delete_site_transient('update_plugins');
|
209 |
+
update_option('em_check_dev_version', true);
|
210 |
+
$EM_Notices->add_confirm(__('Checking for dev versions.','events-manager').' '. __('If there are any new updates, you should now see them in your Plugins or Updates admin pages.','events-manager'), true);
|
211 |
+
wp_safe_redirect(em_wp_get_referer());
|
212 |
+
exit();
|
213 |
+
}
|
214 |
+
//import EM settings
|
215 |
+
if( !empty($_REQUEST['action']) && ( ($_REQUEST['action'] == 'import_em_settings' && check_admin_referer('import_em_settings')) || (is_multisite() && $_REQUEST['action'] == 'import_em_ms_settings' && check_admin_referer('import_em_ms_settings')) ) && em_wp_is_super_admin() ){
|
216 |
+
//upload uniquely named file to system for usage later
|
217 |
+
if( !empty($_FILES['import_settings_file']['size']) && is_uploaded_file($_FILES['import_settings_file']['tmp_name']) ){
|
218 |
+
$settings = file_get_contents($_FILES['import_settings_file']['tmp_name']);
|
219 |
+
$settings = json_decode($settings, true);
|
220 |
+
if( is_array($settings) ){
|
221 |
+
if( is_multisite() && $_REQUEST['action'] == 'import_em_ms_settings' ){
|
222 |
+
global $EM_MS_Globals, $wpdb;
|
223 |
+
$sitewide_options = $EM_MS_Globals->get_globals();
|
224 |
+
foreach( $settings as $k => $v ){
|
225 |
+
if( in_array($k, $sitewide_options) ) update_site_option($k, $v);
|
226 |
+
}
|
227 |
+
}else{
|
228 |
+
foreach( $settings as $k => $v ){
|
229 |
+
if( preg_match('/^(?:db)emp?_/', $k) ){
|
230 |
+
update_option($k, $v);
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
$EM_Notices->add_confirm(__('Settings imported.','events-manager'), true);
|
235 |
+
wp_safe_redirect(em_wp_get_referer());
|
236 |
+
exit();
|
237 |
+
}
|
238 |
+
}
|
239 |
+
$EM_Notices->add_error(__('Please upload a valid txt file containing Events Manager import settings.','events-manager'), true);
|
240 |
+
wp_safe_redirect(em_wp_get_referer());
|
241 |
+
exit();
|
242 |
+
}
|
243 |
+
//export EM settings
|
244 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_settings' && check_admin_referer('export_em_settings') && em_wp_is_super_admin() ){
|
245 |
+
global $wpdb;
|
246 |
+
$results = $wpdb->get_results('SELECT option_name, option_value FROM '.$wpdb->options ." WHERE option_name LIKE 'dbem_%' OR option_name LIKE 'emp_%' OR option_name LIKE 'em_%'", ARRAY_A);
|
247 |
+
$options = array();
|
248 |
+
foreach( $results as $result ) $options[$result['option_name']] = $result['option_value'];
|
249 |
+
header('Content-Type: text/plain; charset=utf-8');
|
250 |
+
header('Content-Disposition: attachment; filename="events-manager-settings.txt"');
|
251 |
+
echo json_encode($options);
|
252 |
+
exit();
|
253 |
+
}elseif( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_em_ms_settings' && check_admin_referer('export_em_ms_settings') && is_multisite() && em_wp_is_super_admin() ){
|
254 |
+
//delete transients, and add a flag to recheck dev version next time round
|
255 |
+
global $EM_MS_Globals, $wpdb;
|
256 |
+
$options = array();
|
257 |
+
$sitewide_options = $EM_MS_Globals->get_globals();
|
258 |
+
foreach( $sitewide_options as $option ) $options[$option] = get_site_option($option);
|
259 |
+
header('Content-Type: text/plain; charset=utf-8');
|
260 |
+
header('Content-Disposition: attachment; filename="events-manager-settings.txt"');
|
261 |
+
echo json_encode($options);
|
262 |
+
exit();
|
263 |
+
}
|
264 |
+
|
265 |
+
//reset timezones
|
266 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset_timezones' && check_admin_referer('reset_timezones') && em_wp_is_super_admin() ){
|
267 |
+
include(EM_DIR.'/em-install.php');
|
268 |
+
if( empty($_REQUEST['timezone_reset_value']) ) return;
|
269 |
+
$timezone = str_replace('UTC ', '', $_REQUEST['timezone_reset_value']);
|
270 |
+
if( is_multisite() ){
|
271 |
+
if( !empty($_REQUEST['timezone_reset_blog']) && is_numeric($_REQUEST['timezone_reset_blog']) ){
|
272 |
+
$blog_id = $_REQUEST['timezone_reset_blog'];
|
273 |
+
switch_to_blog($blog_id);
|
274 |
+
if( $timezone == 'default' ){
|
275 |
+
$timezone = str_replace(' ', EM_DateTimeZone::create()->getName());
|
276 |
+
}
|
277 |
+
$blog_name = get_bloginfo('name');
|
278 |
+
$result = em_migrate_datetime_timezones(true, true, $timezone);
|
279 |
+
restore_current_blog();
|
280 |
+
}elseif( !empty($_REQUEST['timezone_reset_blog']) && ($_REQUEST['timezone_reset_blog'] == 'all' || $_REQUEST['timezone_reset_blog'] == 'all-resume') ){
|
281 |
+
global $wpdb, $current_site;
|
282 |
+
$blog_ids = $blog_ids_progress = get_site_option('dbem_reset_timezone_multisite_progress', false);
|
283 |
+
if( !is_array($blog_ids) || $_REQUEST['timezone_reset_blog'] == 'all' ){
|
284 |
+
$blog_ids = $blog_ids_progress = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
285 |
+
update_site_option('dbem_reset_timezone_multisite_progress', $blog_ids_progress);
|
286 |
+
}
|
287 |
+
foreach($blog_ids as $k => $blog_id){
|
288 |
+
$result = true;
|
289 |
+
$plugin_basename = plugin_basename(dirname(dirname(__FILE__)).'/events-manager.php');
|
290 |
+
if( in_array( $plugin_basename, (array) get_blog_option($blog_id, 'active_plugins', array() ) ) || is_plugin_active_for_network($plugin_basename) ){
|
291 |
+
switch_to_blog($blog_id);
|
292 |
+
$blog_timezone = $timezone == 'default' ? str_replace(' ', '', EM_DateTimeZone::create()->getName()) : $timezone;
|
293 |
+
$blog_name = get_bloginfo('name');
|
294 |
+
$blog_result = em_migrate_datetime_timezones(true, true, $blog_timezone);
|
295 |
+
if( !$blog_result ){
|
296 |
+
$fails[$blog_id] = $blog_name;
|
297 |
+
}else{
|
298 |
+
unset($blog_ids_progress[$k]);
|
299 |
+
update_site_option('dbem_reset_timezone_multisite_progress', $blog_ids_progress);
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
303 |
+
if( !empty($fails) ){
|
304 |
+
$result = __('The following blog timezones could not be successfully reset:', 'events-manager');
|
305 |
+
$result .= '<ul>';
|
306 |
+
foreach( $fails as $fail ) $result .= '<li>'.$fail.'</li>';
|
307 |
+
$result .= '</ul>';
|
308 |
+
}else{
|
309 |
+
delete_site_option('dbem_reset_timezone_multisite_progress');
|
310 |
+
EM_Admin_Notices::remove('date_time_migration_5.9_multisite', true);
|
311 |
+
}
|
312 |
+
restore_current_blog();
|
313 |
+
}else{
|
314 |
+
$result = __('A valid blog ID must be provided, you can only reset one blog at a time.','events-manager');
|
315 |
+
}
|
316 |
+
}else{
|
317 |
+
$result = em_migrate_datetime_timezones(true, true, $timezone);
|
318 |
+
}
|
319 |
+
if( $result !== true ){
|
320 |
+
$EM_Notices->add_error($result, true);
|
321 |
+
}else{
|
322 |
+
if( is_multisite() ){
|
323 |
+
if( $_REQUEST['timezone_reset_blog'] == 'all' || $_REQUEST['timezone_reset_blog'] == 'all-resume' ){
|
324 |
+
$EM_Notices->add_confirm(sprintf(__('Event timezones on all blogs have been reset to %s.','events-manager'), '<code>'.$timezone.'</code>'), true);
|
325 |
+
}else{
|
326 |
+
$EM_Notices->add_confirm(sprintf(__('Event timezones for blog %s have been reset to %s.','events-manager'), '<code>'.$blog_name.'</code>', '<code>'.$timezone.'</code>'), true);
|
327 |
+
}
|
328 |
+
}else{
|
329 |
+
$EM_Notices->add_confirm(sprintf(__('Event timezones have been reset to %s.','events-manager'), '<code>'.$timezone.'</code>'), true);
|
330 |
+
}
|
331 |
+
}
|
332 |
+
wp_safe_redirect(em_wp_get_referer());
|
333 |
+
exit();
|
334 |
+
}
|
335 |
+
|
336 |
+
//update scripts that may need to run
|
337 |
+
$blog_updates = is_multisite() ? array_merge(EM_Options::get('updates'), EM_Options::site_get('updates')) : EM_Options::get('updates');
|
338 |
+
if( is_array($blog_updates) ) {
|
339 |
+
foreach ( $blog_updates as $update => $update_data ) {
|
340 |
+
$filename = EM_DIR . '/admin/settings/updates/' . $update . '.php';
|
341 |
+
if ( file_exists( $filename ) ) {
|
342 |
+
include_once( $filename );
|
343 |
+
}
|
344 |
+
do_action( 'em_admin_update_' . $update, $update_data );
|
345 |
+
}
|
346 |
+
}
|
347 |
+
}
|
348 |
+
add_action('admin_init', 'em_options_save');
|
349 |
+
|
350 |
+
function em_admin_email_test_ajax(){
|
351 |
+
if( wp_verify_nonce($_REQUEST['_check_email_nonce'],'check_email') && current_user_can('activate_plugins') ){
|
352 |
+
$subject = __("Events Manager Test Email",'events-manager');
|
353 |
+
$content = __('Congratulations! Your email settings work.','events-manager');
|
354 |
+
$current_user = get_user_by('id', get_current_user_id());
|
355 |
+
//add filters for options used in EM_Mailer so the current supplied ones are used
|
356 |
+
ob_start();
|
357 |
+
function pre_option_dbem_mail_sender_name(){ return sanitize_text_field($_REQUEST['dbem_mail_sender_name']); }
|
358 |
+
add_filter('pre_option_dbem_mail_sender_name', 'pre_option_dbem_mail_sender_name');
|
359 |
+
function pre_option_dbem_mail_sender_address(){ return sanitize_text_field($_REQUEST['dbem_mail_sender_address']); }
|
360 |
+
add_filter('pre_option_dbem_mail_sender_address', 'pre_option_dbem_mail_sender_address');
|
361 |
+
function pre_option_dbem_rsvp_mail_send_method(){ return sanitize_text_field($_REQUEST['dbem_rsvp_mail_send_method']); }
|
362 |
+
add_filter('pre_option_dbem_rsvp_mail_send_method', 'pre_option_dbem_rsvp_mail_send_method');
|
363 |
+
function pre_option_dbem_rsvp_mail_port(){ return sanitize_text_field($_REQUEST['dbem_rsvp_mail_port']); }
|
364 |
+
add_filter('pre_option_dbem_rsvp_mail_port', 'pre_option_dbem_rsvp_mail_port');
|
365 |
+
function pre_option_dbem_smtp_encryption(){ return sanitize_text_field($_REQUEST['dbem_smtp_encryption']); }
|
366 |
+
add_filter('pre_option_dbem_smtp_encryption', 'pre_option_dbem_smtp_encryption');
|
367 |
+
function pre_option_dbem_smtp_autotls(){ return sanitize_text_field($_REQUEST['dbem_smtp_autotls']); }
|
368 |
+
add_filter('pre_option_dbem_smtp_autotls', 'pre_option_dbem_smtp_autotls');
|
369 |
+
function pre_option_dbem_rsvp_mail_SMTPAuth(){ return sanitize_text_field($_REQUEST['dbem_rsvp_mail_SMTPAuth']); }
|
370 |
+
add_filter('pre_option_dbem_rsvp_mail_SMTPAuth', 'pre_option_dbem_rsvp_mail_SMTPAuth');
|
371 |
+
function pre_option_dbem_smtp_host(){ return sanitize_text_field($_REQUEST['dbem_smtp_host']); }
|
372 |
+
add_filter('pre_option_dbem_smtp_host', 'pre_option_dbem_smtp_host');
|
373 |
+
function pre_option_dbem_smtp_username(){ return sanitize_text_field($_REQUEST['dbem_smtp_username']); }
|
374 |
+
add_filter('pre_option_dbem_smtp_username', 'pre_option_dbem_smtp_username');
|
375 |
+
function pre_option_dbem_smtp_password(){ return sanitize_text_field($_REQUEST['dbem_smtp_password']); }
|
376 |
+
add_filter('pre_option_dbem_smtp_password', 'pre_option_dbem_smtp_password');
|
377 |
+
ob_clean(); //remove any php errors/warnings output
|
378 |
+
$EM_Event = new EM_Event();
|
379 |
+
if( $EM_Event->email_send($subject,$content,$current_user->user_email) ){
|
380 |
+
$result = array(
|
381 |
+
'result' => true,
|
382 |
+
'message' => sprintf(__('Email sent successfully to %s','events-manager'),$current_user->user_email)
|
383 |
+
);
|
384 |
+
}else{
|
385 |
+
$result = array(
|
386 |
+
'result' => false,
|
387 |
+
'message' => __('Email not sent.','events-manager')." <ul><li>".implode('</li><li>',$EM_Event->get_errors()).'</li></ul>'
|
388 |
+
);
|
389 |
+
}
|
390 |
+
echo EM_Object::json_encode($result);
|
391 |
+
}
|
392 |
+
exit();
|
393 |
+
}
|
394 |
+
add_action('wp_ajax_em_admin_test_email','em_admin_email_test_ajax');
|
395 |
+
|
396 |
+
function em_admin_option_default_ajax() {
|
397 |
+
if( current_user_can('activate_plugins') && wp_verify_nonce($_REQUEST['nonce'], 'option-default-'.$_REQUEST['option_name']) && preg_match('/^[a-zA-Z_0-9]+$/', $_REQUEST['option_name']) ) {
|
398 |
+
$return = call_user_func("EM_Formats::".$_REQUEST['option_name'], '');
|
399 |
+
echo $return;
|
400 |
+
}
|
401 |
+
exit();
|
402 |
+
}
|
403 |
+
add_action('wp_ajax_em_admin_get_option_default','em_admin_option_default_ajax');
|
404 |
+
|
405 |
+
function em_admin_options_reset_page(){
|
406 |
+
if( check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
|
407 |
+
?>
|
408 |
+
<div class="wrap">
|
409 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
410 |
+
<h2><?php _e('Reset Events Manager','events-manager'); ?></h2>
|
411 |
+
<p style="color:red; font-weight:bold;"><?php _e('Are you sure you want to reset Events Manager?','events-manager')?></p>
|
412 |
+
<p style="font-weight:bold;"><?php _e('All your settings, including email templates and template formats for Events Manager will be deleted.','events-manager')?></p>
|
413 |
+
<p>
|
414 |
+
<a href="<?php echo esc_url(add_query_arg(array('_wpnonce2' => wp_create_nonce('em_reset_'.get_current_user_id().'_confirmed'), 'confirmed'=>1))); ?>" class="button-primary"><?php _e('Reset Events Manager','events-manager'); ?></a>
|
415 |
+
<a href="<?php echo esc_url(em_wp_get_referer()); ?>" class="button-secondary"><?php _e('Cancel','events-manager'); ?></a>
|
416 |
+
</p>
|
417 |
+
</div>
|
418 |
+
<?php
|
419 |
+
}
|
420 |
+
}
|
421 |
+
function em_admin_options_uninstall_page(){
|
422 |
+
if( check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && em_wp_is_super_admin() ){
|
423 |
+
?>
|
424 |
+
<div class="wrap">
|
425 |
+
<div id='icon-options-general' class='icon32'><br /></div>
|
426 |
+
<h2><?php _e('Uninstall Events Manager','events-manager'); ?></h2>
|
427 |
+
<p style="color:red; font-weight:bold;"><?php _e('Are you sure you want to uninstall Events Manager?','events-manager')?></p>
|
428 |
+
<p style="font-weight:bold;"><?php _e('All your settings and events will be permanently deleted. This cannot be undone.','events-manager')?></p>
|
429 |
+
<p><?php echo sprintf(__('If you just want to deactivate the plugin, <a href="%s">go to your plugins page</a>.','events-manager'), wp_nonce_url(admin_url('plugins.php'))); ?></p>
|
430 |
+
<p>
|
431 |
+
<a href="<?php echo esc_url(add_query_arg(array('_wpnonce2' => wp_create_nonce('em_uninstall_'.get_current_user_id().'_confirmed'), 'confirmed'=>1))); ?>" class="button-primary"><?php _e('Uninstall and Deactivate','events-manager'); ?></a>
|
432 |
+
<a href="<?php echo esc_url(em_wp_get_referer()); ?>" class="button-secondary"><?php _e('Cancel','events-manager'); ?></a>
|
433 |
+
</p>
|
434 |
+
</div>
|
435 |
+
<?php
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
function em_admin_options_page() {
|
440 |
+
global $wpdb, $EM_Notices;
|
441 |
+
//Check for uninstall/reset request
|
442 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' ){
|
443 |
+
em_admin_options_uninstall_page();
|
444 |
+
return;
|
445 |
+
}
|
446 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ){
|
447 |
+
em_admin_options_reset_page();
|
448 |
+
return;
|
449 |
+
}
|
450 |
+
if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'update' && !empty($_REQUEST['update_action']) ){
|
451 |
+
do_action('em_admin_update_settings_confirm_'.$_REQUEST['update_action']);
|
452 |
+
return;
|
453 |
+
}
|
454 |
+
//substitute dropdowns with input boxes for some situations to improve speed, e.g. if there 1000s of locations or users
|
455 |
+
$total_users = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users};");
|
456 |
+
if( $total_users > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') ){ define('EM_OPTIMIZE_SETTINGS_PAGE_USERS',true); }
|
457 |
+
$total_locations = EM_Locations::count();
|
458 |
+
if( $total_locations > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') ){ define('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS',true); }
|
459 |
+
//TODO place all options into an array
|
460 |
+
global $events_placeholder_tip, $locations_placeholder_tip, $categories_placeholder_tip, $bookings_placeholder_tip;
|
461 |
+
$events_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#event-placeholders">'. __('Event Related Placeholders','events-manager') .'</a>';
|
462 |
+
$locations_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#location-placeholders">'. __('Location Related Placeholders','events-manager') .'</a>';
|
463 |
+
$bookings_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#booking-placeholders">'. __('Booking Related Placeholders','events-manager') .'</a>';
|
464 |
+
$categories_placeholders = '<a href="'.EM_ADMIN_URL .'&page=events-manager-help#category-placeholders">'. __('Category Related Placeholders','events-manager') .'</a>';
|
465 |
+
$events_placeholder_tip = " ". sprintf(__('This accepts %s and %s placeholders.','events-manager'),$events_placeholders, $locations_placeholders);
|
466 |
+
$locations_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','events-manager'), $locations_placeholders);
|
467 |
+
$categories_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','events-manager'), $categories_placeholders);
|
468 |
+
$bookings_placeholder_tip = " ". sprintf(__('This accepts %s, %s and %s placeholders.','events-manager'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
|
469 |
+
|
470 |
+
global $save_button;
|
471 |
+
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" class="button-primary" name="Submit" value="'. __( 'Save Changes', 'events-manager') .' ('. __('All','events-manager') .')" /></p></td></tr>';
|
472 |
+
|
473 |
+
do_action('em_options_page_header');
|
474 |
+
|
475 |
+
if( defined('EM_SETTINGS_TABS') && EM_SETTINGS_TABS ){
|
476 |
+
$tabs_enabled = true;
|
477 |
+
$general_tab_link = esc_url(add_query_arg( array('em_tab'=>'general')));
|
478 |
+
$pages_tab_link = esc_url(add_query_arg( array('em_tab'=>'pages')));
|
479 |
+
$formats_tab_link = esc_url(add_query_arg( array('em_tab'=>'formats')));
|
480 |
+
$bookings_tab_link = esc_url(add_query_arg( array('em_tab'=>'bookings')));
|
481 |
+
$emails_tab_link = esc_url(add_query_arg( array('em_tab'=>'emails')));
|
482 |
+
}else{
|
483 |
+
$general_tab_link = $pages_tab_link = $formats_tab_link = $bookings_tab_link = $emails_tab_link = '';
|
484 |
+
}
|
485 |
+
?>
|
486 |
+
<script type="text/javascript" charset="utf-8"><?php include(EM_DIR.'/includes/js/admin-settings.js'); ?></script>
|
487 |
+
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
|
488 |
+
<div class="wrap <?php if(empty($tabs_enabled)) echo 'tabs-active' ?>">
|
489 |
+
<h1 id="em-options-title"><?php _e ( 'Event Manager Options', 'events-manager'); ?></h1>
|
490 |
+
<h2 class="nav-tab-wrapper">
|
491 |
+
<a href="<?php echo $general_tab_link; ?>#general" id="em-menu-general" class="nav-tab nav-tab-active"><?php _e('General','events-manager'); ?></a>
|
492 |
+
<a href="<?php echo $pages_tab_link; ?>#pages" id="em-menu-pages" class="nav-tab"><?php _e('Pages','events-manager'); ?></a>
|
493 |
+
<a href="<?php echo $formats_tab_link; ?>#formats" id="em-menu-formats" class="nav-tab"><?php _e('Formatting','events-manager'); ?></a>
|
494 |
+
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
495 |
+
<a href="<?php echo $bookings_tab_link; ?>#bookings" id="em-menu-bookings" class="nav-tab"><?php _e('Bookings','events-manager'); ?></a>
|
496 |
+
<?php endif; ?>
|
497 |
+
<a href="<?php echo $emails_tab_link; ?>#emails" id="em-menu-emails" class="nav-tab"><?php _e('Emails','events-manager'); ?></a>
|
498 |
+
<?php
|
499 |
+
$custom_tabs = apply_filters('em_options_page_tabs', array());
|
500 |
+
foreach( $custom_tabs as $tab_key => $tab_name ){
|
501 |
+
$tab_link = !empty($tabs_enabled) ? esc_url(add_query_arg( array('em_tab'=>$tab_key))) : '';
|
502 |
+
$active_class = !empty($tabs_enabled) && !empty($_GET['em_tab']) && $_GET['em_tab'] == $tab_key ? 'nav-tab-active':'';
|
503 |
+
echo "<a href='$tab_link#$tab_key' id='em-menu-$tab_key' class='nav-tab $active_class'>$tab_name</a>";
|
504 |
+
}
|
505 |
+
?>
|
506 |
+
</h2>
|
507 |
+
<form id="em-options-form" method="post" action="">
|
508 |
+
<div class="metabox-holder">
|
509 |
+
<!-- // TODO Move style in css -->
|
510 |
+
<div class='postbox-container' style='width: 99.5%'>
|
511 |
+
<div id="">
|
512 |
+
|
513 |
+
<?php
|
514 |
+
if( !empty($tabs_enabled) ){
|
515 |
+
if( empty($_REQUEST['em_tab']) || $_REQUEST['em_tab'] == 'general' ){
|
516 |
+
include('settings/tabs/general.php');
|
517 |
+
}else{
|
518 |
+
if( $_REQUEST['em_tab'] == 'pages' ) include('settings/tabs/pages.php');
|
519 |
+
if( $_REQUEST['em_tab'] == 'formats' ) include('settings/tabs/formats.php');
|
520 |
+
if( get_option('dbem_rsvp_enabled') && $_REQUEST['em_tab'] == 'bookings' ){
|
521 |
+
include('settings/tabs/bookings.php');
|
522 |
+
}
|
523 |
+
if( $_REQUEST['em_tab'] == 'emails' ) include('settings/tabs/emails.php');
|
524 |
+
if( array_key_exists($_REQUEST['em_tab'], $custom_tabs) ){
|
525 |
+
?>
|
526 |
+
<div class="em-menu-<?php echo esc_attr($_REQUEST['em_tab']) ?> em-menu-group">
|
527 |
+
<?php do_action('em_options_page_tab_'. $_REQUEST['em_tab']); ?>
|
528 |
+
</div>
|
529 |
+
<?php
|
530 |
+
}
|
531 |
+
}
|
532 |
+
}else{
|
533 |
+
include('settings/tabs/general.php');
|
534 |
+
include('settings/tabs/pages.php');
|
535 |
+
include('settings/tabs/formats.php');
|
536 |
+
if( get_option('dbem_rsvp_enabled') ){
|
537 |
+
include('settings/tabs/bookings.php');
|
538 |
+
}
|
539 |
+
include('settings/tabs/emails.php');
|
540 |
+
foreach( $custom_tabs as $tab_key => $tab_name ){
|
541 |
+
?>
|
542 |
+
<div class="em-menu-<?php echo esc_attr($tab_key) ?> em-menu-group" style="display:none;">
|
543 |
+
<?php do_action('em_options_page_tab_'. $tab_key); ?>
|
544 |
+
</div>
|
545 |
+
<?php
|
546 |
+
}
|
547 |
+
}
|
548 |
+
?>
|
549 |
+
|
550 |
+
<?php /*
|
551 |
+
<div class="postbox " >
|
552 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Debug Modes', 'events-manager'); ?> </span></h3>
|
553 |
+
<div class="inside">
|
554 |
+
<table class='form-table'>
|
555 |
+
<?php
|
556 |
+
em_options_radio_binary ( __( 'EM Debug Mode?', 'events-manager'), 'dbem_debug', __( 'Setting this to yes will display different content to admins for event pages and emails so you can see all the available placeholders and their values.', 'events-manager') );
|
557 |
+
em_options_radio_binary ( __( 'WP Debug Mode?', 'events-manager'), 'dbem_wp_debug', __( 'This will turn WP_DEBUG mode on. Useful if you want to troubleshoot php errors without looking at your logs.', 'events-manager') );
|
558 |
+
?>
|
559 |
+
</table>
|
560 |
+
</div> <!-- . inside -->
|
561 |
+
</div> <!-- .postbox -->
|
562 |
+
*/ ?>
|
563 |
+
|
564 |
+
<p class="submit">
|
565 |
+
<input type="submit" class="button-primary" name="Submit" value="<?php esc_attr_e( 'Save Changes', 'events-manager'); ?>" />
|
566 |
+
<input type="hidden" name="em-submitted" value="1" />
|
567 |
+
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('events-manager-options'); ?>" />
|
568 |
+
</p>
|
569 |
+
|
570 |
+
</div> <!-- .metabox-sortables -->
|
571 |
+
</div> <!-- .postbox-container -->
|
572 |
+
|
573 |
+
</div> <!-- .metabox-holder -->
|
574 |
+
</form>
|
575 |
+
</div>
|
576 |
+
<?php
|
577 |
+
}
|
578 |
+
|
579 |
+
/**
|
580 |
+
* Meta options box for image sizes. Shared in both MS and Normal options page, hence it's own function
|
581 |
+
*/
|
582 |
+
function em_admin_option_box_image_sizes(){
|
583 |
+
global $save_button;
|
584 |
+
?>
|
585 |
+
<div class="postbox " id="em-opt-image-sizes" >
|
586 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Image Sizes', 'events-manager'); ?> </span></h3>
|
587 |
+
<div class="inside">
|
588 |
+
<p class="em-boxheader"><?php _e('These settings will only apply to the image uploading if using our front-end forms. In your WP admin area, images are handled by WordPress.','events-manager'); ?></p>
|
589 |
+
<table class='form-table'>
|
590 |
+
<?php
|
591 |
+
em_options_input_text ( __( 'Maximum width (px)', 'events-manager'), 'dbem_image_max_width', __( 'The maximum allowed width for images uploads', 'events-manager') );
|
592 |
+
em_options_input_text ( __( 'Minimum width (px)', 'events-manager'), 'dbem_image_min_width', __( 'The minimum allowed width for images uploads', 'events-manager') );
|
593 |
+
em_options_input_text ( __( 'Maximum height (px)', 'events-manager'), 'dbem_image_max_height', __( "The maximum allowed height for images uploaded, in pixels", 'events-manager') );
|
594 |
+
em_options_input_text ( __( 'Minimum height (px)', 'events-manager'), 'dbem_image_min_height', __( "The minimum allowed height for images uploaded, in pixels", 'events-manager') );
|
595 |
+
em_options_input_text ( __( 'Maximum size (bytes)', 'events-manager'), 'dbem_image_max_size', __( "The maximum allowed size for images uploaded, in bytes", 'events-manager') );
|
596 |
+
echo $save_button;
|
597 |
+
?>
|
598 |
+
</table>
|
599 |
+
</div> <!-- . inside -->
|
600 |
+
</div> <!-- .postbox -->
|
601 |
+
<?php
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Meta options box for email settings. Shared in both MS and Normal options page, hence it's own function
|
606 |
+
*/
|
607 |
+
function em_admin_option_box_email(){
|
608 |
+
global $save_button;
|
609 |
+
$current_user = get_user_by('id', get_current_user_id());
|
610 |
+
?>
|
611 |
+
<div class="postbox " id="em-opt-email-settings">
|
612 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Email Settings', 'events-manager'); ?></span></h3>
|
613 |
+
<div class="inside em-email-form">
|
614 |
+
<p class="em-email-settings-check em-boxheader">
|
615 |
+
<em><?php _e('Before you save your changes, you can quickly send yourself a test email by clicking this button.','events-manager'); ?>
|
616 |
+
<?php echo sprintf(__('A test email will be sent to your account email - %s','events-manager'), $current_user->user_email . ' <a href="'.admin_url( 'profile.php' ).'">'.__('edit','events-manager').'</a>'); ?></em><br />
|
617 |
+
<input type="button" id="em-admin-check-email" class="button-secondary" value="<?php esc_attr_e('Test Email Settings','events-manager'); ?>" />
|
618 |
+
<input type="hidden" name="_check_email_nonce" value="<?php echo wp_create_nonce('check_email'); ?>" />
|
619 |
+
<span id="em-email-settings-check-status"></span>
|
620 |
+
</p>
|
621 |
+
<table class="form-table">
|
622 |
+
<?php
|
623 |
+
em_options_input_text ( __( 'Notification sender name', 'events-manager'), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'events-manager') );
|
624 |
+
em_options_input_text ( __( 'Notification sender address', 'events-manager'), 'dbem_mail_sender_address', __( "Insert the address of the notification sender.", 'events-manager') );
|
625 |
+
em_options_select ( __( 'Mail sending method', 'events-manager'), 'dbem_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __( 'PHP mail function', 'events-manager'), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail', 'wp_mail' => 'WP Mail' ), __( 'Select the method to send email notification.', 'events-manager') );
|
626 |
+
em_options_radio_binary ( __( 'Send HTML Emails?', 'events-manager'), 'dbem_smtp_html', __( 'If set to yes, your emails will be sent in HTML format, otherwise plaintext.', 'events-manager').' '.__( 'Depending on server settings, some sending methods may ignore this settings.', 'events-manager') );
|
627 |
+
em_options_radio_binary ( __( 'Add br tags to HTML emails?', 'events-manager'), 'dbem_smtp_html_br', __( 'If HTML emails are enabled, br tags will automatically be added for new lines.', 'events-manager') );
|
628 |
+
?>
|
629 |
+
<tbody class="em-email-settings-smtp">
|
630 |
+
<?php
|
631 |
+
em_options_input_text ( 'Mail sending port', 'dbem_rsvp_mail_port', __( "The port through which you e-mail notifications will be sent. Make sure the firewall doesn't block this port", 'events-manager') );
|
632 |
+
em_options_radio_binary ( __( 'Use SMTP authentication?', 'events-manager'), 'dbem_rsvp_mail_SMTPAuth', __( 'SMTP authentication is often needed. If you use Gmail, make sure to set this parameter to Yes', 'events-manager') );
|
633 |
+
em_options_select ( __( 'SMTP Encryption', 'events-manager'), 'dbem_smtp_encryption', array ('0' => __( 'None', 'events-manager'), 'ssl' => 'SSL', 'tls' => 'TLS' ), __( 'Encryption is always recommended if your SMTP server supports it. If your server supports TLS, this is also the most recommended method.', 'events-manager') );
|
634 |
+
em_options_radio_binary ( __( 'AutoTLS', 'events-manager'), 'dbem_smtp_autotls', __( 'We recommend leaving this on unless you are experiencing issues configuring your email.', 'events-manager') );
|
635 |
+
em_options_input_text ( 'SMTP host', 'dbem_smtp_host', __( "The SMTP host. Usually it corresponds to 'localhost'. If you use Gmail, set this value to 'tls://smtp.gmail.com:587'.", 'events-manager') );
|
636 |
+
em_options_input_text ( __( 'SMTP username', 'events-manager'), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'events-manager') );
|
637 |
+
em_options_input_password ( __( 'SMTP password', 'events-manager'), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'events-manager') );
|
638 |
+
?>
|
639 |
+
</tbody>
|
640 |
+
<?php
|
641 |
+
echo $save_button;
|
642 |
+
?>
|
643 |
+
</table>
|
644 |
+
<script type="text/javascript" charset="utf-8">
|
645 |
+
jQuery(document).ready(function($){
|
646 |
+
$('#dbem_rsvp_mail_send_method_row select').on('change', function(){
|
647 |
+
el = $(this);
|
648 |
+
if( el.find(':selected').val() == 'smtp' ){
|
649 |
+
$('.em-email-settings-smtp').show();
|
650 |
+
}else{
|
651 |
+
$('.em-email-settings-smtp').hide();
|
652 |
+
}
|
653 |
+
}).trigger('change');
|
654 |
+
$('input#em-admin-check-email').on('click', function(e,el){
|
655 |
+
var email_data = $('.em-email-form input, .em-email-form select').serialize();
|
656 |
+
$.ajax({
|
657 |
+
url: EM.ajaxurl,
|
658 |
+
dataType: 'json',
|
659 |
+
data: email_data+"&action=em_admin_test_email",
|
660 |
+
success: function(data){
|
661 |
+
if(data.result && data.message){
|
662 |
+
$('#em-email-settings-check-status').css({'color':'green','display':'block'}).html(data.message);
|
663 |
+
}else{
|
664 |
+
var msg = (data.message) ? data.message:'Email not sent';
|
665 |
+
$('#em-email-settings-check-status').css({'color':'red','display':'block'}).html(msg);
|
666 |
+
}
|
667 |
+
},
|
668 |
+
error: function(){ $('#em-email-settings-check-status').css({'color':'red','display':'block'}).html('Server Error'); },
|
669 |
+
beforeSend: function(){ $('input#em-admin-check-email').val('<?php _e('Checking...','events-manager') ?>'); },
|
670 |
+
complete: function(){ $('input#em-admin-check-email').val('<?php _e('Test Email Settings','events-manager'); ?>'); }
|
671 |
+
});
|
672 |
+
});
|
673 |
+
});
|
674 |
+
</script>
|
675 |
+
</div> <!-- . inside -->
|
676 |
+
</div> <!-- .postbox -->
|
677 |
+
<?php
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Meta options box for user capabilities. Shared in both MS and Normal options page, hence it's own function
|
682 |
+
*/
|
683 |
+
function em_admin_option_box_caps(){
|
684 |
+
global $save_button, $wpdb;
|
685 |
+
?>
|
686 |
+
<div class="postbox" id="em-opt-user-caps" >
|
687 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'User Capabilities', 'events-manager'); ?></span></h3>
|
688 |
+
<div class="inside">
|
689 |
+
<table class="form-table">
|
690 |
+
<tr><td colspan="2" class="em-boxheader">
|
691 |
+
<p><strong><?php _e('Warning: Changing these values may result in exposing previously hidden information to all users.', 'events-manager')?></strong></p>
|
692 |
+
<p><em><?php _e('You can now give fine grained control with regards to what your users can do with events. Each user role can have perform different sets of actions.','events-manager'); ?></em></p>
|
693 |
+
</td></tr>
|
694 |
+
<?php
|
695 |
+
global $wp_roles;
|
696 |
+
$cap_docs = array(
|
697 |
+
sprintf(__('%s Capabilities','events-manager'),__('Event','events-manager')) => array(
|
698 |
+
/* Event Capabilities */
|
699 |
+
'publish_events' => sprintf(__('Users can publish %s and skip any admin approval','events-manager'),__('events','events-manager')),
|
700 |
+
'delete_others_events' => sprintf(__('User can delete other users %s','events-manager'),__('events','events-manager')),
|
701 |
+
'edit_others_events' => sprintf(__('User can edit other users %s','events-manager'),__('events','events-manager')),
|
702 |
+
'delete_events' => sprintf(__('User can delete their own %s','events-manager'),__('events','events-manager')),
|
703 |
+
'edit_events' => sprintf(__('User can create and edit %s','events-manager'),__('events','events-manager')),
|
704 |
+
'read_private_events' => sprintf(__('User can view private %s','events-manager'),__('events','events-manager')),
|
705 |
+
/*'read_events' => sprintf(__('User can view %s','events-manager'),__('events','events-manager')),*/
|
706 |
+
),
|
707 |
+
sprintf(__('%s Capabilities','events-manager'),__('Recurring Event','events-manager')) => array(
|
708 |
+
/* Recurring Event Capabilties */
|
709 |
+
'publish_recurring_events' => sprintf(__('Users can publish %s and skip any admin approval','events-manager'),__('recurring events','events-manager')),
|
710 |
+
'delete_others_recurring_events' => sprintf(__('User can delete other users %s','events-manager'),__('recurring events','events-manager')),
|
711 |
+
'edit_others_recurring_events' => sprintf(__('User can edit other users %s','events-manager'),__('recurring events','events-manager')),
|
712 |
+
'delete_recurring_events' => sprintf(__('User can delete their own %s','events-manager'),__('recurring events','events-manager')),
|
713 |
+
'edit_recurring_events' => sprintf(__('User can create and edit %s','events-manager'),__('recurring events','events-manager'))
|
714 |
+
),
|
715 |
+
sprintf(__('%s Capabilities','events-manager'),__('Location','events-manager')) => array(
|
716 |
+
/* Location Capabilities */
|
717 |
+
'publish_locations' => sprintf(__('Users can publish %s and skip any admin approval','events-manager'),__('locations','events-manager')),
|
718 |
+
'delete_others_locations' => sprintf(__('User can delete other users %s','events-manager'),__('locations','events-manager')),
|
719 |
+
'edit_others_locations' => sprintf(__('User can edit other users %s','events-manager'),__('locations','events-manager')),
|
720 |
+
'delete_locations' => sprintf(__('User can delete their own %s','events-manager'),__('locations','events-manager')),
|
721 |
+
'edit_locations' => sprintf(__('User can create and edit %s','events-manager'),__('locations','events-manager')),
|
722 |
+
'read_private_locations' => sprintf(__('User can view private %s','events-manager'),__('locations','events-manager')),
|
723 |
+
'read_others_locations' => __('User can use other user locations for their events.','events-manager'),
|
724 |
+
/*'read_locations' => sprintf(__('User can view %s','events-manager'),__('locations','events-manager')),*/
|
725 |
+
),
|
726 |
+
sprintf(__('%s Capabilities','events-manager'),__('Other','events-manager')) => array(
|
727 |
+
/* Category Capabilities */
|
728 |
+
'delete_event_categories' => sprintf(__('User can delete %s categories and tags.','events-manager'),__('event','events-manager')),
|
729 |
+
'edit_event_categories' => sprintf(__('User can edit %s categories and tags.','events-manager'),__('event','events-manager')),
|
730 |
+
/* Booking Capabilities */
|
731 |
+
'manage_others_bookings' => __('User can manage other users individual bookings and event booking settings.','events-manager'),
|
732 |
+
'manage_bookings' => __('User can use and manage bookings with their events.','events-manager'),
|
733 |
+
'upload_event_images' => __('User can upload images along with their events and locations.','events-manager')
|
734 |
+
)
|
735 |
+
);
|
736 |
+
?>
|
737 |
+
<?php
|
738 |
+
if( is_multisite() && is_network_admin() ){
|
739 |
+
echo em_options_radio_binary(__('Apply global capabilities?','events-manager'), 'dbem_ms_global_caps', __('If set to yes the capabilities will be applied all your network blogs and you will not be able to set custom capabilities each blog. You can select no later and visit specific blog settings pages to add/remove capabilities.','events-manager') );
|
740 |
+
}
|
741 |
+
?>
|
742 |
+
<tr><td colspan="2">
|
743 |
+
<table class="em-caps-table" style="width:auto;" cellspacing="0" cellpadding="0">
|
744 |
+
<thead>
|
745 |
+
<tr>
|
746 |
+
<td> </td>
|
747 |
+
<?php
|
748 |
+
$odd = 0;
|
749 |
+
foreach(array_keys($cap_docs) as $capability_group){
|
750 |
+
?><th class="<?php echo ( !is_int($odd/2) ) ? 'odd':''; ?>"><?php echo $capability_group ?></th><?php
|
751 |
+
$odd++;
|
752 |
+
}
|
753 |
+
?>
|
754 |
+
</tr>
|
755 |
+
</thead>
|
756 |
+
<tbody>
|
757 |
+
<?php foreach($wp_roles->role_objects as $role): ?>
|
758 |
+
<tr>
|
759 |
+
<td class="cap"><strong><?php echo $role->name; ?></strong></td>
|
760 |
+
<?php
|
761 |
+
$odd = 0;
|
762 |
+
foreach($cap_docs as $capability_group){
|
763 |
+
?>
|
764 |
+
<td class="<?php echo ( !is_int($odd/2) ) ? 'odd':''; ?>">
|
765 |
+
<?php foreach($capability_group as $cap => $cap_help){ ?>
|
766 |
+
<input type="checkbox" name="em_capabilities[<?php echo $role->name; ?>][<?php echo $cap ?>]" value="1" id="<?php echo $role->name.'_'.$cap; ?>" <?php echo $role->has_cap($cap) ? 'checked="checked"':''; ?> />
|
767 |
+
<label for="<?php echo $role->name.'_'.$cap; ?>"><?php echo $cap; ?></label> <a href="#" title="<?php echo $cap_help; ?>">?</a>
|
768 |
+
<br />
|
769 |
+
<?php } ?>
|
770 |
+
</td>
|
771 |
+
<?php
|
772 |
+
$odd++;
|
773 |
+
}
|
774 |
+
?>
|
775 |
+
</tr>
|
776 |
+
<?php endforeach; ?>
|
777 |
+
</tbody>
|
778 |
+
</table>
|
779 |
+
</td></tr>
|
780 |
+
<?php echo $save_button; ?>
|
781 |
+
</table>
|
782 |
+
</div> <!-- . inside -->
|
783 |
+
</div> <!-- .postbox -->
|
784 |
+
<?php
|
785 |
+
}
|
786 |
+
|
787 |
+
function em_admin_option_box_uninstall(){
|
788 |
+
global $save_button;
|
789 |
+
if( is_multisite() ){
|
790 |
+
$uninstall_url = admin_url().'network/admin.php?page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
791 |
+
$reset_url = admin_url().'network/admin.php?page=events-manager-options&action=reset&_wpnonce='.wp_create_nonce('em_reset_'.get_current_user_id().'_wpnonce');
|
792 |
+
$recheck_updates_url = admin_url().'network/admin.php?page=events-manager-options&action=recheck_updates&_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce');
|
793 |
+
$cleanup_event_orphans_url = admin_url().'network/admin.php?page=events-manager-options&action=cleanup_event_orphans&_wpnonce='.wp_create_nonce('em_cleanup_event_orphans_'.get_current_user_id().'_wpnonce');
|
794 |
+
$check_devs = admin_url().'network/admin.php?page=events-manager-options&action=check_devs&_wpnonce='.wp_create_nonce('em_check_devs_wpnonce');
|
795 |
+
$export_settings_url = admin_url().'network/admin.php?page=events-manager-options&action=export_em_ms_settings&_wpnonce='.wp_create_nonce('export_em_ms_settings');
|
796 |
+
$import_nonce = wp_create_nonce('import_em_ms_settings');
|
797 |
+
}else{
|
798 |
+
$uninstall_url = EM_ADMIN_URL.'&page=events-manager-options&action=uninstall&_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
|
799 |
+
$reset_url = EM_ADMIN_URL.'&page=events-manager-options&action=reset&_wpnonce='.wp_create_nonce('em_reset_'.get_current_user_id().'_wpnonce');
|
800 |
+
$recheck_updates_url = EM_ADMIN_URL.'&page=events-manager-options&action=recheck_updates&_wpnonce='.wp_create_nonce('em_recheck_updates_'.get_current_user_id().'_wpnonce');
|
801 |
+
$cleanup_event_orphans_url= EM_ADMIN_URL.'&page=events-manager-options&action=cleanup_event_orphans&_wpnonce='.wp_create_nonce('em_cleanup_event_orphans_'.get_current_user_id().'_wpnonce');
|
802 |
+
$check_devs = EM_ADMIN_URL.'&page=events-manager-options&action=check_devs&_wpnonce='.wp_create_nonce('em_check_devs_wpnonce');
|
803 |
+
$export_settings_url = EM_ADMIN_URL.'&page=events-manager-options&action=export_em_settings&_wpnonce='.wp_create_nonce('export_em_settings');
|
804 |
+
$import_nonce = wp_create_nonce('import_em_settings');
|
805 |
+
}
|
806 |
+
$reset_timezone_nonce = wp_create_nonce('reset_timezones');
|
807 |
+
$options_data = get_option('dbem_data');
|
808 |
+
?>
|
809 |
+
<div class="postbox" id="em-opt-admin-tools" >
|
810 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Admin Tools', 'events-manager'); ?> (<?php _e ( 'Advanced', 'events-manager'); ?>)</span></h3>
|
811 |
+
<div class="inside">
|
812 |
+
|
813 |
+
<?php
|
814 |
+
//update scripts that may need to run
|
815 |
+
$blog_updates = is_multisite() ? array_merge(EM_Options::get('updates'), EM_Options::site_get('updates')) : EM_Options::get('updates');
|
816 |
+
foreach( $blog_updates as $update => $update_data ){
|
817 |
+
do_action('em_admin_update_settings_'.$update, $update_data);
|
818 |
+
}
|
819 |
+
?>
|
820 |
+
|
821 |
+
<table class="form-table">
|
822 |
+
<tr class="em-header"><td colspan="2">
|
823 |
+
<h4><?php _e ( 'Development Versions & Updates', 'events-manager'); ?></h4>
|
824 |
+
<p><?php _e('We\'re always making improvements, adding features and fixing bugs between releases. We incrementally make these changes in between updates and make it available as a development version. You can download these manually, but we\'ve made it easy for you. <strong>Warning:</strong> Development versions are not always fully tested before release, use wisely!','events-manager'); ?></p>
|
825 |
+
</td></tr>
|
826 |
+
<?php em_options_radio_binary ( __( 'Enable Dev Updates?', 'events-manager'), 'dbem_pro_dev_updates', __('If enabled, the latest dev version will always be checked instead of the latest stable version of the plugin.', 'events-manager') ); ?>
|
827 |
+
<tr>
|
828 |
+
<th style="text-align:right;"><a href="<?php echo $recheck_updates_url; ?>" class="button-secondary"><?php _e('Re-Check Updates','events-manager'); ?></a></th>
|
829 |
+
<td><?php _e('If you would like to check and see if there is a new stable update.','events-manager'); ?></td>
|
830 |
+
</tr>
|
831 |
+
<tr>
|
832 |
+
<th style="text-align:right;"><a href="<?php echo $check_devs; ?>" class="button-secondary"><?php _e('Check Dev Versions','events-manager'); ?></a></th>
|
833 |
+
<td><?php _e('If you would like to download a dev version, but just as a one-off, you can force a dev version check by clicking the button below. If there is one available, it should appear in your plugin updates page as a regular update.','events-manager'); ?></td>
|
834 |
+
</tr>
|
835 |
+
</table>
|
836 |
+
|
837 |
+
<table class="form-table">
|
838 |
+
<tr class="em-header"><td colspan="2">
|
839 |
+
<h4><?php esc_html_e( 'Import/Export Settings', 'events-manager'); ?></h4>
|
840 |
+
<?php if( is_multisite() && is_network_admin() ): ?>
|
841 |
+
<p><?php esc_html_e("Within the network admin area, only network-specific settings will be exported or imported. For individual site settings please visit the relevant site within your network.", 'events-manager'); ?></p>
|
842 |
+
<?php endif; ?>
|
843 |
+
</td></tr>
|
844 |
+
<tr>
|
845 |
+
<th style="text-align:right;">
|
846 |
+
<a href="#" class="button-secondary" id="em-admin-import-settings"><?php esc_html_e('Import Settings','events-manager'); ?></a>
|
847 |
+
</th>
|
848 |
+
<td>
|
849 |
+
<input type="file" name="import_settings_file" id="em-admin-import-settings-file" />
|
850 |
+
<p><em><?php echo esc_html(sprintf(__('Choose a settings file saved from a backup or another Events Manager installation and click the \'%s\' button.','events-manager'), __('Import Settings','events-manager'))); ?></em></p>
|
851 |
+
</td>
|
852 |
+
<script type="text/javascript" charset="utf-8">
|
853 |
+
jQuery(document).ready(function($){
|
854 |
+
$('a#em-admin-import-settings').on('click', function(e,el){
|
855 |
+
var thisform = $(this).closest('form');
|
856 |
+
thisform.find('input[type=text], textarea, select, input[type=radio], input[type=hidden]').prop('disabled', true);
|
857 |
+
thisform.find('input[name=_wpnonce]').val('<?php echo esc_attr($import_nonce); ?>').prop('disabled', false);
|
858 |
+
thisform.append($('<input type="hidden" name="action" value="<?php echo is_multisite() ? 'import_em_ms_settings':'import_em_settings'; ?>" />'));
|
859 |
+
thisform.attr('enctype', 'multipart/form-data').submit();
|
860 |
+
});
|
861 |
+
});
|
862 |
+
</script>
|
863 |
+
</tr>
|
864 |
+
<tr>
|
865 |
+
<th style="text-align:right;">
|
866 |
+
<a href="<?php echo $export_settings_url; ?>" class="button-secondary"><?php esc_html_e('Export Settings','events-manager'); ?></a>
|
867 |
+
</th>
|
868 |
+
<td><p><?php esc_html_e('Export your Events Manager settings and restore them here or on another website running this plugin.','events-manager'); ?></p></td>
|
869 |
+
</tr>
|
870 |
+
</table>
|
871 |
+
|
872 |
+
|
873 |
+
<table class="form-table">
|
874 |
+
<tr class="em-header"><td colspan="2">
|
875 |
+
<h4><?php esc_html_e( 'Database Cleanup', 'events-manager'); ?></h4>
|
876 |
+
</td></tr>
|
877 |
+
<tr>
|
878 |
+
<th style="text-align:right;"><a href="<?php echo $cleanup_event_orphans_url; ?>" class="button-secondary admin-tools-db-cleanup"><?php _e('Remove Orphaned Events','events-manager'); ?></a></th>
|
879 |
+
<td>
|
880 |
+
<?php
|
881 |
+
global $wpdb;
|
882 |
+
$sql = 'SELECT count(*) FROM '.EM_EVENTS_TABLE.' WHERE post_id NOT IN (SELECT ID FROM ' .$wpdb->posts. ' WHERE post_type="'. EM_POST_TYPE_EVENT .'" OR post_type="event-recurring")';
|
883 |
+
if( EM_MS_GLOBAL ){
|
884 |
+
if( is_main_site() ){
|
885 |
+
$sql .= $wpdb->prepare(' AND (blog_id=%d or blog_id IS NULL)', get_current_blog_id());
|
886 |
+
}else{
|
887 |
+
$sql .= $wpdb->prepare(' AND blog_id=%d', get_current_blog_id());
|
888 |
+
}
|
889 |
+
}
|
890 |
+
$results = $wpdb->get_var($sql);
|
891 |
+
echo sprintf(esc_html__('Orphaned events may show on your event lists but not point to real event pages, and can be deleted. %d potentially orphaned events have been found.', 'events-manager'), $results);
|
892 |
+
?>
|
893 |
+
</td>
|
894 |
+
</tr>
|
895 |
+
</table>
|
896 |
+
<script type="text/javascript">
|
897 |
+
if( typeof EM == 'object' ){ EM.admin_db_cleanup_warning = '<?php echo esc_js(__('Are you sure you want to proceed? We recommend you back up your database first, just in case!', 'events-manager')); ?>'; }
|
898 |
+
</script>
|
899 |
+
|
900 |
+
<table class="form-table">
|
901 |
+
<tr class="em-header"><td colspan="2">
|
902 |
+
<h4><?php _e ( 'Reset Timezones', 'events-manager'); ?></h4>
|
903 |
+
<?php if( is_multisite() && get_site_option('dbem_reset_timezone_multisite_progress', false) !== false ): ?>
|
904 |
+
<p style="color:red;">
|
905 |
+
<?php
|
906 |
+
echo sprintf( esc_html__('Your last attempt to reset all blogs to a certain timezone did not complete successfully. You can attempt to reset only those blogs that weren\'t completed by selecting your desired timezone again and then %s from the dropdowns below', 'events-manager'), '<code>'.esc_html__('Resume Previous Attempt (All Blogs)', 'events-manager').'</code>' );
|
907 |
+
?>
|
908 |
+
</p>
|
909 |
+
<?php endif; ?>
|
910 |
+
</td></tr>
|
911 |
+
<tr>
|
912 |
+
<th style="text-align:right;">
|
913 |
+
<a href="#" class="button-secondary" id="em-reset-event-timezones"><?php esc_html_e('Reset Event Timezones','events-manager'); ?></a>
|
914 |
+
</th>
|
915 |
+
<td>
|
916 |
+
<select name="timezone_reset_value" class="em-reset-event-timezones">
|
917 |
+
<?php
|
918 |
+
if( is_multisite() ){
|
919 |
+
$timezone_default = 'none';
|
920 |
+
echo '<option value="default">'.__('Blog Default Timezone', 'events-manager').'</option>';
|
921 |
+
}else{
|
922 |
+
$timezone_default = str_replace(' ', '', EM_DateTimeZone::create()->getName());
|
923 |
+
}
|
924 |
+
?>
|
925 |
+
<?php echo wp_timezone_choice($timezone_default); ?>
|
926 |
+
</select>
|
927 |
+
<?php if( is_multisite() ): ?>
|
928 |
+
<select name="timezone_reset_blog" class="em-reset-event-timezones">
|
929 |
+
<option value="0"><?php esc_html_e('Select a blog...', 'events-manager'); ?></option>
|
930 |
+
<option value="all"><?php esc_html_e('All Blogs', 'events-manager'); ?></option>
|
931 |
+
<?php if( is_multisite() && get_site_option('dbem_reset_timezone_multisite_progress', false) !== false ): ?>
|
932 |
+
<option value="all-resume"><?php esc_html_e('Resume Previous Attempt (All Blogs)', 'events-manager'); ?></option>
|
933 |
+
<?php endif; ?>
|
934 |
+
<?php
|
935 |
+
foreach( get_sites() as $WP_Site){ /* @var WP_Site $WP_Site */
|
936 |
+
echo '<option value="'.esc_attr($WP_Site->blog_id).'">'. esc_html($WP_Site->blogname) .'</option>';
|
937 |
+
}
|
938 |
+
?>
|
939 |
+
</select>
|
940 |
+
<?php endif; ?>
|
941 |
+
<p>
|
942 |
+
<em><?php esc_html_e('Select a Timezone to reset all your blog events to.','events-manager'); ?></em><br />
|
943 |
+
<em><strong><?php esc_html_e('WARNING! This cannot be undone and will overwrite all event timezones, you may want to back up your database first!','events-manager'); ?></strong></em>
|
944 |
+
</p>
|
945 |
+
</td>
|
946 |
+
<script type="text/javascript" charset="utf-8">
|
947 |
+
jQuery(document).ready(function($){
|
948 |
+
$('select[name="timezone_reset_value"]').on('change', function( e ){
|
949 |
+
if( $(this).val() == '' ){
|
950 |
+
$('a#em-reset-event-timezones').css({opacity:0.5, cursor:'default'});
|
951 |
+
}else{
|
952 |
+
$('a#em-reset-event-timezones').css({opacity:1, cursor:'pointer'});
|
953 |
+
}
|
954 |
+
}).trigger('change');
|
955 |
+
$('a#em-reset-event-timezones').on('click', function(e,el){
|
956 |
+
if( $('select[name="timezone_reset_value"]').val() == '' ) return false;
|
957 |
+
var thisform = $(this).closest('form');
|
958 |
+
thisform.find('input, textarea, select').prop('disabled', true);
|
959 |
+
thisform.find('select.em-reset-event-timezones').prop('disabled', false);
|
960 |
+
thisform.find('input[name=_wpnonce]').val('<?php echo esc_attr($reset_timezone_nonce); ?>').prop('disabled', false);
|
961 |
+
thisform.append($('<input type="hidden" name="action" value="<?php echo is_multisite() ? 'reset_timezones':'reset_timezones'; ?>" />'));
|
962 |
+
thisform.submit();
|
963 |
+
});
|
964 |
+
});
|
965 |
+
</script>
|
966 |
+
</td></tr>
|
967 |
+
</table>
|
968 |
+
|
969 |
+
<table class="form-table">
|
970 |
+
<tr class="em-header"><td colspan="2">
|
971 |
+
<h4><?php _e ( 'Uninstall/Reset', 'events-manager'); ?></h4>
|
972 |
+
<p><?php _e('Use the buttons below to uninstall Events Manager completely from your system or reset Events Manager to original settings and keep your event data.','events-manager'); ?></p>
|
973 |
+
</td></tr>
|
974 |
+
<tr><td colspan="2">
|
975 |
+
<a href="<?php echo $uninstall_url; ?>" class="button-secondary"><?php _e('Uninstall','events-manager'); ?></a>
|
976 |
+
<a href="<?php echo $reset_url; ?>" class="button-secondary"><?php _e('Reset','events-manager'); ?></a>
|
977 |
+
</td></tr>
|
978 |
+
</table>
|
979 |
+
<?php do_action('em_options_page_panel_admin_tools'); ?>
|
980 |
+
<?php echo $save_button; ?>
|
981 |
+
</div>
|
982 |
+
</div>
|
983 |
+
<?php
|
984 |
+
}
|
985 |
+
|
986 |
+
/**
|
987 |
+
* Meta options box for privacy and data protection rules for GDPR (and other dp laws) compliancy
|
988 |
+
*/
|
989 |
+
function em_admin_option_box_data_privacy(){
|
990 |
+
global $save_button;
|
991 |
+
$privacy_options = array(
|
992 |
+
0 => __('Do not include', 'events-manager'),
|
993 |
+
1 => __('Include all', 'events-manager'),
|
994 |
+
2 => __('Include only guest submissions', 'events-manager')
|
995 |
+
);
|
996 |
+
?>
|
997 |
+
<div class="postbox " id="em-opt-data-privacy" >
|
998 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Privacy', 'events-manager'); ?> </span></h3>
|
999 |
+
<div class="inside">
|
1000 |
+
<p class="em-boxheader"><?php echo sprintf(__('Depending on the nature of your site, you will be subject to one or more national and international privacy/data protection laws such as the %s. Below are some options that you can use to tailor how Events Manager interacts with WordPress privacy tools.','events-manager'), '<a href=http://ec.europa.eu/justice/smedataprotect/index_en.htm">GDPR</a>'); ?></p>
|
1001 |
+
<p class="em-boxheader"><?php echo sprintf(__('For more information see our <a href="%s">data privacy documentation</a>.','events-manager'), 'http://wp-events-plugin.com/documentation/data-privacy-gdpr-compliance/'); ?></p>
|
1002 |
+
<p class="em-boxheader"><?php echo __('All options below relate to data that may have been submitted by or collected from the user requesting their personal data, which would also include events and locations where they are the author.', 'events-manager'); ?></p>
|
1003 |
+
<table class='form-table'>
|
1004 |
+
<thead>
|
1005 |
+
<tr class="em-header">
|
1006 |
+
<th colspan="2"><h4><?php esc_html_e('Export Personal Data'); ?></h4></th>
|
1007 |
+
</tr>
|
1008 |
+
</thead>
|
1009 |
+
<?php
|
1010 |
+
em_options_select ( __( 'Events', 'events-manager'), 'dbem_data_privacy_export_events', $privacy_options );
|
1011 |
+
em_options_select ( __( 'Locations', 'events-manager'), 'dbem_data_privacy_export_locations', $privacy_options, __('Locations submitted by guest users are not included, unless they are linked to events also submitted by them.', 'events-manager') );
|
1012 |
+
em_options_select ( __( 'Bookings', 'events-manager'), 'dbem_data_privacy_export_bookings', $privacy_options, __('This is specific to bookings made by the user, not bookings that may have been made to events they own.', 'events-manager'), $privacy_options );
|
1013 |
+
?>
|
1014 |
+
<thead>
|
1015 |
+
<tr class="em-header">
|
1016 |
+
<th colspan="2"><h4><?php esc_html_e('Erase Personal Data'); ?></h4></th>
|
1017 |
+
</tr>
|
1018 |
+
</thead>
|
1019 |
+
<?php
|
1020 |
+
em_options_select ( __( 'Events', 'events-manager'), 'dbem_data_privacy_erase_events', $privacy_options );
|
1021 |
+
em_options_select ( __( 'Locations', 'events-manager'), 'dbem_data_privacy_erase_locations', $privacy_options, __('Locations submitted by guest users are not included, unless they are linked to events also submitted by them.', 'events-manager') );
|
1022 |
+
em_options_select ( __( 'Bookings', 'events-manager'), 'dbem_data_privacy_erase_bookings', $privacy_options, __('This is specific to bookings made by the user, not bookings that may have been made to events they own.', 'events-manager'), $privacy_options );
|
1023 |
+
?>
|
1024 |
+
<thead>
|
1025 |
+
<tr class="em-header">
|
1026 |
+
<th colspan="2">
|
1027 |
+
<h4><?php esc_html_e('Consent', 'events-manager'); ?></h4>
|
1028 |
+
<p><?php esc_html_e('If you collect personal data, you may want to request their consent. The options below will automatically add checkboxes requesting this consent.', 'events-manager'); ?></p>
|
1029 |
+
</th>
|
1030 |
+
</tr>
|
1031 |
+
</thead>
|
1032 |
+
<?php
|
1033 |
+
$consent_options = array(
|
1034 |
+
0 => __('Do not show', 'events-manager'),
|
1035 |
+
1 => __('Show to all', 'events-manager'),
|
1036 |
+
2 => __('Only show to guests', 'events-manager')
|
1037 |
+
);
|
1038 |
+
$consent_remember = array(
|
1039 |
+
0 => __('Always show and ask for consent', 'events-manager'),
|
1040 |
+
1 => __('Remember and hide checkbox', 'events-manager'),
|
1041 |
+
2 => __('Remember and show checkbox', 'events-manager')
|
1042 |
+
);
|
1043 |
+
em_options_input_text( __('Consent Text', 'events-manager'), 'dbem_data_privacy_consent_text', __('%s will be replaced by a link to your site privacy policy page.', 'events-manager') );
|
1044 |
+
em_options_select( __('Remembering Consent', 'events-manager'), 'dbem_data_privacy_consent_remember', $consent_remember, __('You can hide or leave the consent box checked for registered users who have provided consent previously.', 'events-manager') );
|
1045 |
+
em_options_select( __( 'Event Submission Forms', 'events-manager'), 'dbem_data_privacy_consent_events', $privacy_options );
|
1046 |
+
em_options_select( __( 'Location Submission Forms', 'events-manager'), 'dbem_data_privacy_consent_locations', $privacy_options );
|
1047 |
+
em_options_select( __( 'Bookings Forms', 'events-manager'), 'dbem_data_privacy_consent_bookings', $privacy_options );
|
1048 |
+
|
1049 |
+
echo $save_button;
|
1050 |
+
?>
|
1051 |
+
</table>
|
1052 |
+
</div> <!-- . inside -->
|
1053 |
+
</div> <!-- .postbox -->
|
1054 |
+
<?php
|
1055 |
+
}
|
1056 |
+
?>
|
trunk/admin/settings/tabs/bookings.php
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('manage_options') ) return; ?>
|
2 |
+
<!-- BOOKING OPTIONS -->
|
3 |
+
<div class="em-menu-bookings em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
|
5 |
+
<?php do_action('em_options_page_bookings_general_before'); ?>
|
6 |
+
<div class="postbox " id="em-opt-bookings-general" >
|
7 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'events-manager'),__('General','events-manager')); ?> </span></h3>
|
8 |
+
<div class="inside">
|
9 |
+
<table class='form-table'>
|
10 |
+
<?php
|
11 |
+
do_action('em_options_page_bookings_general_top');
|
12 |
+
em_options_radio_binary ( __( 'Allow guest bookings?', 'events-manager'), 'dbem_bookings_anonymous', __( 'If enabled, guest visitors can supply an email address and a user account will automatically be created for them along with their booking. They will be also be able to log back in with that newly created account.', 'events-manager') );
|
13 |
+
em_options_radio_binary ( __( 'Approval Required?', 'events-manager'), 'dbem_bookings_approval', __( 'Bookings will not be confirmed until the event administrator approves it.', 'events-manager').' '.__( 'This setting is not applicable when using payment gateways, see individual gateways for approval settings.', 'events-manager'));
|
14 |
+
em_options_radio_binary ( __( 'Reserved unconfirmed spaces?', 'events-manager'), 'dbem_bookings_approval_reserved', __( 'By default, event spaces become unavailable once there are enough CONFIRMED bookings. To reserve spaces even if unapproved, choose yes.', 'events-manager') );
|
15 |
+
em_options_radio_binary ( __( 'Allow overbooking when approving?', 'events-manager'), 'dbem_bookings_approval_overbooking', __( 'If you get a lot of pending bookings and you decide to allow more bookings than spaces allow, setting this to yes will allow you to override the event space limit when manually approving.', 'events-manager') );
|
16 |
+
em_options_radio_binary ( __( 'Allow double bookings?', 'events-manager'), 'dbem_bookings_double', __( 'If enabled, users can book an event more than once.', 'events-manager') );
|
17 |
+
do_action('em_options_page_bookings_cancellations_before');
|
18 |
+
?>
|
19 |
+
<tr class="em-header"><td colspan='2'><h4><?php echo sprintf(__( '%s Options', 'events-manager'),__('Cancellation','events-manager')); ?></h4></td></tr>
|
20 |
+
<?php
|
21 |
+
em_options_radio_binary ( __( 'Can users cancel their booking?', 'events-manager'), 'dbem_bookings_user_cancellation', __( 'If enabled, users can cancel their bookings themselves from their bookings page.', 'events-manager'), '', '#dbem_bookings_user_cancellation_time_row' );
|
22 |
+
$cancellation_hours_desc = __( 'Enter the number of hours before an event starts for when users can cancel a booking. Leave blank for the start time of the event.', 'events-manager');
|
23 |
+
$cancellation_hours_desc_2 = __('%s are also accepted, for example %s equals 1 month and 12 hours before the event starts.', 'events-manager');
|
24 |
+
$cancellation_hours_desc .= ' '. sprintf($cancellation_hours_desc_2, '<a href="https://www.php.net/manual/en/dateinterval.construct.php" target="_blank">'.esc_html_x('PHP date intevals', 'Refer to PHP docs for translation.', 'em-pro').'</a>', '<code>P1MT12H</code>');
|
25 |
+
if( (!defined('EM_DIASBLE_EMP_HINTS') || EM_DIASBLE_EMP_HINTS) && (!defined('EMP_VERSION') || version_compare('3.0.3', get_option('em_pro_version'), '>') ) ){
|
26 |
+
$pro_notice = sprintf(__('Need event-specific cancellation settings or support for hours after an event started? This is included in our %s.', 'events-manager'), '<a href="https://wp-events-plugin.com/features/">'.esc_html__('Pro Add-On', 'events-manager') . '</a>');
|
27 |
+
$cancellation_hours_desc .= '<br>'. $pro_notice;
|
28 |
+
}elseif( defined('EMP_VERSION') && version_compare('3.0.3', get_option('em_pro_version'), '<=') ){
|
29 |
+
$pro_notice = esc_html__('Add a negative number or minus sign to the start of the date interval to allow cancellations after events have started.', 'events-manager');
|
30 |
+
$cancellation_hours_desc .= ' ' . $pro_notice;
|
31 |
+
}
|
32 |
+
em_options_input_text ( __( 'How long before an event can users cancel?', 'events-manager'), 'dbem_bookings_user_cancellation_time', $cancellation_hours_desc);
|
33 |
+
do_action('em_options_page_bookings_cancellations_after');
|
34 |
+
do_action('em_options_page_bookings_general_bottom');
|
35 |
+
echo $save_button;
|
36 |
+
?>
|
37 |
+
</table>
|
38 |
+
</div> <!-- . inside -->
|
39 |
+
</div> <!-- .postbox -->
|
40 |
+
<?php do_action('em_options_page_bookings_general_after'); ?>
|
41 |
+
|
42 |
+
<div class="postbox " id="em-opt-pricing-options" >
|
43 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'events-manager'),__('Pricing','events-manager')); ?> </span></h3>
|
44 |
+
<div class="inside">
|
45 |
+
<table class='form-table'>
|
46 |
+
<?php
|
47 |
+
/* Tax & Currency */
|
48 |
+
em_options_select ( __( 'Currency', 'events-manager'), 'dbem_bookings_currency', em_get_currencies()->names, __( 'Choose your currency for displaying event pricing.', 'events-manager') );
|
49 |
+
em_options_input_text ( __( 'Thousands Separator', 'events-manager'), 'dbem_bookings_currency_thousands_sep', '<code>'.get_option('dbem_bookings_currency_thousands_sep')." = ".em_get_currency_symbol().'100<strong>'.get_option('dbem_bookings_currency_thousands_sep').'</strong>000<strong>'.get_option('dbem_bookings_currency_decimal_point').'</strong>00</code>' );
|
50 |
+
em_options_input_text ( __( 'Decimal Point', 'events-manager'), 'dbem_bookings_currency_decimal_point', '<code>'.get_option('dbem_bookings_currency_decimal_point')." = ".em_get_currency_symbol().'100<strong>'.get_option('dbem_bookings_currency_decimal_point').'</strong>00</code>' );
|
51 |
+
em_options_input_text ( __( 'Currency Format', 'events-manager'), 'dbem_bookings_currency_format', __('Choose how prices are displayed. <code>@</code> will be replaced by the currency symbol, and <code>#</code> will be replaced by the number.','events-manager').' <code>'.get_option('dbem_bookings_currency_format')." = ".em_get_currency_formatted('10000000').'</code>');
|
52 |
+
em_options_input_text ( __( 'Tax Rate', 'events-manager'), 'dbem_bookings_tax', __( 'Add a tax rate to your ticket prices (entering 10 will add 10% to the ticket price).', 'events-manager') );
|
53 |
+
em_options_radio_binary ( __( 'Add tax to ticket price?', 'events-manager'), 'dbem_bookings_tax_auto_add', __( 'When displaying ticket prices and booking totals, include the tax automatically?', 'events-manager') );
|
54 |
+
echo $save_button;
|
55 |
+
?>
|
56 |
+
</table>
|
57 |
+
</div> <!-- . inside -->
|
58 |
+
</div> <!-- .postbox -->
|
59 |
+
|
60 |
+
<div class="postbox " id="em-opt-booking-feedbacks" >
|
61 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e( 'Customize Feedback Messages', 'events-manager'); ?> </span></h3>
|
62 |
+
<div class="inside">
|
63 |
+
<p><?php _e('Below you will find texts that will be displayed to users in various areas during the bookings process, particularly on booking forms.','events-manager'); ?></p>
|
64 |
+
<table class='form-table'>
|
65 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('My Bookings messages','events-manager') ?></h4></td></tr>
|
66 |
+
<?php
|
67 |
+
em_options_input_text ( __( 'Booking Cancelled', 'events-manager'), 'dbem_booking_feedback_cancelled', __( 'When a user cancels their booking, this message will be displayed confirming the cancellation.', 'events-manager') );
|
68 |
+
em_options_input_text ( __( 'Booking Cancellation Warning', 'events-manager'), 'dbem_booking_warning_cancel', __( 'When a user chooses to cancel a booking, this warning is displayed for them to confirm.', 'events-manager') );
|
69 |
+
?>
|
70 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking form texts/messages','events-manager') ?></h4></td></tr>
|
71 |
+
<?php
|
72 |
+
em_options_input_text ( __( 'Bookings disabled', 'events-manager'), 'dbem_bookings_form_msg_disabled', __( 'An event with no bookings.', 'events-manager') );
|
73 |
+
em_options_input_text ( __( 'Bookings closed', 'events-manager'), 'dbem_bookings_form_msg_closed', __( 'Bookings have closed (e.g. event has started).', 'events-manager') );
|
74 |
+
em_options_input_text ( __( 'Fully booked', 'events-manager'), 'dbem_bookings_form_msg_full', __( 'Event is fully booked.', 'events-manager') );
|
75 |
+
em_options_input_text ( __( 'Already attending', 'events-manager'), 'dbem_bookings_form_msg_attending', __( 'If already attending and double bookings are disabled, this message will be displayed, followed by a link to the users booking page.', 'events-manager') );
|
76 |
+
em_options_input_text ( __( 'Manage bookings link text', 'events-manager'), 'dbem_bookings_form_msg_bookings_link', __( 'Link text used for link to user bookings.', 'events-manager') );
|
77 |
+
?>
|
78 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking form feedback messages','events-manager') ?></h4></td></tr>
|
79 |
+
<tr><td colspan='2'><?php _e('When a booking is made by a user, a feedback message is shown depending on the result, which can be customized below.','events-manager'); ?></td></tr>
|
80 |
+
<?php
|
81 |
+
em_options_input_text ( __( 'Successful booking', 'events-manager'), 'dbem_booking_feedback', __( 'When a booking is registered and confirmed.', 'events-manager') );
|
82 |
+
em_options_input_text ( __( 'Successful pending booking', 'events-manager'), 'dbem_booking_feedback_pending', __( 'When a booking is registered but pending.', 'events-manager') );
|
83 |
+
em_options_input_text ( __( 'Not enough spaces', 'events-manager'), 'dbem_booking_feedback_full', __( 'When a booking cannot be made due to lack of spaces.', 'events-manager') );
|
84 |
+
em_options_input_text ( __( 'Errors', 'events-manager'), 'dbem_booking_feedback_error', __( 'When a booking cannot be made due to an error when filling the form. Below this, there will be a dynamic list of errors.', 'events-manager') );
|
85 |
+
em_options_input_text ( __( 'Email Exists', 'events-manager'), 'dbem_booking_feedback_email_exists', __( 'When a guest tries to book using an email registered with a user account.', 'events-manager') );
|
86 |
+
em_options_input_text ( __( 'User must log in', 'events-manager'), 'dbem_booking_feedback_log_in', __( 'When a user must log in before making a booking.', 'events-manager') );
|
87 |
+
em_options_input_text ( __( 'Error mailing user', 'events-manager'), 'dbem_booking_feedback_nomail', __( 'If a booking is made and an email cannot be sent, this is added to the success message.', 'events-manager') );
|
88 |
+
em_options_input_text ( __( 'Already booked', 'events-manager'), 'dbem_booking_feedback_already_booked', __( 'If the user made a previous booking and cannot double-book.', 'events-manager') );
|
89 |
+
em_options_input_text ( __( 'No spaces booked', 'events-manager'), 'dbem_booking_feedback_min_space', __( 'If the user tries to make a booking without requesting any spaces.', 'events-manager') );$notice_full = __('Sold Out', 'events-manager');
|
90 |
+
em_options_input_text ( __( 'Maximum spaces per booking', 'events-manager'), 'dbem_booking_feedback_spaces_limit', __( 'If the user tries to make a booking with spaces that exceeds the maximum number of spaces per booking.', 'events-manager').' '. __('%d will be replaced by a number.','events-manager') );
|
91 |
+
?>
|
92 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booking button feedback messages','events-manager') ?></h4></td></tr>
|
93 |
+
<tr><td colspan='2'><?php echo sprintf(__('With the %s placeholder, the below texts will be used.','events-manager'),'<code>#_BOOKINGBUTTON</code>'); ?></td></tr>
|
94 |
+
<?php
|
95 |
+
em_options_input_text ( __( 'User can book', 'events-manager'), 'dbem_booking_button_msg_book', '');
|
96 |
+
em_options_input_text ( __( 'Booking in progress', 'events-manager'), 'dbem_booking_button_msg_booking', '');
|
97 |
+
em_options_input_text ( __( 'Booking complete', 'events-manager'), 'dbem_booking_button_msg_booked', '');
|
98 |
+
em_options_input_text ( __( 'Booking already made', 'events-manager'), 'dbem_booking_button_msg_already_booked', '');
|
99 |
+
em_options_input_text ( __( 'Booking error', 'events-manager'), 'dbem_booking_button_msg_error', '');
|
100 |
+
em_options_input_text ( __( 'Event fully booked', 'events-manager'), 'dbem_booking_button_msg_full', '');
|
101 |
+
em_options_input_text ( __( 'Bookings closed', 'events-manager'), 'dbem_booking_button_msg_closed', '');
|
102 |
+
em_options_input_text ( __( 'Cancel', 'events-manager'), 'dbem_booking_button_msg_cancel', '');
|
103 |
+
em_options_input_text ( __( 'Cancelation in progress', 'events-manager'), 'dbem_booking_button_msg_canceling', '');
|
104 |
+
em_options_input_text ( __( 'Cancelation complete', 'events-manager'), 'dbem_booking_button_msg_cancelled', '');
|
105 |
+
em_options_input_text ( __( 'Cancelation error', 'events-manager'), 'dbem_booking_button_msg_cancel_error', '');
|
106 |
+
|
107 |
+
echo $save_button;
|
108 |
+
?>
|
109 |
+
</table>
|
110 |
+
</div> <!-- . inside -->
|
111 |
+
</div> <!-- .postbox -->
|
112 |
+
|
113 |
+
<div class="postbox " id="em-opt-booking-form-options" >
|
114 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'events-manager'),__('Booking Form','events-manager')); ?> </span></h3>
|
115 |
+
<div class="inside">
|
116 |
+
<table class='form-table'>
|
117 |
+
<?php
|
118 |
+
em_options_radio_binary ( __( 'Display login form?', 'events-manager'), 'dbem_bookings_login_form', __( 'Choose whether or not to display a login form in the booking form area to remind your members to log in before booking.', 'events-manager') );
|
119 |
+
em_options_input_text ( __( 'Submit button text', 'events-manager'), 'dbem_bookings_submit_button', sprintf(__( 'The text used by the submit button. To use an image instead, enter the full url starting with %s or %s.', 'events-manager'), '<code>http://</code>','<code>https://</code>') );
|
120 |
+
?>
|
121 |
+
<tr class="em-header"><td colspan='2'><h4><?php esc_html_e('Booking form section headers','events-manager') ?></h4></td></tr>
|
122 |
+
<tr><td colspan='2'><?php echo esc_html__('These headings appear above sections of the booking form. Leave blank for no heading.','events-manager'); ?></td></tr>
|
123 |
+
<?php
|
124 |
+
em_options_input_text ( esc_html__('Tickets', 'events-manager'), 'dbem_bookings_header_tickets' );
|
125 |
+
em_options_input_text ( esc_html__('Registration Information', 'events-manager'), 'dbem_bookings_header_reg_info' );
|
126 |
+
em_options_input_text ( esc_html__('Payment and Confirmation', 'events-manager'), 'dbem_bookings_header_payment' );
|
127 |
+
|
128 |
+
do_action('em_options_booking_form_options');
|
129 |
+
echo $save_button;
|
130 |
+
?>
|
131 |
+
</table>
|
132 |
+
</div> <!-- . inside -->
|
133 |
+
</div> <!-- .postbox -->
|
134 |
+
|
135 |
+
<div class="postbox " id="em-opt-ticket-options" >
|
136 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__( '%s Options', 'events-manager'),__('Ticket','events-manager')); ?> </span></h3>
|
137 |
+
<div class="inside">
|
138 |
+
<table class='form-table'>
|
139 |
+
<?php
|
140 |
+
em_options_radio_binary ( __( 'Single ticket mode?', 'events-manager'), 'dbem_bookings_tickets_single', __( 'In single ticket mode, users can only create one ticket per event (and will not see options to add more tickets).', 'events-manager') );
|
141 |
+
em_options_radio_binary ( __( 'Show ticket table in single ticket mode?', 'events-manager'), 'dbem_bookings_tickets_single_form', __( 'If you prefer a ticket table like with multiple tickets, even for single ticket events, enable this.', 'events-manager') );
|
142 |
+
em_options_radio_binary ( __( 'Show unavailable tickets?', 'events-manager'), 'dbem_bookings_tickets_show_unavailable', __( 'You can choose whether or not to show unavailable tickets to visitors.', 'events-manager') );
|
143 |
+
em_options_radio_binary ( __( 'Show member-only tickets?', 'events-manager'), 'dbem_bookings_tickets_show_member_tickets', sprintf(__('%s must be set to yes for this to work.', 'events-manager'), '<strong>'.__( 'Show unavailable tickets?', 'events-manager').'</strong>').' '.__( 'If there are member-only tickets, you can choose whether or not to show these tickets to guests.','events-manager') );
|
144 |
+
|
145 |
+
em_options_radio_binary ( __( 'Show multiple tickets if logged out?', 'events-manager'), 'dbem_bookings_tickets_show_loggedout', __( 'If guests cannot make bookings, they will be asked to register in order to book. However, enabling this will still show available tickets.', 'events-manager') );
|
146 |
+
em_options_radio_binary ( __( 'Enable custom ticket ordering?', 'events-manager'), 'dbem_bookings_tickets_ordering', __( 'When enabled, users can custom-order their tickets using drag and drop. If enabled, saved ordering supercedes the default ticket ordering below.', 'events-manager') );
|
147 |
+
$ticket_orders = apply_filters('em_tickets_orderby_options', array(
|
148 |
+
'ticket_price DESC, ticket_name ASC'=>__('Ticket Price (Descending)','events-manager'),
|
149 |
+
'ticket_price ASC, ticket_name ASC'=>__('Ticket Price (Ascending)','events-manager'),
|
150 |
+
'ticket_name ASC, ticket_price DESC'=>__('Ticket Name (Ascending)','events-manager'),
|
151 |
+
'ticket_name DESC, ticket_price DESC'=>__('Ticket Name (Descending)','events-manager')
|
152 |
+
));
|
153 |
+
em_options_select ( __( 'Order Tickets By', 'events-manager'), 'dbem_bookings_tickets_orderby', $ticket_orders, __( 'Choose which order your tickets appear.', 'events-manager') );
|
154 |
+
echo $save_button;
|
155 |
+
?>
|
156 |
+
</table>
|
157 |
+
</div> <!-- . inside -->
|
158 |
+
</div> <!-- .postbox -->
|
159 |
+
|
160 |
+
<div class="postbox " id="em-opt-no-user-bookings" >
|
161 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e('No-User Booking Mode','events-manager'); ?> </span></h3>
|
162 |
+
<div class="inside">
|
163 |
+
<table class='form-table'>
|
164 |
+
<tr><td colspan='2'>
|
165 |
+
<p><?php _e('The option below allows you to disable user accounts, yet you will still see the supplied personal information for each booking.','events-manager'); ?></p>
|
166 |
+
<p><?php _e('By default, when a booking is made by a user, this booking is tied to a user account, if the user is not registered nor logged in and guest bookings are enabled, an account will be created for them.','events-manager'); ?></p>
|
167 |
+
<p><?php _e('Users with accounts (which would be created by other means when this mode is enabled) will still be able to log in and make bookings linked to their account as normal.','events-manager'); ?></p>
|
168 |
+
<p><?php _e('<strong>Warning : </strong> Various features afforded to users with an account will not be available, e.g. viewing bookings. Once you enable this and select a user, modifying these values will prevent older non-user bookings from displaying the correct information.','events-manager'); ?></p>
|
169 |
+
</td></tr>
|
170 |
+
<?php
|
171 |
+
em_options_radio_binary ( __( 'Enable No-User Booking Mode?', 'events-manager'), 'dbem_bookings_registration_disable', __( 'This disables user registrations for bookings.', 'events-manager') );
|
172 |
+
em_options_radio_binary ( __( 'Allow bookings with registered emails?', 'events-manager'), 'dbem_bookings_registration_disable_user_emails', __( 'By default, if a guest tries to book an event using the email of a user account on your site they will be asked to log in, selecting yes will bypass this security measure.', 'events-manager').'<br />'.__('<strong>Warning : </strong> By enabling this, registered users will not be able to see bookings they make as guests in their "My Bookings" page.','events-manager') );
|
173 |
+
echo $save_button;
|
174 |
+
?>
|
175 |
+
</table>
|
176 |
+
</div> <!-- . inside -->
|
177 |
+
</div> <!-- .postbox -->
|
178 |
+
|
179 |
+
<?php do_action('em_options_page_footer_bookings'); ?>
|
180 |
+
|
181 |
+
</div> <!-- .em-menu-bookings -->
|
trunk/admin/settings/tabs/emails.php
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('manage_options') ) return; ?>
|
2 |
+
<!-- EMAIL OPTIONS -->
|
3 |
+
<div class="em-menu-emails em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
|
5 |
+
<?php if ( !is_multisite() ) { em_admin_option_box_email(); } ?>
|
6 |
+
|
7 |
+
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
8 |
+
<div class="postbox " id="em-opt-booking-emails">
|
9 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Booking Email Templates', 'events-manager'); ?> </span></h3>
|
10 |
+
<div class="inside">
|
11 |
+
<?php do_action('em_options_page_booking_email_templates_options_top'); ?>
|
12 |
+
<table class='form-table'>
|
13 |
+
<?php
|
14 |
+
$email_subject_tip = __('You can disable this email by leaving the subject blank.','events-manager');
|
15 |
+
em_options_input_text ( __( 'Email events admin?', 'events-manager'), 'dbem_bookings_notify_admin', __( "If you would like every event booking confirmation email sent to an administrator write their email here (leave blank to not send an email).", 'events-manager').' '.__('For multiple emails, separate by commas (e.g. email1@test.com,email2@test.com,etc.)','events-manager') );
|
16 |
+
em_options_radio_binary ( __( 'Email event owner?', 'events-manager'), 'dbem_bookings_contact_email', __( 'Check this option if you want the event contact to receive an email when someone books places. An email will be sent when a booking is first made (regardless if confirmed or pending)', 'events-manager') );
|
17 |
+
do_action('em_options_page_booking_email_templates_options_subtop');
|
18 |
+
?>
|
19 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Admin/Owner Emails', 'events-manager'); ?></h4></td></tr>
|
20 |
+
<?php
|
21 |
+
em_options_radio_binary ( __( 'Add Reply-To event owner?', 'events-manager'), 'dbem_bookings_replyto_owner_admins', __( "If enabled replies to these automated emails will, by default, be sent to the email of the event owner.",'events-manager') );
|
22 |
+
?>
|
23 |
+
<tbody class="em-subsection">
|
24 |
+
<tr class="em-subheader"><td colspan='2'>
|
25 |
+
<h5><?php _e('Confirmed booking email','events-manager') ?></h5>
|
26 |
+
<em><?php echo __('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.','events-manager').$bookings_placeholder_tip ?></em>
|
27 |
+
</td></tr>
|
28 |
+
<?php
|
29 |
+
em_options_input_text ( __( 'Booking confirmed email subject', 'events-manager'), 'dbem_bookings_contact_email_confirmed_subject', $email_subject_tip );
|
30 |
+
em_options_textarea ( __( 'Booking confirmed email', 'events-manager'), 'dbem_bookings_contact_email_confirmed_body', '' );
|
31 |
+
?>
|
32 |
+
<tr class="em-subheader"><td colspan='2'>
|
33 |
+
<h5><?php _e('Pending booking email','events-manager') ?></h5>
|
34 |
+
<em><?php echo __('This is sent when a person\'s booking is pending. If approvals are enabled, this is sent out when a user first submits their booking.','events-manager').$bookings_placeholder_tip ?></em>
|
35 |
+
</td></tr>
|
36 |
+
<?php
|
37 |
+
em_options_input_text ( __( 'Booking pending email subject', 'events-manager'), 'dbem_bookings_contact_email_pending_subject', $email_subject_tip );
|
38 |
+
em_options_textarea ( __( 'Booking pending email', 'events-manager'), 'dbem_bookings_contact_email_pending_body', '' );
|
39 |
+
?>
|
40 |
+
<tr class="em-subheader"><td colspan='2'>
|
41 |
+
<h5><?php _e('Booking cancelled','events-manager') ?></h5>
|
42 |
+
<em><?php echo __('An email will be sent to the event contact if someone cancels their booking.','events-manager').$bookings_placeholder_tip ?></em>
|
43 |
+
</td></tr>
|
44 |
+
<?php
|
45 |
+
em_options_input_text ( __( 'Booking cancelled email subject', 'events-manager'), 'dbem_bookings_contact_email_cancelled_subject', $email_subject_tip );
|
46 |
+
em_options_textarea ( __( 'Booking cancelled email', 'events-manager'), 'dbem_bookings_contact_email_cancelled_body', '' );
|
47 |
+
?>
|
48 |
+
<tr class="em-subheader"><td colspan='2'>
|
49 |
+
<h5><?php _e('Rejected booking email','events-manager') ?></h5>
|
50 |
+
<em><?php echo __( 'This will be sent to event admins when a booking is rejected.', 'events-manager').$bookings_placeholder_tip ?></em>
|
51 |
+
</td></tr>
|
52 |
+
<?php
|
53 |
+
em_options_input_text ( __( 'Booking rejected email subject', 'events-manager'), 'dbem_bookings_contact_email_rejected_subject', $email_subject_tip );
|
54 |
+
em_options_textarea ( __( 'Booking rejected email', 'events-manager'), 'dbem_bookings_contact_email_rejected_body', '' );
|
55 |
+
?>
|
56 |
+
</tbody>
|
57 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Booked User Emails', 'events-manager'); ?></h4></td></tr>
|
58 |
+
<?php
|
59 |
+
em_options_radio_binary ( __( 'Add Reply-To event owner?', 'events-manager'), 'dbem_bookings_replyto_owner', __( "If enabled replies to these automated emails will, by default, be sent to the email of the event owner.",'events-manager') );
|
60 |
+
?>
|
61 |
+
<tbody class="em-subsection">
|
62 |
+
<tr class="em-subheader"><td colspan='2'>
|
63 |
+
<h5><?php _e('Confirmed booking email','events-manager') ?></h5>
|
64 |
+
<em><?php echo __('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.','events-manager').$bookings_placeholder_tip ?></em>
|
65 |
+
</td></tr>
|
66 |
+
<?php
|
67 |
+
em_options_input_text ( __( 'Booking confirmed email subject', 'events-manager'), 'dbem_bookings_email_confirmed_subject', $email_subject_tip );
|
68 |
+
em_options_textarea ( __( 'Booking confirmed email', 'events-manager'), 'dbem_bookings_email_confirmed_body', '' );
|
69 |
+
?>
|
70 |
+
<tr class="em-subheader"><td colspan='2'>
|
71 |
+
<h5><?php _e('Pending booking email','events-manager') ?></h5>
|
72 |
+
<em><?php echo __( 'This will be sent to the person when they first submit their booking. Not relevant if bookings don\'t require approval.', 'events-manager').$bookings_placeholder_tip ?></em>
|
73 |
+
</td></tr>
|
74 |
+
<?php
|
75 |
+
em_options_input_text ( __( 'Booking pending email subject', 'events-manager'), 'dbem_bookings_email_pending_subject', $email_subject_tip);
|
76 |
+
em_options_textarea ( __( 'Booking pending email', 'events-manager'), 'dbem_bookings_email_pending_body','') ;
|
77 |
+
?>
|
78 |
+
<tr class="em-subheader"><td colspan='2'>
|
79 |
+
<h5><?php _e('Booking cancelled','events-manager') ?></h5>
|
80 |
+
<em><?php echo __('This will be sent when a user cancels their booking.','events-manager').$bookings_placeholder_tip ?></em>
|
81 |
+
</td></tr>
|
82 |
+
<?php
|
83 |
+
em_options_input_text ( __( 'Booking cancelled email subject', 'events-manager'), 'dbem_bookings_email_cancelled_subject', $email_subject_tip );
|
84 |
+
em_options_textarea ( __( 'Booking cancelled email', 'events-manager'), 'dbem_bookings_email_cancelled_body', '' );
|
85 |
+
?>
|
86 |
+
<tr class="em-subheader"><td colspan='2'>
|
87 |
+
<h5><?php _e('Rejected booking email','events-manager') ?></h5>
|
88 |
+
<em><?php echo __( 'This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'events-manager').$bookings_placeholder_tip ?></em>
|
89 |
+
</td></tr>
|
90 |
+
<?php
|
91 |
+
em_options_input_text ( __( 'Booking rejected email subject', 'events-manager'), 'dbem_bookings_email_rejected_subject', $email_subject_tip );
|
92 |
+
em_options_textarea ( __( 'Booking rejected email', 'events-manager'), 'dbem_bookings_email_rejected_body', '' );
|
93 |
+
?>
|
94 |
+
</tbody>
|
95 |
+
<?php do_action('em_options_page_booking_email_templates_options_bottom'); ?>
|
96 |
+
<?php echo $save_button; ?>
|
97 |
+
</table>
|
98 |
+
</div> <!-- . inside -->
|
99 |
+
</div> <!-- .postbox -->
|
100 |
+
<?php endif; ?>
|
101 |
+
|
102 |
+
<?php if( get_option('dbem_rsvp_enabled') ): ?>
|
103 |
+
<div class="postbox " id="em-opt-registration-emails">
|
104 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Registration Email Templates', 'events-manager'); ?> </span></h3>
|
105 |
+
<div class="inside">
|
106 |
+
<p class="em-boxheader">
|
107 |
+
<?php echo sprintf(__('This is only applicable when %s is not active.','events-manager'), '<em>'.__('No-User Booking Mode','events-manager').'</em>'); ?>
|
108 |
+
<?php _e('When a guest user makes a booking for the first time in Events Manager, a new user account is created for them and they are sent their credentials in a separate email, which can be modified below.','events-manager'); ?>
|
109 |
+
</p>
|
110 |
+
<table class='form-table'>
|
111 |
+
<?php
|
112 |
+
em_options_radio_binary ( __( 'Disable new registration email?', 'events-manager'), 'dbem_email_disable_registration', __( 'Check this option if you want to prevent the WordPress registration email from going out when a user anonymously books an event.', 'events-manager') );
|
113 |
+
|
114 |
+
em_options_input_text ( __( 'Registration email subject', 'events-manager'), 'dbem_bookings_email_registration_subject' );
|
115 |
+
em_options_textarea ( __( 'Registration email', 'events-manager'), 'dbem_bookings_email_registration_body', sprintf(__('%s is replaced by username, %s is replaced by the user password and %s is replaced by a link to create a password.','events-manager'),'<code>%username%</code>','<code>%password%</code>','<code>%passwordurl%</code>') );
|
116 |
+
echo $save_button;
|
117 |
+
?>
|
118 |
+
</table>
|
119 |
+
</div> <!-- . inside -->
|
120 |
+
</div> <!-- .postbox -->
|
121 |
+
<?php endif; ?>
|
122 |
+
|
123 |
+
<div class="postbox " id="em-opt-event-submission-emails" >
|
124 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Templates', 'events-manager'); ?> </span></h3>
|
125 |
+
<div class="inside">
|
126 |
+
<table class='form-table'>
|
127 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Admin Emails', 'events-manager'); ?></h4></td></tr>
|
128 |
+
<?php
|
129 |
+
em_options_input_text ( __( 'Administrator Email', 'events-manager'), 'dbem_event_submitted_email_admin', __('Event submission notifications will be sent to emails added here.','events-manager').' '.__('If left blank, no emails will be sent. Separate emails with commas for more than one email.','events-manager') );
|
130 |
+
?>
|
131 |
+
<tbody class="em-subsection">
|
132 |
+
<tr class="em-subheader"><td colspan='2'>
|
133 |
+
<h5><?php _e('Event Submitted','events-manager') ?></h5>
|
134 |
+
<em><?php echo __('An email will be sent to your administrator emails when an event is submitted and pending approval.','events-manager').$bookings_placeholder_tip ?></em>
|
135 |
+
</td></tr>
|
136 |
+
<?php
|
137 |
+
em_options_input_text ( __( 'Event submitted subject', 'events-manager'), 'dbem_event_submitted_email_subject', __('If left blank, this email will not be sent.','events-manager') );
|
138 |
+
em_options_textarea ( __( 'Event submitted email', 'events-manager'), 'dbem_event_submitted_email_body', '' );
|
139 |
+
?>
|
140 |
+
<tr class="em-subheader"><td colspan='2'>
|
141 |
+
<h5><?php _e('Event Re-Submitted','events-manager') ?></h5>
|
142 |
+
<em><?php echo __('When a user modifies a previously published event, it will be put back into pending review status and will not be published until you re-approve it.','events-manager').$bookings_placeholder_tip ?></em>
|
143 |
+
</td></tr>
|
144 |
+
<?php
|
145 |
+
em_options_input_text ( __( 'Event resubmitted subject', 'events-manager'), 'dbem_event_resubmitted_email_subject', __('If left blank, this email will not be sent.','events-manager') );
|
146 |
+
em_options_textarea ( __( 'Event resubmitted email', 'events-manager'), 'dbem_event_resubmitted_email_body', '' );
|
147 |
+
?>
|
148 |
+
<tr class="em-subheader"><td colspan='2'>
|
149 |
+
<h5><?php _e('Event Published','events-manager') ?></h5>
|
150 |
+
<em><?php echo __('An email will be sent to an administrator of your choice when an event is published by users who are not administrators.','events-manager').$bookings_placeholder_tip ?>
|
151 |
+
</td></tr>
|
152 |
+
<?php
|
153 |
+
em_options_input_text ( __( 'Event published subject', 'events-manager'), 'dbem_event_published_email_subject', __('If left blank, this email will not be sent.','events-manager') );
|
154 |
+
em_options_textarea ( __( 'Event published email', 'events-manager'), 'dbem_event_published_email_body', '' );
|
155 |
+
?>
|
156 |
+
</tbody>
|
157 |
+
<tr class="em-header"><td colspan='2'><h4><?php _e('Event Submitter Emails', 'events-manager'); ?></h4></td></tr>
|
158 |
+
<tbody class="em-subsection">
|
159 |
+
<tr class="em-subheader"><td colspan='2'>
|
160 |
+
<h5><?php _e('Event Approved','events-manager') ?></h5>
|
161 |
+
<em><?php echo __('An email will be sent to the event owner when their event is approved. Users requiring event approval do not have the <code>publish_events</code> capability.','events-manager').$bookings_placeholder_tip ?>
|
162 |
+
</td></tr>
|
163 |
+
<?php
|
164 |
+
em_options_input_text ( __( 'Event approved subject', 'events-manager'), 'dbem_event_approved_email_subject', __('If left blank, this email will not be sent.','events-manager') );
|
165 |
+
em_options_textarea ( __( 'Event approved email', 'events-manager'), 'dbem_event_approved_email_body', '' );
|
166 |
+
?>
|
167 |
+
<tr class="em-subheader"><td colspan='2'>
|
168 |
+
<h5><?php _e('Event Reapproved','events-manager') ?></h5>
|
169 |
+
<?php echo __('When a user modifies a previously published event, it will be put back into pending review status and will not be published until you re-approve it.','events-manager').$bookings_placeholder_tip ?>
|
170 |
+
</td></tr>
|
171 |
+
<?php
|
172 |
+
em_options_input_text ( __( 'Event reapproved subject', 'events-manager'), 'dbem_event_reapproved_email_subject', __('If left blank, this email will not be sent.','events-manager') );
|
173 |
+
em_options_textarea ( __( 'Event reapproved email', 'events-manager'), 'dbem_event_reapproved_email_body', '' );
|
174 |
+
?>
|
175 |
+
</tbody>
|
176 |
+
<?php echo $save_button; ?>
|
177 |
+
</table>
|
178 |
+
</div> <!-- . inside -->
|
179 |
+
</div> <!-- .postbox -->
|
180 |
+
|
181 |
+
<?php do_action('em_options_page_footer_emails'); ?>
|
182 |
+
|
183 |
+
</div><!-- .em-group-emails -->
|
trunk/admin/settings/tabs/formats.php
ADDED
@@ -0,0 +1,722 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('manage_options') ) return; ?>
|
2 |
+
<!-- FORMAT OPTIONS -->
|
3 |
+
<div class="em-menu-formats em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
<p>
|
5 |
+
<input type="checkbox" id="em-enable-codeEditor" value="1">
|
6 |
+
<label for="em-enable-codeEditor" class="em-tooltip" aria-label="<?php esc_attr_e('Enable a code/syntax highlighter when clicking on the larger formatting textbox options below, for easier editing of larger HTML parts.', 'events-manager'); ?>" style="text-decoration: 2px underline dotted #ccc; text-underline-offset: 4px;">
|
7 |
+
<?php esc_html_e('Enable Code Editor for Formats', 'events-manager'); ?>
|
8 |
+
</label>
|
9 |
+
</p>
|
10 |
+
<?php
|
11 |
+
$current_status = absint(get_option('dbem_advanced_formatting'));
|
12 |
+
$disabled_text = __('Disabled', 'events-manager');
|
13 |
+
$enabled_text = __('Enabled', 'events-manager');
|
14 |
+
$current_text = $current_status ? '<span class="status enabled">('. $enabled_text .')</span>' : '<span class="status disabled">('.$disabled_text.')</span>';
|
15 |
+
?>
|
16 |
+
<div class="postbox em-postbox-notice em-postbox-notice-info" id="em-opt-advanced-formatting" data-enabled-text="(<?php echo esc_attr($enabled_text); ?>)" data-disabled-text="(<?php echo esc_attr($disabled_text); ?>)">
|
17 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Advanced Mode', 'events-manager'); ?> <?php echo $current_text ?></span></h3>
|
18 |
+
<div class="inside">
|
19 |
+
<input type="hidden" name="dbem_advanced_formatting" id="em-advanced-formatting" value="<?php echo $current_status; ?>">
|
20 |
+
<div>
|
21 |
+
<?php
|
22 |
+
$advanced_mode = esc_html__('Advanced Mode', 'events-manager');
|
23 |
+
$advanced_mode_super = esc_html__('Super Advanced Mode', 'events-manager');
|
24 |
+
$disable_text = sprintf(esc_html__('Disable %s', 'events-manager'), $advanced_mode);
|
25 |
+
$enable_text = sprintf(esc_html__('Enable %s', 'events-manager'), $advanced_mode);
|
26 |
+
?>
|
27 |
+
<p>
|
28 |
+
<a href="#" class="em-af-toggle button-primary show-0" data-set-status="1"><?php echo $enable_text; ?></a>
|
29 |
+
<a href="#" class="em-af-toggle button-secondary show-1 show-2" data-set-status="0"><?php echo $disable_text; ?></a>
|
30 |
+
</p>
|
31 |
+
<?php
|
32 |
+
$disable_text = sprintf(esc_html__('Disable %s', 'events-manager'), $advanced_mode_super);
|
33 |
+
$enable_text = sprintf(esc_html__('Enable %s', 'events-manager'), $advanced_mode_super);
|
34 |
+
$current_text = $current_status ? $disable_text : $enable_text;
|
35 |
+
?>
|
36 |
+
<a href="#" class="em-af-toggle button-secondary show-2" data-set-status="1"><?php echo $disable_text; ?></a>
|
37 |
+
<a href="#" class="em-af-toggle button-primary show-1 show-0" data-set-status="2"><?php echo $enable_text; ?></a>
|
38 |
+
</div>
|
39 |
+
<div>
|
40 |
+
<?php
|
41 |
+
$am = '<code>'. $advanced_mode .'</code>';
|
42 |
+
$sam = '<code>'.$advanced_mode_super.'</code>';
|
43 |
+
?>
|
44 |
+
<p class="em-af-status" data-status="<?php echo $current_status; ?>">
|
45 |
+
<span class="em-af-status-0"><?php echo sprintf( esc_html__('You have currently disabled %s', 'events-manager'), $am ); ?></span>
|
46 |
+
<span class="em-af-status-1"><?php echo sprintf( esc_html__('You have currently enabled %s', 'events-manager'), $am ); ?></span>
|
47 |
+
<span class="em-af-status-2"><?php echo sprintf( esc_html__('You have currently enabled %s', 'events-manager'), $sam ); ?></span>
|
48 |
+
<span class="em-af-status-save"><?php esc_html_e('Save your settings for this to take effect!', 'events-manager'); ?></span>
|
49 |
+
</p>
|
50 |
+
<p>
|
51 |
+
<?php echo sprintf(esc_html__("%s allows you to modify some or all of the formats used by Events Manager to generate your content. You can choose to override default formats and customize them to your needs. You do not lose your previously defined custom formats should you enable/disable %s or choose to not override a certain set of formats, they'll appear again once you enable %s again for that content.", 'events-manager'), $am, $am, $am); ?>
|
52 |
+
</p>
|
53 |
+
<p>
|
54 |
+
<?php echo sprintf(esc_html__("%s overrides all formatting choices, which will be be taken from the settings defined on this page. If you want to override only certain formatting, choose the %s instead.", 'events-manager'), $sam, $am); ?>
|
55 |
+
</p>
|
56 |
+
<p>
|
57 |
+
<?php esc_html_e('Clicking these buttons will not have any effect until you save your settings!', 'events-manager'); ?>
|
58 |
+
</p>
|
59 |
+
</div>
|
60 |
+
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<div class="postbox " id="em-opt-events-formats" >
|
65 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Events', 'events-manager'); ?> </span></h3>
|
66 |
+
<div class="inside">
|
67 |
+
<table class="form-table">
|
68 |
+
<tr class="em-header"><td colspan="2">
|
69 |
+
<h4><?php echo sprintf(__('%s Page','events-manager'),__('Events','events-manager')); ?></h4>
|
70 |
+
<p><?php _e('These formats will be used on your events page. This will also be used if you do not provide specified formats in other event lists, like in shortcodes.','events-manager'); ?></p>
|
71 |
+
</td></tr>
|
72 |
+
<?php
|
73 |
+
$grouby_modes = array(0=>__('None','events-manager'), 'yearly'=>__('Yearly','events-manager'), 'monthly'=>__('Monthly','events-manager'), 'weekly'=>__('Weekly','events-manager'), 'daily'=>__('Daily','events-manager'));
|
74 |
+
em_options_select(__('Events page grouping','events-manager'), 'dbem_event_list_groupby', $grouby_modes, __('If you choose a group by mode, your events page will display events in groups of your chosen time range.','events-manager'));
|
75 |
+
em_options_input_text(__('Events page grouping header','events-manager'), 'dbem_event_list_groupby_header_format', __('Choose how to format your group headings.','events-manager').' '. sprintf(__('#s will be replaced by the date format below', 'events-manager'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));
|
76 |
+
em_options_input_text(__('Events page grouping date format','events-manager'), 'dbem_event_list_groupby_format', __('Choose how to format your group heading dates. Leave blank for default.','events-manager').' '. sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'events-manager'), 'http://codex.wordpress.org/Formatting_Date_and_Time'));
|
77 |
+
em_options_input_text ( __( 'List events by date title', 'events-manager'), 'dbem_list_date_title', __( 'If viewing a page for events on a specific date, this is the title that would show up. To insert date values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/>', 'events-manager') );
|
78 |
+
if( EM_MS_GLOBAL && !get_option('dbem_ms_global_events_links') ){
|
79 |
+
em_options_input_text ( sprintf(__( 'Single %s title format', 'events-manager'),__('event','events-manager')), 'dbem_event_page_title_format', sprintf(__( 'The format of a single %s page title.', 'events-manager'),__('event','events-manager')).' '.__( 'This is only used when showing events from other blogs.', 'events-manager').$events_placeholder_tip );
|
80 |
+
}
|
81 |
+
?>
|
82 |
+
|
83 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Event List Formats', 'events-manager'); ?></h5></td></tr>
|
84 |
+
<?php
|
85 |
+
em_options_input_text ( __( 'No events message', 'events-manager'), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'events-manager') );
|
86 |
+
?>
|
87 |
+
|
88 |
+
<!-- ADVANCED Formatting -->
|
89 |
+
<tbody class="am-af">
|
90 |
+
<?php
|
91 |
+
em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[events-list]', '', '', '.am-af-events-list' );
|
92 |
+
?>
|
93 |
+
</tbody>
|
94 |
+
<tbody class="am-af am-af-events-list">
|
95 |
+
<?php
|
96 |
+
em_options_textarea ( __( 'Default event list format header', 'events-manager'), 'dbem_event_list_item_format_header', __( 'This content will appear just above your code for the default event list format. Default is blank', 'events-manager'), true );
|
97 |
+
em_options_textarea ( __( 'Default event list format', 'events-manager'), 'dbem_event_list_item_format', __( 'The format of any events in a list.', 'events-manager').$events_placeholder_tip, true );
|
98 |
+
em_options_textarea ( __( 'Default event list format footer', 'events-manager'), 'dbem_event_list_item_format_footer', __( 'This content will appear just below your code for the default event list format. Default is blank', 'events-manager'), true );
|
99 |
+
?>
|
100 |
+
</tbody>
|
101 |
+
<!-- /ADVANCED Formatting -->
|
102 |
+
|
103 |
+
<!-- ADVANCED Formatting -->
|
104 |
+
<tbody class="am-af">
|
105 |
+
<tr class="em-header">
|
106 |
+
<td colspan="2">
|
107 |
+
<h4><?php echo sprintf(__('Single %s Page','events-manager'),__('Event','events-manager')); ?></h4>
|
108 |
+
<em><?php echo sprintf(__('These formats can be used on %s pages or on other areas of your site displaying an %s.','events-manager'),__('event','events-manager'),__('event','events-manager'));?></em>
|
109 |
+
</td>
|
110 |
+
</tr>
|
111 |
+
<?php
|
112 |
+
em_options_radio_binary(__('Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[event-single]', '', '', '.am-af-event-single');
|
113 |
+
?>
|
114 |
+
</tbody>
|
115 |
+
<tbody class="am-af am-af-event-single">
|
116 |
+
<?php
|
117 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'events-manager'),__('event','events-manager')), 'dbem_single_event_format', sprintf(__( 'The format used to display %s content on single pages or elsewhere on your site.', 'events-manager'),__('event','events-manager')).$events_placeholder_tip, true);
|
118 |
+
?>
|
119 |
+
</tbody>
|
120 |
+
<!-- /ADVANCED Formatting -->
|
121 |
+
|
122 |
+
<!-- ADVANCED Formatting -->
|
123 |
+
<tbody class="am-af">
|
124 |
+
<tr class="em-header">
|
125 |
+
<td colspan="2">
|
126 |
+
<h4><?php echo sprintf(__('%s Excerpts','events-manager'),__('Event','events-manager')); ?></h4>
|
127 |
+
<em><?php echo sprintf(__('These formats can be used when WordPress automatically displays %s excerpts on your site and %s is enabled in your %s settings tab.','events-manager'),__('event','events-manager'),'<strong>'.__( 'Override Excerpts with Formats?', 'events-manager').'</strong>','<a href="#formats" class="nav-tab-link" rel="#em-menu-pages">'.__('Pages','events-manager').' > '.sprintf(__('%s List/Archives','events-manager'),__('Event','events-manager')).'</a>');?></em>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
<?php
|
131 |
+
em_options_radio_binary(__('Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[event-excerpt]', '', '', '.am-af-event-excerpt');
|
132 |
+
?>
|
133 |
+
</tbody>
|
134 |
+
<tbody class="am-af am-af-event-excerpt">
|
135 |
+
<?php
|
136 |
+
em_options_textarea ( sprintf(__('%s excerpt', 'events-manager'),__('Event','events-manager')), 'dbem_event_excerpt_format', __( 'Used if an excerpt has been defined.', 'events-manager').$events_placeholder_tip, true );
|
137 |
+
em_options_textarea ( sprintf(__('%s excerpt fallback', 'events-manager'),__('Event','events-manager')), 'dbem_event_excerpt_alt_format', __( 'Used if an excerpt has not been defined.', 'events-manager').$events_placeholder_tip, true );
|
138 |
+
?>
|
139 |
+
</tbody>
|
140 |
+
<!-- /ADVANCED Formatting -->
|
141 |
+
|
142 |
+
<?php
|
143 |
+
echo $save_button;
|
144 |
+
?>
|
145 |
+
</table>
|
146 |
+
</div> <!-- . inside -->
|
147 |
+
</div> <!-- .postbox -->
|
148 |
+
|
149 |
+
<div class="postbox " id="em-opt-search-form" >
|
150 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Search Form', 'events-manager'); ?> </span></h3>
|
151 |
+
<div class="inside">
|
152 |
+
<table class="form-table em-search-form-main">
|
153 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Main Search Fields','events-manager'); ?></h4></td></tr>
|
154 |
+
<tbody class="em-subsection">
|
155 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Search', 'events-manager'); ?></h5></td></tr>
|
156 |
+
<?php
|
157 |
+
em_options_radio_binary ( __( 'Show text search?', 'events-manager'), 'dbem_search_form_text', '', '', '#dbem_search_form_text_label_row' );
|
158 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_text_label', __('Appears within the input box.','events-manager') );
|
159 |
+
?>
|
160 |
+
</tbody>
|
161 |
+
<tbody class="em-settings-geocoding em-subsection">
|
162 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Geolocation Search', 'events-manager'); ?></h5></td></tr>
|
163 |
+
<?php
|
164 |
+
em_options_radio_binary ( __( 'Show geolocation search?', 'events-manager'), 'dbem_search_form_geo', '', '', '#dbem_search_form_geo_label_row, #dbem_search_form_geo_distance_default_row, #dbem_search_form_geo_unit_default_row' );
|
165 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_geo_label', __('Appears within the input box.','events-manager') );
|
166 |
+
em_options_input_text ( __( 'Default distance', 'events-manager'), 'dbem_search_form_geo_distance_default', __('Enter a number.','events-manager'), '');
|
167 |
+
em_options_select ( __( 'Default distance unit', 'events-manager'), 'dbem_search_form_geo_unit_default', array('km'=>'km','mi'=>'mi'), '');
|
168 |
+
?>
|
169 |
+
</tbody>
|
170 |
+
</table>
|
171 |
+
<table class="form-table">
|
172 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Advanced Search Fields','events-manager'); ?></h4></td></tr>
|
173 |
+
<?php
|
174 |
+
em_options_radio_binary ( __( 'Enable advanced fields?', 'events-manager'), 'dbem_search_form_advanced', __('Enables additional advanced search fields such as dates, country, etc.','events-manager'), '', '.em-search-form-advanced' );
|
175 |
+
?>
|
176 |
+
<tbody class="em-search-form-advanced">
|
177 |
+
<?php
|
178 |
+
em_options_input_text ( __( 'Search button text', 'events-manager'), 'dbem_search_form_submit', __("If there's no fields to show in the main search section, this button will be used instead at the bottom of the advanced fields.",'events-manager'));
|
179 |
+
em_options_radio_binary ( __( 'Hidden by default?', 'events-manager'), 'dbem_search_form_advanced_hidden', __('If set to yes, advanced search fields will be hidden by default and can be revealed by clicking the "Advanced Search" link.','events-manager'), '', '#dbem_search_form_advanced_show_row, #dbem_search_form_advanced_hide_row' );
|
180 |
+
em_options_input_text ( __( 'Show label', 'events-manager'), 'dbem_search_form_advanced_show', __('Appears as the label for this search option.','events-manager') );
|
181 |
+
em_options_input_text ( __( 'Hide label', 'events-manager'), 'dbem_search_form_advanced_hide', __('Appears as the label for this search option.','events-manager') );
|
182 |
+
?>
|
183 |
+
</tbody>
|
184 |
+
<tbody class="em-search-form-advanced em-subsection">
|
185 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Dates', 'events-manager'); ?></h5></td></tr>
|
186 |
+
<?php
|
187 |
+
em_options_radio_binary ( __( 'Show date range?', 'events-manager'), 'dbem_search_form_dates', '', '', '#dbem_search_form_dates_label_row, #dbem_search_form_dates_separator_row' );
|
188 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_dates_label', __('Appears as the label for this search option.','events-manager') );
|
189 |
+
em_options_input_text ( __( 'Date Separator', 'events-manager'), 'dbem_search_form_dates_separator', sprintf(__( 'For when start/end %s are present, this will separate the two (include spaces here if necessary).', 'events-manager'), __('dates','events-manager')) );
|
190 |
+
em_options_input_text ( __( 'Date Picker Format', 'events-manager'), 'dbem_search_form_dates_format', __('Customize the format of the selected search dates, we recommend a brief format to keep things short.', 'events-manager'). ' '. sprintf(__( 'This uses a slightly different format to the others on here, for a list of characters to use, visit the <a href="%s">reference page</a>', 'events-manager'),'https://flatpickr.js.org/formatting/#date-formatting-tokens') );
|
191 |
+
?>
|
192 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Category', 'events-manager'); ?></h5></td></tr>
|
193 |
+
<?php
|
194 |
+
em_options_radio_binary ( __( 'Show categories?', 'events-manager'), 'dbem_search_form_categories', '', '', '#dbem_search_form_category_label_row, #dbem_search_form_categories_label_row' );
|
195 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_category_label', __('Appears as the label for this search option.','events-manager') );
|
196 |
+
em_options_input_text ( __( 'Search Filter Label', 'events-manager'), 'dbem_search_form_categories_placeholder', __('Appears on the text search filter above the categories list.','events-manager') );
|
197 |
+
em_options_input_text ( __( 'Categories dropdown label', 'events-manager'), 'dbem_search_form_categories_label', __('Appears as the first default search option.','events-manager') );
|
198 |
+
em_options_input_text ( sprintf(__( 'Include %s', 'events-manager'), __('Categories', 'events-manager')), 'dbem_search_form_categories_include', sprintf(__('Include only these %1$s IDs, for multiple values separate by commas such as %2$s.','events-manager'), __('Category', 'events-manager'), '<code>123,124,125</code>') );
|
199 |
+
em_options_input_text ( sprintf(__( 'Exclude %s', 'events-manager'), __('Categories', 'events-manager')), 'dbem_search_form_categories_exclude', sprintf(__('Include only these %1$s IDs, for multiple values separate by commas such as %2$s.','events-manager'), __('Category', 'events-manager'), '<code>123,124,125</code>').' '.esc_html__('If inclusion rules are entered above, this setting is ignored.', 'events-manager') );
|
200 |
+
?>
|
201 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Tags', 'events-manager'); ?></h5></td></tr>
|
202 |
+
<?php
|
203 |
+
em_options_radio_binary ( __( 'Show tags?', 'events-manager'), 'dbem_search_form_tags', '', '', '#dbem_search_form_tag_label_row, #dbem_search_form_tags_label_row' );
|
204 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_tag_label', __('Appears as the label for this search option.','events-manager') );
|
205 |
+
em_options_input_text ( __( 'Search Filter Label', 'events-manager'), 'dbem_search_form_tags_placeholder', __('Appears on the text search filter above the tags list.','events-manager') );
|
206 |
+
em_options_input_text ( __( 'Tags dropdown label', 'events-manager'), 'dbem_search_form_tags_label', __('Appears as the first default search option.','events-manager') );
|
207 |
+
em_options_input_text ( sprintf(__( 'Include %s', 'events-manager'), __('Tags')), 'dbem_search_form_tags_include', sprintf(__('Include only these %1$s IDs, for multiple values separate by commas such as %2$s.','events-manager'), __('Tag', 'events-manager'), '<code>123,124,125</code>') );
|
208 |
+
em_options_input_text ( sprintf(__( 'Exclude %s', 'events-manager'), __('Tags')), 'dbem_search_form_tags_exclude', sprintf(__('Include only these %1$s IDs, for multiple values separate by commas such as %2$s.','events-manager'), __('Tag', 'events-manager'), '<code>123,124,125</code>').' '.esc_html__('If inclusion rules are entered above, this setting is ignored.', 'events-manager') );
|
209 |
+
?>
|
210 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Geolocation Search', 'events-manager'); ?></h5></td></tr>
|
211 |
+
<?php
|
212 |
+
em_options_radio_binary ( __( 'Show distance options?', 'events-manager'), 'dbem_search_form_geo_units', '', '', '#dbem_search_form_geo_units_label_row, #dbem_search_form_geo_distance_options_row' );
|
213 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_geo_units_label', __('Appears as the label for this search option.','events-manager') );
|
214 |
+
em_options_input_text ( __( 'Distance Values', 'events-manager'), 'dbem_search_form_geo_distance_options', __('The numerical units shown to those searching by distance. Use comma-separated numbers, such as "25,50,100".','events-manager') );
|
215 |
+
?>
|
216 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Country', 'events-manager'); ?></h5></td></tr>
|
217 |
+
<?php
|
218 |
+
em_options_radio_binary ( __( 'Show countries?', 'events-manager'), 'dbem_search_form_countries', '', '', '#dbem_search_form_default_country_row, #dbem_search_form_country_label_row, #dbem_search_form_countries_label_row' );
|
219 |
+
em_options_select ( __( 'Default Country', 'events-manager'), 'dbem_search_form_default_country', em_get_countries(__('no default country', 'events-manager')), __('Search form will be pre-selected with this country.','events-manager') );
|
220 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_country_label', __('Appears as the label for this search option.','events-manager') );
|
221 |
+
em_options_input_text ( __( 'All countries text', 'events-manager'), 'dbem_search_form_countries_label', __('Appears as the first default search option.','events-manager') );
|
222 |
+
?>
|
223 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'Region', 'events-manager'); ?></h5></td></tr>
|
224 |
+
<?php
|
225 |
+
em_options_radio_binary ( __( 'Show regions?', 'events-manager'), 'dbem_search_form_regions', '', '', '#dbem_search_form_region_label_row, #dbem_search_form_regions_label_row' );
|
226 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_region_label', __('Appears as the label for this search option.','events-manager') );
|
227 |
+
em_options_input_text ( __( 'All regions text', 'events-manager'), 'dbem_search_form_regions_label', __('Appears as the first default search option.','events-manager') );
|
228 |
+
?>
|
229 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'State/County', 'events-manager'); ?></h5></td></tr>
|
230 |
+
<?php
|
231 |
+
em_options_radio_binary ( __( 'Show states?', 'events-manager'), 'dbem_search_form_states', '', '', '#dbem_search_form_state_label_row, #dbem_search_form_states_label_row' );
|
232 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_state_label', __('Appears as the label for this search option.','events-manager') );
|
233 |
+
em_options_input_text ( __( 'All states text', 'events-manager'), 'dbem_search_form_states_label', __('Appears as the first default search option.','events-manager') );
|
234 |
+
?>
|
235 |
+
<tr class="em-subheader"><td colspan="2"><h5><?php esc_html_e( 'City/Town', 'events-manager'); ?></h5></td></tr>
|
236 |
+
<?php
|
237 |
+
em_options_radio_binary ( __( 'Show towns/cities?', 'events-manager'), 'dbem_search_form_towns', '', '', '#dbem_search_form_town_label_row, #dbem_search_form_towns_label_row' );
|
238 |
+
em_options_input_text ( __( 'Label', 'events-manager'), 'dbem_search_form_town_label', __('Appears as the label for this search option.','events-manager') );
|
239 |
+
em_options_input_text ( __( 'All towns/cities text', 'events-manager'), 'dbem_search_form_towns_label', __('Appears as the first default search option.','events-manager') );
|
240 |
+
?>
|
241 |
+
</tbody>
|
242 |
+
<?php echo $save_button; ?>
|
243 |
+
</table>
|
244 |
+
</div> <!-- . inside -->
|
245 |
+
</div> <!-- .postbox -->
|
246 |
+
|
247 |
+
<div class="postbox " id="em-opt-date-time" >
|
248 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Date/Time', 'events-manager'); ?> </span></h3>
|
249 |
+
<div class="inside">
|
250 |
+
<p class="em-boxheader"><?php
|
251 |
+
$date_time_format_tip = sprintf(__('Date and Time formats follow the <a href="%s">WordPress time formatting conventions</a>', 'events-manager'), 'http://codex.wordpress.org/Formatting_Date_and_Time');
|
252 |
+
echo $date_time_format_tip;
|
253 |
+
?></p>
|
254 |
+
<table class="form-table">
|
255 |
+
<?php
|
256 |
+
em_options_input_text ( __( 'Date Format', 'events-manager'), 'dbem_date_format', sprintf(__('For use with the %s placeholder','events-manager'),'<code>#_EVENTDATES</code>') );
|
257 |
+
em_options_input_text ( __( 'Date Picker Format', 'events-manager'), 'dbem_datepicker_format', __('Same as <em>Date Format</em>, but this is used for the datepickers used by Events Manager.', 'events-manager'). ' '. sprintf(__( 'This uses a slightly different format to the others on here, for a list of characters to use, visit the <a href="%s">reference page</a>', 'events-manager'),'https://flatpickr.js.org/formatting/#date-formatting-tokens') );
|
258 |
+
em_options_radio_binary ( __( 'Separate Range Inputs?', 'events-manager'), 'dbem_dates_range_double_inputs', __('When submitting events, you can choose to use a single date picker for start/end dates, or separate fields for each date.', 'events-manager') );
|
259 |
+
// Legacy jQuery UI DatePicker setting, disabled to not confuse ppl
|
260 |
+
//em_options_input_text ( __( 'Date Picker Format (legacy)', 'events-manager'), 'dbem_date_format_js', sprintf(__( 'Same as <em>Date Format</em>, but this is used for the datepickers used by Events Manager. This uses a slightly different format to the others on here, for a list of characters to use, visit the <a href="%s">jQuery formatDate reference</a>', 'events-manager'),'https://api.jqueryui.com/datepicker/#utility-formatDate') );
|
261 |
+
em_options_input_text ( __( 'Date Separator', 'events-manager'), 'dbem_dates_separator', sprintf(__( 'For when start/end %s are present, this will separate the two (include spaces here if necessary).', 'events-manager'), __('dates','events-manager')) );
|
262 |
+
em_options_input_text ( __( 'Time Format', 'events-manager'), 'dbem_time_format', sprintf(__('For use with the %s placeholder','events-manager'),'<code>#_EVENTTIMES</code>') );
|
263 |
+
em_options_input_text ( __( 'Time Separator', 'events-manager'), 'dbem_times_separator', sprintf(__( 'For when start/end %s are present, this will separate the two (include spaces here if necessary).', 'events-manager'), __('times','events-manager')) );
|
264 |
+
em_options_input_text ( __( 'All Day Message', 'events-manager'), 'dbem_event_all_day_message', sprintf(__( 'If an event lasts all day, this text will show if using the %s placeholder', 'events-manager'), '<code>#_EVENTTIMES</code>') );
|
265 |
+
em_options_radio_binary ( __( 'Use 24h Format?', 'events-manager'), 'dbem_time_24h', __( 'When creating events, would you like your times to be shown in 24 hour format?', 'events-manager') );
|
266 |
+
echo $save_button;
|
267 |
+
?>
|
268 |
+
</table>
|
269 |
+
</div> <!-- . inside -->
|
270 |
+
</div> <!-- .postbox -->
|
271 |
+
|
272 |
+
<div class="postbox " id="em-opt-calendar-formats" >
|
273 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Calendar', 'events-manager'); ?></span></h3>
|
274 |
+
<div class="inside">
|
275 |
+
<table class="form-table">
|
276 |
+
<?php
|
277 |
+
em_options_radio_binary ( __( 'Link directly to event on day with single event?', 'events-manager'), 'dbem_calendar_direct_links', __( "If a calendar day has only one event, you can force a direct link to the event (recommended to avoid duplicate content).",'events-manager') );
|
278 |
+
em_options_radio_binary ( __( 'Show list on day with single event?', 'events-manager'), 'dbem_display_calendar_day_single', __( "By default, if a calendar day only has one event, it display a single event when clicking on the link of that calendar date. If you select Yes here, you will get always see a list of events.",'events-manager') );
|
279 |
+
em_options_input_text ( __( 'Month format', 'events-manager'), 'dbem_full_calendar_month_format', __('The format of the month/year header of the calendar.','events-manager').' '.$date_time_format_tip);
|
280 |
+
em_options_input_text ( __( 'Event format', 'events-manager'), 'dbem_calendar_large_pill_format', __( 'The format of each event when displayed in the full calendar.', 'events-manager').$events_placeholder_tip .' <br>'.
|
281 |
+
sprintf(esc_html__('The setting above is new, due to our new calendar display options. Your previous format was %s', 'events-manager'), '<code>'. get_option('dbem_full_calendar_event_format') .'</code>' )
|
282 |
+
);
|
283 |
+
?>
|
284 |
+
|
285 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Preview Formats','events-manager'); ?></h4></td></tr>
|
286 |
+
<?php
|
287 |
+
em_options_select( __( 'Event Preview Mode', 'events-manager'), 'dbem_calendar_preview_mode', array('tooltips' => esc_html__('Tooltip', 'events-manager'), 'modal' => esc_html__('Modal Popup', 'events-manager'), 'none' => esc_html__('No Preview', 'events-manager')), __( 'Choose how to show a information about an event when clicking or hovering over a single event on the calendar.','events-manager') );
|
288 |
+
em_options_select( __( 'Date Preview Mode', 'events-manager'), 'dbem_calendar_preview_mode_date', array('modal' => esc_html__('Modal Popup', 'events-manager'), 'none' => esc_html__('Direct Link', 'events-manager')), __( 'Choose whether to show a preview of the upcoming events for the date clicked on, or directly link to the calendar day.','events-manager') );
|
289 |
+
?>
|
290 |
+
|
291 |
+
<!-- ADVANCED Formatting -->
|
292 |
+
<tbody class="am-af">
|
293 |
+
<?php
|
294 |
+
em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[calendar-previews]', '', '', '.am-af-calendar-previews' );
|
295 |
+
?>
|
296 |
+
</tbody>
|
297 |
+
<tbody class="am-af am-af-calendar-previews">
|
298 |
+
<?php
|
299 |
+
em_options_textarea ( __( 'Event modal preview format', 'events-manager'), 'dbem_calendar_preview_modal_event_format', sprintf(esc_html__( 'Used to show a single event when preview mode is set to %s.', 'events-manager'), '<code>'.esc_html__('Modal Popup', 'events-manager').'</code>'), true );
|
300 |
+
em_options_textarea ( __( 'Event tooltip preview format', 'events-manager'), 'dbem_calendar_preview_tooltip_event_format', sprintf(esc_html__( 'Used to show a single event when preview mode is set to %s.', 'events-manager'), '<code>'.esc_html__('Tooltip', 'events-manager').'</code>'), true );
|
301 |
+
em_options_textarea ( __( 'Events date modal preview format', 'events-manager'), 'dbem_calendar_preview_modal_date_format', esc_html__( 'Used to format each event in a list when previewing a single date in a modal popup.', 'events-manager'), true );
|
302 |
+
?>
|
303 |
+
</tbody>
|
304 |
+
<!-- /ADVANCED Formatting -->
|
305 |
+
|
306 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Full-Size Calendar','events-manager'); ?></h4></td></tr>
|
307 |
+
<?php
|
308 |
+
$large_tip = sprintf(esc_html__('This setting will be applied if you choose to specifically show a size %s calendar.', 'events-manager'), esc_html__('large', 'events-manager'));
|
309 |
+
$large_tip .= ' ' . esc_html__('This is also the default setting for responsive calendars without a fixed size.', 'events-manager');
|
310 |
+
em_options_radio_binary( __( 'Abbreviated weekdays?', 'events-manager'), 'dbem_full_calendar_abbreviated_weekdays', __( 'Use abbreviations, e.g. Friday = Fri. Useful for certain languages where abbreviations differ from full names.','events-manager') );
|
311 |
+
em_options_input_text ( __( 'Initial lengths', 'events-manager'), 'dbem_full_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'events-manager').$events_placeholder_tip);
|
312 |
+
em_options_radio_binary( __( 'Show Long Events?', 'events-manager'), 'dbem_full_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','events-manager') );
|
313 |
+
?>
|
314 |
+
<tr class="em-header"><td colspan="2"><h4><?php _e('Small Calendar','events-manager'); ?></h4></td></tr>
|
315 |
+
<?php
|
316 |
+
$small_tip = sprintf(esc_html__('This setting will be applied if you choose to specifically show a fixed-size %s calendar.', 'events-manager'), esc_html__('small', 'events-manager'));
|
317 |
+
em_options_radio_binary( __( 'Abbreviated weekdays', 'events-manager'), 'dbem_small_calendar_abbreviated_weekdays', __( 'The calendar headings uses abbreviated weekdays','events-manager') );
|
318 |
+
em_options_input_text ( __( 'Initial lengths', 'events-manager'), 'dbem_small_calendar_initials_length', __( 'Shorten the calendar headings containing the days of the week, use 0 for the full name.', 'events-manager').$events_placeholder_tip );
|
319 |
+
em_options_radio_binary( __( 'Show Long Events?', 'events-manager'), 'dbem_small_calendar_long_events', __( 'Events with multiple dates will appear on each of those dates in the calendar.','events-manager'). ' '. $small_tip );
|
320 |
+
?>
|
321 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo __('Calendar Day Event List Settings','events-manager'); ?></h4></td></tr>
|
322 |
+
<tr valign="top" id='dbem_display_calendar_orderby_row'>
|
323 |
+
<th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
|
324 |
+
<td>
|
325 |
+
<select name="dbem_display_calendar_orderby" >
|
326 |
+
<?php
|
327 |
+
$orderby_options = apply_filters('dbem_display_calendar_orderby_ddm', array(
|
328 |
+
'event_name,event_start_time' => __('Order by event name, then event start time','events-manager'),
|
329 |
+
'event_start_time,event_name' => __('Order by event start time, then event name','events-manager')
|
330 |
+
));
|
331 |
+
?>
|
332 |
+
<?php foreach($orderby_options as $key => $value) : ?>
|
333 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_display_calendar_orderby')) ? "selected='selected'" : ''; ?>>
|
334 |
+
<?php echo esc_html($value) ?>
|
335 |
+
</option>
|
336 |
+
<?php endforeach; ?>
|
337 |
+
</select>
|
338 |
+
<select name="dbem_display_calendar_order" >
|
339 |
+
<?php
|
340 |
+
$ascending = __('Ascending','events-manager');
|
341 |
+
$descending = __('Descending','events-manager');
|
342 |
+
$order_options = apply_filters('dbem_display_calendar_order_ddm', array(
|
343 |
+
'ASC' => __('All Ascending','events-manager'),
|
344 |
+
'DESC,ASC' => "$descending, $ascending",
|
345 |
+
'DESC,DESC' => "$descending, $descending",
|
346 |
+
'DESC' => __('All Descending','events-manager')
|
347 |
+
));
|
348 |
+
?>
|
349 |
+
<?php foreach( $order_options as $key => $value) : ?>
|
350 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_display_calendar_order')) ? "selected='selected'" : ''; ?>>
|
351 |
+
<?php echo esc_html($value) ?>
|
352 |
+
</option>
|
353 |
+
<?php endforeach; ?>
|
354 |
+
</select>
|
355 |
+
<br/>
|
356 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
357 |
+
</td>
|
358 |
+
</tr>
|
359 |
+
<?php
|
360 |
+
em_options_input_text ( __( 'Calendar events/day limit', 'events-manager'), 'dbem_display_calendar_events_limit', __( 'Limits the number of events on each calendar day. Leave blank for no limit.', 'events-manager') );
|
361 |
+
em_options_input_text ( __( 'More Events message', 'events-manager'), 'dbem_display_calendar_events_limit_msg', __( 'Text with link to calendar day page with all events for that day if there are more events than the limit above, leave blank for no link as the day number is also a link.', 'events-manager') );
|
362 |
+
?>
|
363 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('iCal Feed Settings','events-manager'),__('Event','events-manager')); ?></h4></td></tr>
|
364 |
+
<?php
|
365 |
+
em_options_input_text ( __( 'iCal Title', 'events-manager'), 'dbem_ical_description_format', __( 'The title that will appear in the calendar.', 'events-manager').$events_placeholder_tip );
|
366 |
+
em_options_input_text ( __( 'iCal Description', 'events-manager'), 'dbem_ical_real_description_format', __( 'The description of the event that will appear in the calendar.', 'events-manager').$events_placeholder_tip );
|
367 |
+
em_options_input_text ( __( 'iCal Location', 'events-manager'), 'dbem_ical_location_format', __( 'The location information that will appear in the calendar.', 'events-manager').$events_placeholder_tip );
|
368 |
+
em_options_select( __('iCal Scope','events-manager'), 'dbem_ical_scope', em_get_scopes(), __('Choose to show events within a specific time range.','events-manager'));
|
369 |
+
em_options_input_text ( __( 'iCal Limit', 'events-manager'), 'dbem_ical_limit', __( 'Limits the number of future events shown (0 = unlimited).', 'events-manager') );
|
370 |
+
echo $save_button;
|
371 |
+
?>
|
372 |
+
</table>
|
373 |
+
</div> <!-- . inside -->
|
374 |
+
</div> <!-- .postbox -->
|
375 |
+
|
376 |
+
<?php if( get_option('dbem_locations_enabled') ): ?>
|
377 |
+
<div class="postbox " id="em-opt-locations-formats" >
|
378 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Locations', 'events-manager'); ?> </span></h3>
|
379 |
+
<div class="inside">
|
380 |
+
<table class="form-table">
|
381 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','events-manager'),__('Locations','events-manager')); ?></h4></td></tr>
|
382 |
+
<?php
|
383 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('Locations','events-manager')), 'dbem_no_locations_message', sprintf( __( 'The message displayed when no %s are available.', 'events-manager'), __('locations','events-manager')) );
|
384 |
+
?>
|
385 |
+
|
386 |
+
<!-- ADVANCED Formatting -->
|
387 |
+
<tbody class="am-af">
|
388 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[locations-list]', '', '', '.am-af-locations-list' ); ?>
|
389 |
+
</tbody>
|
390 |
+
<tbody class="am-af am-af-locations-list">
|
391 |
+
<?php
|
392 |
+
em_options_textarea ( sprintf(__('%s list header format','events-manager'),__('Locations','events-manager')), 'dbem_location_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'events-manager'), __('locations','events-manager')), true );
|
393 |
+
em_options_textarea ( sprintf(__('%s list item format','events-manager'),__('Locations','events-manager')), 'dbem_location_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'events-manager'), __('locations','events-manager')).$locations_placeholder_tip, true );
|
394 |
+
em_options_textarea ( sprintf(__('%s list footer format','events-manager'),__('Locations','events-manager')), 'dbem_location_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'events-manager'), __('locations','events-manager')), true );
|
395 |
+
?>
|
396 |
+
</tbody>
|
397 |
+
<!-- /ADVANCED Formatting -->
|
398 |
+
|
399 |
+
<!-- ADVANCED Formatting -->
|
400 |
+
<tbody class="am-af">
|
401 |
+
<tr class="em-header">
|
402 |
+
<td colspan="2">
|
403 |
+
<h4><?php echo sprintf(__('Single %s Page','events-manager'),__('Location','events-manager')); ?></h4>
|
404 |
+
<em><?php echo sprintf(__('These formats can be used on %s pages or on other areas of your site displaying an %s.','events-manager'),__('location','events-manager'),__('location','events-manager'));?></em>
|
405 |
+
</td>
|
406 |
+
</tr>
|
407 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[location-single]', '', '', '.am-af-location-single' ); ?>
|
408 |
+
</tbody>
|
409 |
+
<tbody class="am-af am-af-location-single">
|
410 |
+
<?php
|
411 |
+
if( EM_MS_GLOBAL && get_option('dbem_ms_global_location_links') ){
|
412 |
+
em_options_input_text (sprintf( __( 'Single %s title format', 'events-manager'),__('location','events-manager')), 'dbem_location_page_title_format', sprintf(__( 'The format of a single %s page title.', 'events-manager'),__('location','events-manager')).$locations_placeholder_tip );
|
413 |
+
}
|
414 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'events-manager'),__('location','events-manager')), 'dbem_single_location_format', sprintf(__( 'The format of a single %s page.', 'events-manager'),__('location','events-manager')).$locations_placeholder_tip, true );
|
415 |
+
?>
|
416 |
+
</tbody>
|
417 |
+
<!-- /ADVANCED Formatting -->
|
418 |
+
|
419 |
+
<!-- ADVANCED Formatting -->
|
420 |
+
<tbody class="am-af">
|
421 |
+
<tr class="em-header">
|
422 |
+
<td colspan="2">
|
423 |
+
<h4><?php echo sprintf(__('%s Excerpts','events-manager'),__('Location','events-manager')); ?></h4>
|
424 |
+
<em><?php echo sprintf(__('These formats can be used when WordPress automatically displays %s excerpts on your site and %s is enabled in your %s settings tab.','events-manager'),__('location','events-manager'),'<strong>'.__( 'Override Excerpts with Formats?', 'events-manager').'</strong>','<a href="#formats" class="nav-tab-link" rel="#em-menu-pages">'.__('Pages','events-manager').' > '.sprintf(__('%s List/Archives','events-manager'),__('Location','events-manager')).'</a>');?></em>
|
425 |
+
</td>
|
426 |
+
</tr>
|
427 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[location-excerpt]', '', '', '.am-af-location-excerpt' ); ?>
|
428 |
+
</tbody>
|
429 |
+
<tbody class="am-af am-af-location-excerpt">
|
430 |
+
<?php
|
431 |
+
em_options_textarea ( sprintf(__('%s excerpt', 'events-manager'),__('Location','events-manager')), 'dbem_location_excerpt_format', __( 'Used if an excerpt has been defined.', 'events-manager').$locations_placeholder_tip, true );
|
432 |
+
em_options_textarea ( sprintf(__('%s excerpt fallback', 'events-manager'),__('Location','events-manager')), 'dbem_location_excerpt_alt_format', __( 'Used if an excerpt has not been defined.', 'events-manager').$locations_placeholder_tip, true );
|
433 |
+
?>
|
434 |
+
</tbody>
|
435 |
+
<!-- /ADVANCED Formatting -->
|
436 |
+
|
437 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','events-manager'),__('Event','events-manager')); ?></h4></td></tr>
|
438 |
+
<?php
|
439 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('events','events-manager')), 'dbem_location_no_events_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'events-manager'), '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>') );
|
440 |
+
?>
|
441 |
+
|
442 |
+
<!-- ADVANCED Formatting -->
|
443 |
+
<tbody class="am-af">
|
444 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[location-event-lists]', '', '', '.am-af-location-event-lists' ); ?>
|
445 |
+
</tbody>
|
446 |
+
<tbody class="am-af am-af-location-event-lists">
|
447 |
+
<?php
|
448 |
+
em_options_input_text ( __( 'Default event list format header', 'events-manager'), 'dbem_location_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'events-manager') , '', true );
|
449 |
+
em_options_textarea ( sprintf(__( 'Default %s list format', 'events-manager'),__('events','events-manager')), 'dbem_location_event_list_item_format', sprintf(__( 'The format of the events the list inserted in the location page through the %s element.', 'events-manager').$events_placeholder_tip, '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>') , true );
|
450 |
+
em_options_input_text ( __( 'Default event list format footer', 'events-manager'), 'dbem_location_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'events-manager') , '', true );
|
451 |
+
?>
|
452 |
+
</tbody>
|
453 |
+
<!-- /ADVANCED Formatting -->
|
454 |
+
|
455 |
+
<tr class="em-header"><td colspan="2">
|
456 |
+
<h4><?php echo sprintf(__('Single %s Format','events-manager'),__('Event','events-manager')); ?></h4>
|
457 |
+
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','events-manager'), '<code>#_LOCATIONNEXTEVENT</code>'); ?></p>
|
458 |
+
</td></tr>
|
459 |
+
<?php
|
460 |
+
em_options_input_text ( __( 'Next event format', 'events-manager'), 'dbem_location_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'events-manager'),__('location','events-manager')).$events_placeholder_tip );
|
461 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('events','events-manager')), 'dbem_location_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'events-manager'), '<code>#_LOCATIONNEXTEVENT</code>') );
|
462 |
+
echo $save_button;
|
463 |
+
?>
|
464 |
+
</table>
|
465 |
+
</div> <!-- . inside -->
|
466 |
+
</div> <!-- .postbox -->
|
467 |
+
<?php endif; ?>
|
468 |
+
|
469 |
+
<?php if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ): ?>
|
470 |
+
<div class="postbox " id="em-opt-categories-formats" >
|
471 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Categories', 'events-manager'); ?> </span></h3>
|
472 |
+
<div class="inside">
|
473 |
+
<table class="form-table">
|
474 |
+
<?php
|
475 |
+
em_options_input_text(sprintf(esc_html__('Default %s color','events-manager'), esc_html__('category','events-manager')), 'dbem_category_default_color', sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>'));
|
476 |
+
?>
|
477 |
+
|
478 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','events-manager'),__('Categories','events-manager')); ?></h4></td></tr>
|
479 |
+
<?php
|
480 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('Categories','events-manager')), 'dbem_no_categories_message', sprintf( __( 'The message displayed when no %s are available.', 'events-manager'), __('categories','events-manager')) );
|
481 |
+
?>
|
482 |
+
|
483 |
+
<!-- ADVANCED Formatting -->
|
484 |
+
<tbody class="am-af">
|
485 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[categories-list]', '', '', '.am-af-categories-list' ); ?>
|
486 |
+
</tbody>
|
487 |
+
<tbody class="am-af am-af-categories-list">
|
488 |
+
<?php
|
489 |
+
em_options_textarea ( sprintf(__('%s list header format','events-manager'),__('Categories','events-manager')), 'dbem_categories_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'events-manager'), __('categories','events-manager')), true );
|
490 |
+
em_options_textarea ( sprintf(__('%s list item format','events-manager'),__('Categories','events-manager')), 'dbem_categories_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'events-manager'), __('categories','events-manager')).$categories_placeholder_tip, true );
|
491 |
+
em_options_textarea ( sprintf(__('%s list footer format','events-manager'),__('Categories','events-manager')), 'dbem_categories_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'events-manager'), __('categories','events-manager')), true );
|
492 |
+
?>
|
493 |
+
</tbody>
|
494 |
+
<!-- /ADVANCED Formatting -->
|
495 |
+
|
496 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('Single %s Page','events-manager'),__('Category','events-manager')); ?></h4></td></tr>
|
497 |
+
<?php
|
498 |
+
em_options_input_text ( sprintf(__( 'Single %s title format', 'events-manager'),__('category','events-manager')), 'dbem_category_page_title_format', __( 'The format of a single category page title.', 'events-manager').$categories_placeholder_tip );
|
499 |
+
?>
|
500 |
+
|
501 |
+
<!-- ADVANCED Formatting -->
|
502 |
+
<tbody class="am-af">
|
503 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[category-single]', '', '', '.am-af-category-single' ); ?>
|
504 |
+
</tbody>
|
505 |
+
<tbody class="am-af am-af-category-single">
|
506 |
+
<?php
|
507 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'events-manager'),__('category','events-manager')), 'dbem_category_page_format', sprintf(__( 'The format of a single %s page.', 'events-manager'),__('category','events-manager')).$categories_placeholder_tip, true );
|
508 |
+
?>
|
509 |
+
</tbody>
|
510 |
+
<!-- /ADVANCED Formatting -->
|
511 |
+
|
512 |
+
|
513 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','events-manager'),__('Event','events-manager')); ?></h4></td></tr>
|
514 |
+
<?php
|
515 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('events','events-manager')), 'dbem_category_no_events_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'events-manager'), '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>') );
|
516 |
+
?>
|
517 |
+
|
518 |
+
<!-- ADVANCED Formatting -->
|
519 |
+
<tbody class="am-af">
|
520 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[category-events-list]', '', '', '.am-af-category-events-list' ); ?>
|
521 |
+
</tbody>
|
522 |
+
<tbody class="am-af am-af-category-events-list">
|
523 |
+
<?php
|
524 |
+
em_options_input_text ( __( 'Default event list format header', 'events-manager'), 'dbem_category_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'events-manager'), '', true );
|
525 |
+
em_options_textarea ( sprintf(__( 'Default %s list format', 'events-manager'),__('events','events-manager')), 'dbem_category_event_list_item_format', sprintf(__( 'The format of the events the list inserted in the category page through the %s element.', 'events-manager').$events_placeholder_tip, '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>'), true );
|
526 |
+
em_options_input_text ( __( 'Default event list format footer', 'events-manager'), 'dbem_category_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'events-manager'), '', true );
|
527 |
+
?>
|
528 |
+
</tbody>
|
529 |
+
<!-- /ADVANCED Formatting -->
|
530 |
+
|
531 |
+
<tr class="em-header"><td colspan="2">
|
532 |
+
<h4><?php echo sprintf(__('Single %s Format','events-manager'),__('Event','events-manager')); ?></h4>
|
533 |
+
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','events-manager'), '<code>#_CATEGORYNEXTEVENT</code>'); ?></p>
|
534 |
+
</td></tr>
|
535 |
+
<?php
|
536 |
+
em_options_input_text ( __( 'Next event format', 'events-manager'), 'dbem_category_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'events-manager'),__('category','events-manager')).$events_placeholder_tip );
|
537 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('events','events-manager')), 'dbem_category_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'events-manager'), '<code>#_CATEGORYNEXTEVENT</code>') );
|
538 |
+
echo $save_button;
|
539 |
+
?>
|
540 |
+
</table>
|
541 |
+
</div> <!-- . inside -->
|
542 |
+
</div> <!-- .postbox -->
|
543 |
+
<?php endif; ?>
|
544 |
+
|
545 |
+
<?php if( get_option('dbem_tags_enabled') ): ?>
|
546 |
+
<div class="postbox " id="em-opt-tags-formats" >
|
547 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Tags', 'events-manager'); ?> </span></h3>
|
548 |
+
<div class="inside">
|
549 |
+
<table class="form-table">
|
550 |
+
<?php
|
551 |
+
em_options_input_text(sprintf(esc_html__('Default %s color','events-manager'), esc_html__('tag','events-manager')), 'dbem_tag_default_color', sprintf(esc_html_x('Colors must be in a valid %s format, such as #FF00EE.', 'hex format', 'events-manager'), '<a href="http://en.wikipedia.org/wiki/Web_colors">hex</a>'));
|
552 |
+
?>
|
553 |
+
|
554 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s Page','events-manager'),__('Tags','events-manager')); ?></h4></td></tr>
|
555 |
+
<?php
|
556 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('Tags','events-manager')), 'dbem_no_tags_message', sprintf( __( 'The message displayed when no %s are available.', 'events-manager'), __('tags','events-manager')) );
|
557 |
+
?>
|
558 |
+
|
559 |
+
<!-- ADVANCED Formatting -->
|
560 |
+
<tbody class="am-af">
|
561 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[tags-list]', '', '', '.am-af-tags-list' ); ?>
|
562 |
+
</tbody>
|
563 |
+
<tbody class="am-af am-af-tags-list">
|
564 |
+
<?php
|
565 |
+
em_options_textarea ( sprintf(__('%s list header format','events-manager'),__('Tags','events-manager')), 'dbem_tags_list_item_format_header', sprintf(__( 'This content will appear just above your code for the %s list format below. Default is blank', 'events-manager'), __('tags','events-manager')), true );
|
566 |
+
em_options_textarea ( sprintf(__('%s list item format','events-manager'),__('Tags','events-manager')), 'dbem_tags_list_item_format', sprintf(__( 'The format of a single %s in a list.', 'events-manager'), __('tags','events-manager')).$categories_placeholder_tip, true);
|
567 |
+
em_options_textarea ( sprintf(__('%s list footer format','events-manager'),__('Tags','events-manager')), 'dbem_tags_list_item_format_footer', sprintf(__( 'This content will appear just below your code for the %s list format above. Default is blank', 'events-manager'), __('tags','events-manager')), true );
|
568 |
+
?>
|
569 |
+
</tbody>
|
570 |
+
<!-- /ADVANCED Formatting -->
|
571 |
+
|
572 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('Single %s Page','events-manager'),__('Tag','events-manager')); ?></h4></td></tr>
|
573 |
+
<?php em_options_input_text ( sprintf(__( 'Single %s title format', 'events-manager'),__('tag','events-manager')), 'dbem_tag_page_title_format', __( 'The format of a single tag page title.', 'events-manager').$categories_placeholder_tip ); ?>
|
574 |
+
|
575 |
+
<!-- ADVANCED Formatting -->
|
576 |
+
<tbody class="am-af">
|
577 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[tag-single]', '', '', '.am-af-tag-single' ); ?>
|
578 |
+
</tbody>
|
579 |
+
<tbody class="am-af am-af-tag-single">
|
580 |
+
<?php
|
581 |
+
em_options_textarea ( sprintf(__('Single %s page format', 'events-manager'),__('tag','events-manager')), 'dbem_tag_page_format', sprintf(__( 'The format of a single %s page.', 'events-manager'),__('tag','events-manager')).$categories_placeholder_tip, true );
|
582 |
+
?>
|
583 |
+
</tbody>
|
584 |
+
<!-- /ADVANCED Formatting -->
|
585 |
+
|
586 |
+
<tr class="em-header"><td colspan="2"><h4><?php echo sprintf(__('%s List Formats','events-manager'),__('Event','events-manager')); ?></h4></td></tr>
|
587 |
+
<?php
|
588 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('events','events-manager')), 'dbem_tag_no_events_message', __( 'The message to be displayed in the list generated by <code>#_TAGNEXTEVENTS</code>, <code>#_TAGNEXTEVENTS</code> and <code>#_TAGALLEVENTS</code> when no events are available.', 'events-manager') );
|
589 |
+
?>
|
590 |
+
|
591 |
+
<!-- ADVANCED Formatting -->
|
592 |
+
<tbody class="am-af">
|
593 |
+
|
594 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[tag-events-list]', '', '', '.am-af-tag-events-list' ); ?>
|
595 |
+
</tbody>
|
596 |
+
<tbody class="am-af am-af-tag-events-list">
|
597 |
+
<?php
|
598 |
+
em_options_input_text ( __( 'Default event list format header', 'events-manager'), 'dbem_tag_event_list_item_header_format', __( 'This content will appear just above your code for the default event list format. Default is blank', 'events-manager'), '', true );
|
599 |
+
em_options_textarea ( sprintf(__( 'Default %s list format', 'events-manager'),__('events','events-manager')), 'dbem_tag_event_list_item_format', __( 'The format of the events the list inserted in the tag page through the <code>#_TAGNEXTEVENTS</code>, <code>#_TAGNEXTEVENTS</code> and <code>#_TAGALLEVENTS</code> element.', 'events-manager').$categories_placeholder_tip, true );
|
600 |
+
em_options_input_text ( __( 'Default event list format footer', 'events-manager'), 'dbem_tag_event_list_item_footer_format', __( 'This content will appear just below your code for the default event list format. Default is blank', 'events-manager'), '', true );
|
601 |
+
?>
|
602 |
+
</tbody>
|
603 |
+
<!-- /ADVANCED Formatting -->
|
604 |
+
|
605 |
+
<tr class="em-header"><td colspan="2">
|
606 |
+
<h4><?php echo sprintf(__('Single %s Format','events-manager'),__('Event','events-manager')); ?></h4>
|
607 |
+
<p><?php echo sprintf(__('The settings below are used when using the %s placeholder','events-manager'), '<code>#_TAGNEXTEVENT</code>'); ?></p>
|
608 |
+
</td></tr>
|
609 |
+
<?php
|
610 |
+
em_options_input_text ( __( 'Next event format', 'events-manager'), 'dbem_tag_event_single_format', sprintf(__( 'The format of the next upcoming event in this %s.', 'events-manager'),__('tag','events-manager')).$events_placeholder_tip );
|
611 |
+
em_options_input_text ( sprintf(__( 'No %s message', 'events-manager'),__('events','events-manager')), 'dbem_tag_no_event_message', sprintf(__( 'The message to be displayed in the list generated by %s when no events are available.', 'events-manager'), '<code>#_CATEGORYNEXTEVENT</code>') );
|
612 |
+
echo $save_button;
|
613 |
+
?>
|
614 |
+
</table>
|
615 |
+
</div> <!-- . inside -->
|
616 |
+
</div> <!-- .postbox -->
|
617 |
+
<?php endif; ?>
|
618 |
+
|
619 |
+
<div class="postbox " id="em-opt-rss-formats" >
|
620 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'RSS', 'events-manager'); ?> </span></h3>
|
621 |
+
<div class="inside">
|
622 |
+
<table class="form-table">
|
623 |
+
<?php
|
624 |
+
em_options_input_text ( __( 'RSS main title', 'events-manager'), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'events-manager').$events_placeholder_tip );
|
625 |
+
em_options_input_text ( __( 'RSS main description', 'events-manager'), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'events-manager') );
|
626 |
+
em_options_input_text ( __( 'RSS title format', 'events-manager'), 'dbem_rss_title_format', __( 'The format of the title of each item in the events RSS feed.', 'events-manager').$events_placeholder_tip );
|
627 |
+
em_options_input_text ( __( 'RSS description format', 'events-manager'), 'dbem_rss_description_format', __( 'The format of the description of each item in the events RSS feed.', 'events-manager').$events_placeholder_tip );
|
628 |
+
em_options_input_text ( __( 'RSS limit', 'events-manager'), 'dbem_rss_limit', __( 'Limits the number of future events shown (0 = unlimited).', 'events-manager') );
|
629 |
+
em_options_select( __('RSS Scope','events-manager'), 'dbem_rss_scope', em_get_scopes(), __('Choose to show events within a specific time range.','events-manager'));
|
630 |
+
?>
|
631 |
+
<tr valign="top" id='dbem_rss_orderby_row'>
|
632 |
+
<th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
|
633 |
+
<td>
|
634 |
+
<select name="dbem_rss_orderby" >
|
635 |
+
<?php
|
636 |
+
$orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
|
637 |
+
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','events-manager'),
|
638 |
+
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','events-manager'),
|
639 |
+
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','events-manager'),
|
640 |
+
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','events-manager'),
|
641 |
+
));
|
642 |
+
?>
|
643 |
+
<?php foreach($orderby_options as $key => $value) : ?>
|
644 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_rss_orderby')) ? "selected='selected'" : ''; ?>>
|
645 |
+
<?php echo esc_html($value); ?>
|
646 |
+
</option>
|
647 |
+
<?php endforeach; ?>
|
648 |
+
</select>
|
649 |
+
<select name="dbem_rss_order" >
|
650 |
+
<?php
|
651 |
+
$ascending = __('Ascending','events-manager');
|
652 |
+
$descending = __('Descending','events-manager');
|
653 |
+
$order_options = apply_filters('em_settings_events_default_order_ddm', array(
|
654 |
+
'ASC' => __('All Ascending','events-manager'),
|
655 |
+
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'events-manager'),
|
656 |
+
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'events-manager'),
|
657 |
+
'DESC' => __('All Descending','events-manager'),
|
658 |
+
'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'events-manager'),
|
659 |
+
'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'events-manager'),
|
660 |
+
'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'events-manager'),
|
661 |
+
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'events-manager'),
|
662 |
+
));
|
663 |
+
?>
|
664 |
+
<?php foreach( $order_options as $key => $value) : ?>
|
665 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_rss_order')) ? "selected='selected'" : ''; ?>>
|
666 |
+
<?php echo esc_html($value); ?>
|
667 |
+
</option>
|
668 |
+
<?php endforeach; ?>
|
669 |
+
</select>
|
670 |
+
<br/>
|
671 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
672 |
+
</td>
|
673 |
+
</tr>
|
674 |
+
<?php
|
675 |
+
echo $save_button;
|
676 |
+
?>
|
677 |
+
</table>
|
678 |
+
</div> <!-- . inside -->
|
679 |
+
</div> <!-- .postbox -->
|
680 |
+
|
681 |
+
<div class="postbox " id="em-opt-maps-formats" >
|
682 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Maps', 'events-manager'); ?> </span></h3>
|
683 |
+
<div class="inside">
|
684 |
+
<p class="em-boxheader"><?php echo sprintf(__('You can use Google Maps to show where your events are located. For more information on using maps, <a href="%s">see our documentation</a>.','events-manager'),'http://wp-events-plugin.com/documentation/google-maps/'); ?>
|
685 |
+
<table class='form-table'>
|
686 |
+
<tr valign="top">
|
687 |
+
<?php em_options_input_text(__('Default map width','events-manager'), 'dbem_map_default_width', sprintf(__('Can be in form of pixels or a percentage such as %s or %s.', 'events-manager'), '<code>100%</code>', '<code>100px</code>')); ?>
|
688 |
+
<?php em_options_input_text(__('Default map height','events-manager'), 'dbem_map_default_height', sprintf(__('Can be in form of pixels or a percentage such as %s or %s.', 'events-manager'), '<code>100%</code>', '<code>100px</code>')); ?>
|
689 |
+
</tr>
|
690 |
+
|
691 |
+
<!-- ADVANCED Formatting -->
|
692 |
+
<tbody class="am-af">
|
693 |
+
<?php em_options_radio_binary ( __( 'Override Default Formats?', 'events-manager'), 'dbem_advanced_formatting_modes[maps]', '', '', '.am-af-maps' ); ?>
|
694 |
+
</tbody>
|
695 |
+
<tbody class="am-af am-af-maps">
|
696 |
+
<tr class="em-header"><td colspan="2">
|
697 |
+
<h4><?php _e('Global Map Format','events-manager'); ?></h4>
|
698 |
+
<p><?php echo sprintf(__('If you use the %s <a href="%s">shortcode</a>, you can display a map of all your locations and events, the settings below will be used.','events-manager'), '<code>[locations_map]</code>','http://wp-events-plugin.com/documentation/shortcodes/'); ?></p>
|
699 |
+
</td></tr>
|
700 |
+
<?php
|
701 |
+
em_options_textarea ( __( 'Location balloon format', 'events-manager'), 'dbem_map_text_format', __( 'The format of the text appearing in the balloon describing the location.', 'events-manager').' '.__( 'Event.', 'events-manager').$locations_placeholder_tip, true );
|
702 |
+
?>
|
703 |
+
<tr class="em-header"><td colspan="2">
|
704 |
+
<h4><?php _e('Single Location/Event Map Format','events-manager'); ?></h4>
|
705 |
+
<p><?php echo sprintf(_e('If you use the <code>#_LOCATIONMAP</code> <a href="%s">placeholder</a> when displaying individual event and location information, the settings below will be used.','events-manager'), '<code>[locations_map]</code>','http://wp-events-plugin.com/documentation/placeholders/'); ?></p>
|
706 |
+
</td></tr>
|
707 |
+
<?php
|
708 |
+
em_options_textarea ( __( 'Location balloon format', 'events-manager'), 'dbem_location_baloon_format', __( 'The format of the text appearing in the balloon describing the location.', 'events-manager').$events_placeholder_tip, true );
|
709 |
+
?>
|
710 |
+
</tbody>
|
711 |
+
<!-- /ADVANCED Formatting -->
|
712 |
+
|
713 |
+
<?php
|
714 |
+
echo $save_button;
|
715 |
+
?>
|
716 |
+
</table>
|
717 |
+
</div> <!-- . inside -->
|
718 |
+
</div> <!-- .postbox -->
|
719 |
+
|
720 |
+
<?php do_action('em_options_page_footer_formats'); ?>
|
721 |
+
|
722 |
+
</div> <!-- .em-menu-formats -->
|
trunk/admin/settings/tabs/general.php
ADDED
@@ -0,0 +1,388 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('manage_options') ) return; ?>
|
2 |
+
<!-- GENERAL OPTIONS -->
|
3 |
+
<div class="em-menu-general em-menu-group">
|
4 |
+
<div class="postbox " id="em-opt-general" >
|
5 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div> <h3><span><?php _e ( 'General Options', 'events-manager'); ?> </span></h3>
|
6 |
+
<div class="inside">
|
7 |
+
<table class="form-table">
|
8 |
+
<?php em_options_radio_binary ( __( 'Disable thumbnails?', 'events-manager'), 'dbem_thumbnails_enabled', __( 'Select yes to disable Events Manager from enabling thumbnails (some themes may already have this enabled, which we cannot be turned off here).','events-manager') ); ?>
|
9 |
+
<tr class="em-header">
|
10 |
+
<td colspan="2">
|
11 |
+
<h4><?php echo sprintf(__('%s Settings','events-manager'),__('Event','events-manager')); ?></h4>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
<?php
|
15 |
+
em_options_radio_binary ( __( 'Enable Timezone Support?', 'events-manager'), 'dbem_timezone_enabled', sprintf(__( 'Each event can have its own timezone if enabled. If set to no, then all newly created events will have the blog timezone, which currently is set to %s','events-manager'), '<code>'.EM_DateTimeZone::create()->getName().'</code>'), '', '.event-timezone-option' );
|
16 |
+
?>
|
17 |
+
<tr class="event-timezone-option">
|
18 |
+
<th>
|
19 |
+
<label for="event-timezone"><?php esc_html_e('Default Timezone', 'events-manager'); ?></label>
|
20 |
+
</th>
|
21 |
+
<td>
|
22 |
+
<select id="event-timezone" name="dbem_timezone_default">
|
23 |
+
<?php echo wp_timezone_choice( get_option('dbem_timezone_default') ); ?>
|
24 |
+
</select><br />
|
25 |
+
<i><?php esc_html_e('When creating a new event, this timezone will be applied by default.','events-manager'); ?></i>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
<?php
|
29 |
+
em_options_radio_binary ( __( 'Enable recurrence?', 'events-manager'), 'dbem_recurrence_enabled', __( 'Select yes to enable the recurrence features feature','events-manager') );
|
30 |
+
em_options_radio_binary ( __( 'Enable bookings?', 'events-manager'), 'dbem_rsvp_enabled', __( 'Select yes to allow bookings and tickets for events.','events-manager') );
|
31 |
+
em_options_radio_binary ( __( 'Enable tags?', 'events-manager'), 'dbem_tags_enabled', __( 'Select yes to enable the tag features','events-manager') );
|
32 |
+
if( !(EM_MS_GLOBAL && !is_main_site()) ){
|
33 |
+
em_options_radio_binary ( __( 'Enable categories?', 'events-manager'), 'dbem_categories_enabled', __( 'Select yes to enable the category features','events-manager') );
|
34 |
+
if( get_option('dbem_categories_enabled') ){
|
35 |
+
/*default category*/
|
36 |
+
$category_options = array();
|
37 |
+
$category_options[0] = __('no default category','events-manager');
|
38 |
+
$EM_Categories = EM_Categories::get();
|
39 |
+
foreach($EM_Categories as $EM_Category){
|
40 |
+
$category_options[$EM_Category->id] = $EM_Category->name;
|
41 |
+
}
|
42 |
+
echo "<tr><th>".__( 'Default Category', 'events-manager')."</th><td>";
|
43 |
+
wp_dropdown_categories(array( 'hide_empty' => 0, 'name' => 'dbem_default_category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => get_option('dbem_default_category'), 'show_option_none' => __('None','events-manager'), 'class'=>''));
|
44 |
+
echo "</br><em>" .__( 'This option allows you to select the default category when adding an event.','events-manager').' '.__('If an event does not have a category assigned when editing, this one will be assigned automatically.','events-manager')."</em>";
|
45 |
+
echo "</td></tr>";
|
46 |
+
}
|
47 |
+
}
|
48 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'events-manager'),__('event','events-manager')), 'dbem_attributes_enabled', __( 'Select yes to enable the attributes feature','events-manager') );
|
49 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'events-manager'),__('event','events-manager')), 'dbem_cp_events_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','events-manager') );
|
50 |
+
if( get_option('dbem_attributes_enabled') ){
|
51 |
+
em_options_textarea ( sprintf(__( '%s Attributes', 'events-manager'),__('Event','events-manager')), 'dbem_placeholders_custom', sprintf(__( "You can also add event attributes here, one per line in this format <code>#_ATT{key}</code>. They will not appear on event pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'events-manager'), EM_ADMIN_URL .'&page=events-manager-help') );
|
52 |
+
}
|
53 |
+
?>
|
54 |
+
<tr class="em-header">
|
55 |
+
<td colspan="2">
|
56 |
+
<h4><?php echo sprintf(__('%s Settings','events-manager'),__('Location','events-manager')); ?></h4>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
<?php
|
60 |
+
em_options_radio_binary ( __( 'Enable locations?', 'events-manager'), 'dbem_locations_enabled', __( 'If you disable locations, bear in mind that you should remove your location page, shortcodes and related placeholders from your <a href="#formats" class="nav-tab-link" rel="#em-menu-formats">formats</a>.','events-manager'), '', '.em-location-type-option' );
|
61 |
+
?>
|
62 |
+
<tbody class="em-location-type-option">
|
63 |
+
<?php
|
64 |
+
em_options_radio_binary ( __( 'Require locations for events?', 'events-manager'), 'dbem_require_location', __( 'Setting this to no will allow you to submit events without locations. You can use the <code>{no_location}...{/no_location}</code> or <code>{has_location}..{/has_location}</code> conditional placeholder to selectively display location information.','events-manager') );
|
65 |
+
?>
|
66 |
+
<tr valign="top" id='dbem_location_types_row'>
|
67 |
+
<th scope="row"><?php esc_html_e('Location Types', 'events-manager'); ?></th>
|
68 |
+
<td>
|
69 |
+
<?php
|
70 |
+
$location_types = get_option('dbem_location_types', array());
|
71 |
+
?>
|
72 |
+
<label>
|
73 |
+
<input type="checkbox" name="dbem_location_types[location]" value="1" <?php if( !empty($location_types['location']) ) echo 'checked'; ?> data-trigger=".em-location-type-option-physical" class="em-trigger">
|
74 |
+
<?php esc_html_e('Physicial Locations', 'events-manager'); ?>
|
75 |
+
</label>
|
76 |
+
<?php foreach (EM_Event_Locations\Event_Locations::get_types() as $event_location_type => $EM_Event_Location_Class): /* @var EM_Event_Locations\Event_Location $EM_Event_Location_Class */ ?>
|
77 |
+
<br>
|
78 |
+
<label>
|
79 |
+
<input type="checkbox" name="dbem_location_types[<?php echo esc_attr($event_location_type); ?>]" value="1" <?php if( !empty($location_types[$event_location_type]) ) echo 'checked'; ?> data-trigger=".em-location-type-option-<?php echo esc_attr($event_location_type); ?>" class="em-trigger">
|
80 |
+
<?php echo $EM_Event_Location_Class::get_label('plural'); ?>
|
81 |
+
</label>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
<p><em><?php echo sprintf( esc_html__('You can allow different location types which can be assigned to an event. For more information see our %s.', 'events-manager'), '<a href="http://wp-events-plugin.com/documentation/location-types/" target="_blank">'.esc_html__('documentation', 'events-manager').'</a>'); ?></em></p>
|
84 |
+
</td>
|
85 |
+
</tr>
|
86 |
+
</tbody>
|
87 |
+
</table>
|
88 |
+
<table class="form-table em-location-type-option">
|
89 |
+
<tbody class="em-location-type-option-physical">
|
90 |
+
<tr class="em-subheader">
|
91 |
+
<td colspan="2">
|
92 |
+
<h5><?php esc_html_e('Physicial Locations', 'events-manager'); ?></h5>
|
93 |
+
</td>
|
94 |
+
</tr>
|
95 |
+
<?php
|
96 |
+
if( get_option('dbem_locations_enabled') ){
|
97 |
+
em_options_radio_binary ( __( 'Use dropdown for locations?', 'events-manager'), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drop-down menu; location selection will be faster, but you will lose the ability to insert locations with events','events-manager') );
|
98 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'events-manager'),__('location','events-manager')), 'dbem_location_attributes_enabled', __( 'Select yes to enable the attributes feature','events-manager') );
|
99 |
+
em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'events-manager'),__('location','events-manager')), 'dbem_cp_locations_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','events-manager') );
|
100 |
+
if( get_option('dbem_location_attributes_enabled') ){
|
101 |
+
em_options_textarea ( sprintf(__( '%s Attributes', 'events-manager'),__('Location','events-manager')), 'dbem_location_placeholders_custom', sprintf(__( "You can also add location attributes here, one per line in this format <code>#_LATT{key}</code>. They will not appear on location pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'events-manager'), EM_ADMIN_URL .'&page=events-manager-help') );
|
102 |
+
}
|
103 |
+
/*default location*/
|
104 |
+
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') && EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS ){
|
105 |
+
em_options_input_text( __( 'Default Location', 'events-manager'), 'dbem_default_location', __('Please enter your Location ID, or leave blank for no location.','events-manager').' '.__( 'This option allows you to select the default location when adding an event.','events-manager')." ".__('(not applicable with event ownership on presently, coming soon!)','events-manager') );
|
106 |
+
}else{
|
107 |
+
$location_options = array();
|
108 |
+
$location_options[0] = __('no default location','events-manager');
|
109 |
+
$EM_Locations = EM_Locations::get();
|
110 |
+
foreach($EM_Locations as $EM_Location){
|
111 |
+
$location_options[$EM_Location->location_id] = $EM_Location->location_name;
|
112 |
+
}
|
113 |
+
em_options_select ( __( 'Default Location', 'events-manager'), 'dbem_default_location', $location_options, __('Please enter your Location ID.','events-manager').' '.__( 'This option allows you to select the default location when adding an event.','events-manager')." ".__('(not applicable with event ownership on presently, coming soon!)','events-manager') );
|
114 |
+
}
|
115 |
+
|
116 |
+
/*default location country*/
|
117 |
+
em_options_select ( __( 'Default Location Country', 'events-manager'), 'dbem_location_default_country', em_get_countries(__('no default country', 'events-manager')), __('If you select a default country, that will be pre-selected when creating a new location.','events-manager') );
|
118 |
+
}
|
119 |
+
?>
|
120 |
+
</tbody>
|
121 |
+
</table>
|
122 |
+
<table class="form-table">
|
123 |
+
<tr class="em-header">
|
124 |
+
<td colspan="2">
|
125 |
+
<h4><?php echo sprintf(__('%s Settings','events-manager'),__('Other','events-manager')); ?></h4>
|
126 |
+
</td>
|
127 |
+
</tr>
|
128 |
+
<?php
|
129 |
+
em_options_radio_binary ( __('Show some love?','events-manager'), 'dbem_credits', __( 'Hundreds of free hours have gone into making this free plugin, show your support and add a small link to the plugin website at the bottom of your event pages.','events-manager') );
|
130 |
+
echo $save_button;
|
131 |
+
?>
|
132 |
+
</table>
|
133 |
+
|
134 |
+
</div> <!-- . inside -->
|
135 |
+
</div> <!-- .postbox -->
|
136 |
+
|
137 |
+
<?php if ( !is_multisite() ){ em_admin_option_box_image_sizes(); } ?>
|
138 |
+
|
139 |
+
<?php if ( !is_multisite() || (em_wp_is_super_admin() && !get_site_option('dbem_ms_global_caps')) ){ em_admin_option_box_caps(); } ?>
|
140 |
+
|
141 |
+
<div class="postbox" id="em-opt-google-maps" >
|
142 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Google Maps and Location Services', 'events-manager'); ?></span></h3>
|
143 |
+
<div class="inside">
|
144 |
+
<div class="em-boxheader">
|
145 |
+
<p><?php esc_html_e('Google Maps API provides you with ways to display maps of your locations and help site visitors find events near their desired locations.','events-manager'); ?></p>
|
146 |
+
<p style="font-weight: bold; color:#ca4a1f;">
|
147 |
+
<?php
|
148 |
+
$msg = esc_html__('Google may charge you for usage, depending on how much traffic your site receives. For more information about how and where Events Manager uses the Google Maps API, and how to manage costs, please see our %s page.', 'events-manager');
|
149 |
+
echo sprintf($msg, '<a href="https://wp-events-plugin.com/documentation/google-maps/api-usage/?utm_source=plugin&utm_medium=settings&utm_campaign=gmaps-general">'.esc_html__('documentation', 'events-manager').'</a>');
|
150 |
+
?>
|
151 |
+
</p>
|
152 |
+
</div>
|
153 |
+
<table class="form-table">
|
154 |
+
<?php
|
155 |
+
em_options_radio_binary( esc_html__( 'Enable Google Maps integration?', 'events-manager'), 'dbem_gmap_is_active', esc_html__( 'Check this option to enable Google Map integration.', 'events-manager'), '', '.em-google-maps-enabled' );
|
156 |
+
?>
|
157 |
+
<tbody class="form-table em-google-maps-enabled">
|
158 |
+
<?php
|
159 |
+
em_options_input_text(__('Google Maps API Browser Key','events-manager'), 'dbem_google_maps_browser_key', sprintf(__('Google Maps require an API key, please see our %s page for instructions on obtaining one.', 'events-manager'), '<a href="https://wp-events-plugin.com/documentation/google-maps/api-key/?utm_source=plugin&utm_medium=settings&utm_campaign=gmaps-api-key">'.esc_html__('documentation','events-manager').'</a>'));
|
160 |
+
$google_map_options = apply_filters('em_settings_google_maps_options', array(
|
161 |
+
'dynamic' => _x('Dynamic', 'Google Map Type', 'events-manager'),
|
162 |
+
'embed' => _x('Embedded', 'Google Map Type', 'events-manager')
|
163 |
+
));
|
164 |
+
$google_map_options_pro = !defined('EMP_VERSION') || EMP_VERSION < 2.64 ? '<strong>'.sprintf(__('Upgrade to %s for more options!', 'events-manager'), '<a target="_blank" href="https://wp-events-plugin.com/google-maps/static-maps/?utm_source=plugin&utm_medium=settings&utm_campaign=gmaps-types">Events Manager Pro</a>').'</strong>' : '';
|
165 |
+
$google_map_options_desc = sprintf(__('Google offers different map displays, each with varying prices and free usage allowance. See our %s page for more information on these display options.', 'events-manager'), '<a href="https://wp-events-plugin.com/google-maps/map-types/?utm_source=plugin&utm_medium=settings&utm_campaign=gmaps-types">'.__('documentation', 'events-manager').'</a>') .' '. $google_map_options_pro;
|
166 |
+
em_options_select(__('Google Map Type', 'events-manager'), 'dbem_gmap_type', $google_map_options, $google_map_options_desc);
|
167 |
+
$embed_options = array('place' => __('Location name and address', 'events-manager'), 'address' => __('Address only', 'events-manager'), 'coordinates' => __('Location coordinates', 'events-manager'));
|
168 |
+
em_options_select(__('Embed Display Type', 'events-manager'), 'dbem_gmap_embed_type', $embed_options, __('When displaying embedded maps for a location, choose what information Google will use to generate a map from, each producing varying results.', 'events-manager'));
|
169 |
+
em_options_textarea(__('Google Maps Style', 'events-manager'), 'dbem_google_maps_styles', sprintf(__('You can add styles to your maps to give them a unique look. Build one using the %s or choose from the many free templates on %s paste the generated JSON code here.', 'events-manager'), '<a href="https://mapstyle.withgoogle.com/" target="_blank">'.esc_html__('Google Maps Styling Wizard', 'events-manager').'</a>', '<a href="https://snazzymaps.com/explore" target="_blank">Snazzy Maps</a>'));
|
170 |
+
?>
|
171 |
+
</tbody>
|
172 |
+
<tbody class="form-table em-google-maps-enabled em-google-maps-static">
|
173 |
+
<?php do_action('em_settings_google_maps_general'); ?>
|
174 |
+
</tbody>
|
175 |
+
<?php
|
176 |
+
echo $save_button;
|
177 |
+
?>
|
178 |
+
</table>
|
179 |
+
</div> <!-- . inside -->
|
180 |
+
</div> <!-- .postbox -->
|
181 |
+
|
182 |
+
<div class="postbox" id="em-opt-event-submissions" >
|
183 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Event Submission Forms', 'events-manager'); ?></span></h3>
|
184 |
+
<div class="inside">
|
185 |
+
<table class="form-table">
|
186 |
+
<tr><td colspan="2" class="em-boxheader">
|
187 |
+
<?php echo sprintf(__('You can allow users to publicly submit events on your blog by using the %s shortcode, and enabling anonymous submissions below.','events-manager'), '<code>[event_form]</code>'); ?>
|
188 |
+
</td></tr>
|
189 |
+
<?php
|
190 |
+
em_options_radio_binary ( __( 'Use Visual Editor?', 'events-manager'), 'dbem_events_form_editor', __( 'Users can now use the WordPress editor for easy HTML entry in the submission form.', 'events-manager') );
|
191 |
+
em_options_radio_binary ( __( 'Show form again?', 'events-manager'), 'dbem_events_form_reshow', __( 'When a user submits their event, you can display a new event form again.', 'events-manager') );
|
192 |
+
em_options_textarea ( __( 'Success Message', 'events-manager'), 'dbem_events_form_result_success', __( 'Customize the message your user sees when they submitted their event.', 'events-manager').$events_placeholder_tip );
|
193 |
+
em_options_textarea ( __( 'Successfully Updated Message', 'events-manager'), 'dbem_events_form_result_success_updated', __( 'Customize the message your user sees when they resubmit/update their event.', 'events-manager').$events_placeholder_tip );
|
194 |
+
?>
|
195 |
+
<tr class="em-header"><td colspan="2">
|
196 |
+
<h4><?php echo sprintf(__('Anonymous event submissions','events-manager'), '<code>[event_form]</code>'); ?></h4>
|
197 |
+
</td></tr>
|
198 |
+
<?php
|
199 |
+
em_options_radio_binary ( __( 'Allow anonymous event submissions?', 'events-manager'), 'dbem_events_anonymous_submissions', __( 'Would you like to allow users to submit bookings anonymously? If so, you can use the new [event_form] shortcode or <code>em_event_form()</code> template tag with this enabled.', 'events-manager') );
|
200 |
+
if( defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS') && EM_OPTIMIZE_SETTINGS_PAGE_USERS ){
|
201 |
+
em_options_input_text( __('Guest Default User', 'events-manager'), 'dbem_events_anonymous_user', __('Please add a User ID.','events-manager').' '.__( 'Events require a user to own them. In order to allow events to be submitted anonymously you need to assign that event a specific user. We recommend you create a "Anonymous" subscriber with a very good password and use that. Guests will have the same event permissions as this user when submitting.', 'events-manager') );
|
202 |
+
}else{
|
203 |
+
em_options_select ( __('Guest Default User', 'events-manager'), 'dbem_events_anonymous_user', em_get_wp_users (), __( 'Events require a user to own them. In order to allow events to be submitted anonymously you need to assign that event a specific user. We recommend you create a "Anonymous" subscriber with a very good password and use that. Guests will have the same event permissions as this user when submitting.', 'events-manager') );
|
204 |
+
}
|
205 |
+
em_options_textarea ( __( 'Success Message', 'events-manager'), 'dbem_events_anonymous_result_success', __( 'Anonymous submitters cannot see or modify their event once submitted. You can customize the success message they see here.', 'events-manager').$events_placeholder_tip );
|
206 |
+
?>
|
207 |
+
<?php echo $save_button; ?>
|
208 |
+
</table>
|
209 |
+
</div> <!-- . inside -->
|
210 |
+
</div> <!-- .postbox -->
|
211 |
+
<?php do_action('em_options_page_event_submission_after'); ?>
|
212 |
+
|
213 |
+
<?php do_action('em_options_page_footer'); ?>
|
214 |
+
|
215 |
+
<?php /*
|
216 |
+
<div class="postbox" id="em-opt-geo" >
|
217 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Geo APIs', 'events-manager'); ?> <em>(Beta)</em></span></h3>
|
218 |
+
<div class="inside">
|
219 |
+
<p><?php esc_html_e('Geocoding is the process of converting addresses into geographic coordinates, which can be used to find events and locations near a specific coordinate.','events-manager'); ?></p>
|
220 |
+
<table class="form-table">
|
221 |
+
<?php
|
222 |
+
em_options_radio_binary ( __( 'Enable Geocoding Features?', 'events-manager'), 'dbem_geo', '', '', '.em-settings-geocoding');
|
223 |
+
?>
|
224 |
+
</table>
|
225 |
+
<div class="em-settings-geocoding">
|
226 |
+
<h4>GeoNames API (geonames.org)</h4>
|
227 |
+
<p>We make use of the <a href="http://www.geonames.org">GeoNames</a> web service to suggest locations/addresses to users when searching, and converting these into coordinates.</p>
|
228 |
+
<p>To be able to use these services, you must <a href="http://www.geonames.org/login">register an account</a>, activate the free webservice and enter your username below. You are allowed up to 30,000 requests per day, if you require more you can purchase credits from your account.</p>
|
229 |
+
<table class="form-table">
|
230 |
+
<?php em_options_input_text ( __( 'GeoNames Username', 'events-manager'), 'dbem_geonames_username', __('If left blank, this service will not be used.','events-manager')); ?>
|
231 |
+
</table>
|
232 |
+
</div>
|
233 |
+
<table class="form-table"><?php echo $save_button; ?></table>
|
234 |
+
</div> <!-- . inside -->
|
235 |
+
</div> <!-- .postbox -->
|
236 |
+
*/ ?>
|
237 |
+
|
238 |
+
<div class="postbox" id="em-opt-performance-optimization" >
|
239 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Performance Optimization', 'events-manager'); ?> (<?php _e('Advanced','events-manager'); ?>)</span></h3>
|
240 |
+
<div class="inside">
|
241 |
+
<?php
|
242 |
+
$performance_opt_page_instructions = __('In the boxes below, you are expected to write the page IDs. For multiple pages, use comma-separated values e.g. 1,2,3. Entering 0 means EVERY page, -1 means the home page.','events-manager');
|
243 |
+
?>
|
244 |
+
<div class="em-boxheader">
|
245 |
+
<p><?php _e('This section allows you to configure parts of this plugin that will improve performance on your site and increase page speeds by reducing extra files from being unnecessarily included on pages as well as reducing server loads where possible. This only applies to pages outside the admin area.','events-manager'); ?></p>
|
246 |
+
<p><strong><?php _e('Warning!','events-manager'); ?></strong> <?php echo sprintf(__('This is for advanced users, you should know what you\'re doing here or things will not work properly. For more information on how these options work see our <a href="%s" target="_blank">optimization recommendations</a>','events-manager'), 'http://wp-events-plugin.com/documentation/optimization-recommendations/'); ?></p>
|
247 |
+
</div>
|
248 |
+
<table class="form-table">
|
249 |
+
<tr class="em-header"><td colspan="2">
|
250 |
+
<h4><?php _e('JavaScript Files','events-manager'); ?></h4>
|
251 |
+
</td></tr>
|
252 |
+
<?php
|
253 |
+
em_options_radio_binary ( __( 'Limit JS file loading?', 'events-manager'), 'dbem_js_limit', __( 'Prevent unnecessary loading of JavaScript files on pages where they are not needed.', 'events-manager') );
|
254 |
+
?>
|
255 |
+
<tbody id="dbem-js-limit-options">
|
256 |
+
<tr class="em-subheader"><td colspan="2">
|
257 |
+
<?php
|
258 |
+
_e('Aside from pages we automatically generate and include certain jQuery files, if you are using Widgets, Shortcode or PHP to display specific items you may need to tell us where you are using them for them to work properly. Below are options for you to include specific jQuery dependencies only on certain pages.','events-manager');
|
259 |
+
echo $performance_opt_page_instructions;
|
260 |
+
?>
|
261 |
+
</td></tr>
|
262 |
+
<?php
|
263 |
+
em_options_input_text( __( 'General JS', 'events-manager'), 'dbem_js_limit_general', __( 'Loads our own JS file if no other dependencies are already loaded, which is still needed for many items generated by EM using JavaScript such as Calendars, Maps and Booking Forms/Buttons', 'events-manager'), 0 );
|
264 |
+
em_options_input_text( __( 'Search Forms', 'events-manager'), 'dbem_js_limit_search', __( 'Include pages where you use shortcodes or widgets to display event search forms.', 'events-manager') );
|
265 |
+
em_options_input_text( __( 'Event Edit and Submission Forms', 'events-manager'), 'dbem_js_limit_events_form', __( 'Include pages where you use shortcode or PHP to display event submission forms.', 'events-manager') );
|
266 |
+
em_options_input_text( __( 'Booking Management Pages', 'events-manager'), 'dbem_js_limit_edit_bookings', __( 'Include pages where you use shortcode or PHP to display event submission forms.', 'events-manager') );
|
267 |
+
?>
|
268 |
+
</tbody>
|
269 |
+
<tr class="em-header"><td colspan="2">
|
270 |
+
<h4><?php _e('CSS File','events-manager'); ?></h4>
|
271 |
+
</td></tr>
|
272 |
+
<?php
|
273 |
+
em_options_radio_binary ( __( 'Limit loading of our CSS files?', 'events-manager'), 'dbem_css_limit', __( 'Enabling this will prevent us from loading our CSS file on every page, and will only load on specific pages generated by Events Manager.', 'events-manager') );
|
274 |
+
?>
|
275 |
+
<tbody id="dbem-css-limit-options">
|
276 |
+
<tr class="em-subheader"><td colspan="2">
|
277 |
+
<?php echo $performance_opt_page_instructions; ?>
|
278 |
+
</td></tr>
|
279 |
+
<?php
|
280 |
+
em_options_input_text( __( 'Include on', 'events-manager'), 'dbem_css_limit_include', __( 'Our CSS file will only be INCLUDED on all of these pages.', 'events-manager'), 0 );
|
281 |
+
em_options_input_text( __( 'Exclude on', 'events-manager'), 'dbem_css_limit_exclude', __( 'Our CSS file will be EXCLUDED on all of these pages. Takes precedence over inclusion rules.', 'events-manager'), 0 );
|
282 |
+
?>
|
283 |
+
</tbody>
|
284 |
+
<?php
|
285 |
+
?>
|
286 |
+
<tr class="em-header"><td colspan="2">
|
287 |
+
<h4><?php _e('Thumbnails','events-manager'); ?></h4>
|
288 |
+
</td></tr>
|
289 |
+
<?php
|
290 |
+
em_options_radio_binary ( __( 'Disable WordPress Thumbnails?', 'events-manager'), 'dbem_disable_thumbnails', __( 'If set to yes, full sized images will be used and HTML width and height attributes will be used to determine the size.', 'events-manager').' '.sprintf(__('Setting this to yes will also make your images crop efficiently with the %s feature in the %s plugin.','events-manager'), '<a href="http://jetpack.me/support/photon/">Photon</a>','<a href="https://wordpress.org/plugins/jetpack/">JetPack</a>') );
|
291 |
+
?>
|
292 |
+
<?php echo $save_button; ?>
|
293 |
+
</table>
|
294 |
+
<script type="text/javascript">
|
295 |
+
jQuery(document).ready(function($){
|
296 |
+
$('input:radio[name="dbem_js_limit"]').on('change', function(){
|
297 |
+
if( $('input:radio[name="dbem_js_limit"]:checked').val() == 1 ){
|
298 |
+
$('tbody#dbem-js-limit-options').show();
|
299 |
+
}else{
|
300 |
+
$('tbody#dbem-js-limit-options').hide();
|
301 |
+
}
|
302 |
+
}).trigger('change');
|
303 |
+
|
304 |
+
$('input:radio[name="dbem_css_limit"]').on('change', function(){
|
305 |
+
if( $('input:radio[name="dbem_css_limit"]:checked').val() == 1 ){
|
306 |
+
$('tbody#dbem-css-limit-options').show();
|
307 |
+
}else{
|
308 |
+
$('tbody#dbem-css-limit-options').hide();
|
309 |
+
}
|
310 |
+
}).trigger('change');
|
311 |
+
});
|
312 |
+
</script>
|
313 |
+
</div> <!-- . inside -->
|
314 |
+
</div> <!-- .postbox -->
|
315 |
+
|
316 |
+
<div class="postbox" id="em-opt-style-options" >
|
317 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php _e ( 'Styling Options', 'events-manager'); ?> (<?php _e('Advanced','events-manager'); ?>)</span></h3>
|
318 |
+
<div class="inside">
|
319 |
+
<p style="font-weight:bold; font-size:110%;">
|
320 |
+
<?php echo sprintf( esc_html__('We strongly recommend you check out our %s before disabling any styling here, in most cases you can make profound changes with a few line of CSS or PHP', 'events-manager'), '<a href="#" target="_blank">'. esc_html__('documentation', 'events-manager').'</a>' ); ?>
|
321 |
+
</p>
|
322 |
+
<p class="em-boxheader">
|
323 |
+
<?php esc_html_e("Events Manager 6 onwards has optional styling that maximizes consistency accross different themes. If you'd like your theme to take over in some or all aspects of our plugin, you can disable our styling here.",'events-manager'); ?>
|
324 |
+
</p>
|
325 |
+
<table class="form-table">
|
326 |
+
<tbody>
|
327 |
+
<?php
|
328 |
+
em_options_radio_binary ( __( 'Enable All Styling?', 'events-manager'), 'dbem_css', esc_html__("You can disable ALL styling altogether by setting this to 'no'. By doing so, nothing will be styled, AT ALL, by Events Manager in the front-end. Basically, it's up to you and your theme!", 'events-manager'), null, '.all-css');
|
329 |
+
?>
|
330 |
+
</tbody>
|
331 |
+
<tbody class="all-css">
|
332 |
+
<?php
|
333 |
+
em_options_radio_binary ( __( 'Enable Theme Styling?', 'events-manager'), 'dbem_css_theme', esc_html__("We impose some theme styling rules which help normalize the look of Events Manager accross themes and overrides general theming. This is limited to our components but will prevent your theme from taking over things like fonts, font-sizes, form structures etc. You can also disable strict styling for individual components below.", 'events-manager'), null, '.theme-css');
|
334 |
+
?>
|
335 |
+
</tbody>
|
336 |
+
<tbody class="theme-css">
|
337 |
+
<tr><td colspan="2">
|
338 |
+
<h4><?php _e('Individual Components','events-manager'); ?></h4>
|
339 |
+
<p>
|
340 |
+
<?php echo sprintf(esc_html__('Our theme has multiple CSS variables that can be overriden easily. The options below could be overriden just as easily via one line of CSS in your %s settings area, for example %s'), '<em>'.__('Customizer').' > '. __('Additional CSS').'</em>', '<code>body .em.pixelbones{ --font-family:arial, --font-size:14px; --font-weight: normal; --line-height:16px; }</code>'); ?>
|
341 |
+
</p>
|
342 |
+
</td></tr>
|
343 |
+
<?php
|
344 |
+
$settings = array(0 => esc_html__('Default plugin setting', 'events-manager'), 1 => esc_html__('Inherit your theme settings', 'events-manager'));
|
345 |
+
$desc = esc_html__('Our default setting is %s');
|
346 |
+
em_options_select ( __( 'Default font family', 'events-manager'), 'dbem_css_theme_font_family', $settings, sprintf($desc, '<code>"Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;</code>') );
|
347 |
+
em_options_select ( __( 'Base font size', 'events-manager'), 'dbem_css_theme_font_size', $settings, sprintf($desc, '<code>16px</code>') );
|
348 |
+
em_options_select ( __( 'Base line height', 'events-manager'), 'dbem_css_theme_line_height', $settings, sprintf($desc, '<code>20px</code>') );
|
349 |
+
em_options_select ( __( 'Base font weight', 'events-manager'), 'dbem_css_theme_font_weight', $settings, sprintf($desc, '<code>400</code>') );
|
350 |
+
?>
|
351 |
+
</tbody>
|
352 |
+
<tbody class="all-css">
|
353 |
+
<tr class="em-header all-css"><td colspan="2">
|
354 |
+
<h4><?php _e('Individual Components','events-manager'); ?></h4>
|
355 |
+
<p><?php esc_html_e("Here you can disable individual item styling eompletely or just allow basic styling. Basic styling will try to impose general structuring (such as calendar structures) but won't use our Strict styling rules.", 'events-manager'); ?></p>
|
356 |
+
</td></tr>
|
357 |
+
<?php
|
358 |
+
$select = array(
|
359 |
+
1 => __('Enabled','events-manager'), 0 => __('Disabled', 'events-manager'), 2 => __('Basic Only', 'events-manager')
|
360 |
+
);
|
361 |
+
em_options_select ( __( 'Events Calendar', 'events-manager'), 'dbem_css_calendar', $select );
|
362 |
+
em_options_select ( __( 'Events list page', 'events-manager'), 'dbem_css_evlist', $select );
|
363 |
+
em_options_select ( __( 'Locations list page', 'events-manager'), 'dbem_css_loclist', $select );
|
364 |
+
em_options_select ( __( 'Categories list page', 'events-manager'), 'dbem_css_catlist', $select );
|
365 |
+
em_options_select ( __( 'Tags list page', 'events-manager'), 'dbem_css_taglist', $select );
|
366 |
+
?><tr><td colspan="2"><hr></td></tr><?php
|
367 |
+
em_options_select ( __( 'Event pages', 'events-manager'), 'dbem_css_event', $select );
|
368 |
+
em_options_select ( __( 'Location pages', 'events-manager'), 'dbem_css_location', $select );
|
369 |
+
em_options_select ( __( 'Category pages', 'events-manager'), 'dbem_css_category', $select );
|
370 |
+
em_options_select ( __( 'Tag pages', 'events-manager'), 'dbem_css_tag', $select );
|
371 |
+
?><tr><td colspan="2"><hr></td></tr><?php
|
372 |
+
em_options_select ( __( 'Search forms', 'events-manager'), 'dbem_css_search', $select);
|
373 |
+
em_options_select ( __( 'Event booking forms', 'events-manager'), 'dbem_css_rsvp', $select );
|
374 |
+
?><tr><td colspan="2"><hr></td></tr><?php
|
375 |
+
em_options_select ( __( 'My bookings page', 'events-manager'), 'dbem_css_myrsvp', $select);
|
376 |
+
em_options_select ( __( 'Event/Location admin pages', 'events-manager'), 'dbem_css_editors', $select);
|
377 |
+
em_options_select ( __( 'Booking admin pages', 'events-manager'), 'dbem_css_rsvpadmin', $select );
|
378 |
+
echo $save_button;
|
379 |
+
?>
|
380 |
+
</tbody>
|
381 |
+
</table>
|
382 |
+
</div> <!-- . inside -->
|
383 |
+
</div> <!-- .postbox -->
|
384 |
+
|
385 |
+
<?php em_admin_option_box_data_privacy(); ?>
|
386 |
+
<?php if ( !is_multisite() ) { em_admin_option_box_uninstall(); } ?>
|
387 |
+
|
388 |
+
</div> <!-- .em-menu-general -->
|
trunk/admin/settings/tabs/pages.php
ADDED
@@ -0,0 +1,724 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if( !function_exists('current_user_can') || !current_user_can('manage_options') ) return; ?>
|
2 |
+
<!-- PAGE OPTIONS -->
|
3 |
+
<div class="em-menu-pages em-menu-group" <?php if( !defined('EM_SETTINGS_TABS') || !EM_SETTINGS_TABS) : ?>style="display:none;"<?php endif; ?>>
|
4 |
+
<?php
|
5 |
+
$template_page_tip = __( "Many themes display extra meta information on post pages such as 'posted by' or 'post date' information, which may not be desired. Usually, page templates contain less clutter.", 'events-manager');
|
6 |
+
$template_page_tip .= ' '. __("If you choose 'Pages' then %s will be shown using your theme default page template, alternatively choose from page templates that come with your specific theme.",'events-manager');
|
7 |
+
$template_page_tip .= ' '. str_replace('#','http://codex.wordpress.org/Post_Types#Template_Files',__("Be aware that some themes will not work with this option, if so (or you want to make your own changes), you can create a file named <code>single-%s.php</code> <a href='#'>as shown on the WordPress codex</a>, and leave this set to Posts.", 'events-manager'));
|
8 |
+
$body_class_tip = __('If you would like to add extra classes to your body html tag when a single %s page is displayed, enter it here. May be useful or necessary if your theme requires special class names for specific templates.','events-manager');
|
9 |
+
$post_class_tip = __('Same concept as the body classes option, but some themes also use the <code>post_class()</code> function within page content to differentiate styling between post types.','events-manager');
|
10 |
+
$format_override_tip = __("By using formats, you can control how your %s are displayed from within the Events Manager <a href='#formats' class='nav-tab-link' rel='#em-menu-formats'>Formatting</a> tab above without having to edit your theme files.",'events-manager');
|
11 |
+
$page_templates = array(''=>__('Posts'), 'page' => __('Pages'), __('Theme Templates','events-manager') => array_flip(get_page_templates()));
|
12 |
+
?>
|
13 |
+
<div class="postbox" id="em-opt-permalinks" >
|
14 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__('Permalink Slugs','events-manager')); ?></span></h3>
|
15 |
+
<div class="inside">
|
16 |
+
<p class="em-boxheader"><?php _e('You can change the permalink structure of your events, locations, categories and tags here. Be aware that you may want to set up redirects if you change your permalink structures to maintain SEO rankings.','events-manager'); ?></p>
|
17 |
+
<table class="form-table">
|
18 |
+
<?php
|
19 |
+
em_options_input_text ( __( 'Events', 'events-manager'), 'dbem_cp_events_slug', sprintf(__('e.g. %s - you can use / Separators too', 'events-manager'), '<strong>'.home_url().'/<code>'.esc_html(get_option('dbem_cp_events_slug',EM_POST_TYPE_EVENT_SLUG)).'</code>/2012-olympics/</strong>'), EM_POST_TYPE_EVENT_SLUG );
|
20 |
+
if( get_option('dbem_locations_enabled') && !(EM_MS_GLOBAL && get_site_option('dbem_ms_mainblog_locations') && !is_main_site()) ){
|
21 |
+
em_options_input_text ( __( 'Locations', 'events-manager'), 'dbem_cp_locations_slug', sprintf(__('e.g. %s - you can use / Separators too', 'events-manager'), '<strong>'.home_url().'/<code>'.esc_html(get_option('dbem_cp_locations_slug',EM_POST_TYPE_LOCATION_SLUG)).'</code>/wembley-stadium/</strong>'), EM_POST_TYPE_LOCATION_SLUG );
|
22 |
+
}
|
23 |
+
if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ){
|
24 |
+
em_options_input_text ( __( 'Event Categories', 'events-manager'), 'dbem_taxonomy_category_slug', sprintf(__('e.g. %s - you can use / Separators too', 'events-manager'), '<strong>'.home_url().'/<code>'.esc_html(get_option('dbem_taxonomy_category_slug',EM_TAXONOMY_CATEGORY_SLUG)).'</code>/sports/</strong>'), EM_TAXONOMY_CATEGORY_SLUG );
|
25 |
+
}
|
26 |
+
if( get_option('dbem_tags_enabled') ){
|
27 |
+
em_options_input_text ( __( 'Event Tags', 'events-manager'), 'dbem_taxonomy_tag_slug', sprintf(__('e.g. %s - you can use / Separators too', 'events-manager'), '<strong>'.home_url().'/<code>'.esc_html(get_option('dbem_taxonomy_tag_slug',EM_TAXONOMY_TAG_SLUG)).'</code>/running/</strong>'), EM_TAXONOMY_TAG_SLUG );
|
28 |
+
}
|
29 |
+
echo $save_button;
|
30 |
+
?>
|
31 |
+
</table>
|
32 |
+
</div> <!-- . inside -->
|
33 |
+
</div> <!-- .postbox -->
|
34 |
+
|
35 |
+
<div class="postbox " id="em-opt-event-pages" >
|
36 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','events-manager'),__('Event','events-manager')); ?></span></h3>
|
37 |
+
<div class="inside">
|
38 |
+
<table class="form-table">
|
39 |
+
<?php
|
40 |
+
//em_options_radio_binary ( sprintf(__( 'Display %s as', 'events-manager'),__('events','events-manager')), 'dbem_cp_events_template_page', sprintf($template_page_tip, EM_POST_TYPE_EVENT), array(__('Posts'),__('Pages')) );
|
41 |
+
em_options_select( sprintf(__( 'Display %s as', 'events-manager'),__('events','events-manager')), 'dbem_cp_events_template', $page_templates, sprintf($template_page_tip, __('events','events-manager'), EM_POST_TYPE_EVENT) );
|
42 |
+
em_options_input_text( __('Body Classes','events-manager'), 'dbem_cp_events_body_class', sprintf($body_class_tip, __('event','events-manager')) );
|
43 |
+
em_options_input_text( __('Post Classes','events-manager'), 'dbem_cp_events_post_class', $post_class_tip );
|
44 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_events_formats', sprintf($format_override_tip,__('events','events-manager')));
|
45 |
+
em_options_radio_binary ( __( 'Enable Comments?', 'events-manager'), 'dbem_cp_events_comments', sprintf(__('If you would like to disable comments entirely, disable this, otherwise you can disable comments on each single %s. Note that %s with comments enabled will still be until you resave them.','events-manager'),__('event','events-manager'),__('events','events-manager')));
|
46 |
+
echo $save_button;
|
47 |
+
?>
|
48 |
+
</table>
|
49 |
+
</div> <!-- . inside -->
|
50 |
+
</div> <!-- .postbox -->
|
51 |
+
|
52 |
+
<div class="postbox " id="em-opt-event-archives" >
|
53 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s List/Archives','events-manager'),__('Event','events-manager')); ?></span></h3>
|
54 |
+
<div class="inside">
|
55 |
+
<table class="form-table">
|
56 |
+
<tr>
|
57 |
+
<th><?php echo sprintf(__( 'Events page', 'events-manager')); ?></th>
|
58 |
+
<td>
|
59 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_events_page', 'selected'=>get_option('dbem_events_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'events-manager'),__('Events','events-manager')) )); ?>
|
60 |
+
<br />
|
61 |
+
<em><?php echo __( 'This option allows you to select which page to use as an events page. If you do not select an events page, to display event lists you can enable event archives or use the appropriate shortcodes and/or template tags.','events-manager'); ?></em>
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
<tbody class="em-event-page-options">
|
65 |
+
<?php
|
66 |
+
em_options_radio_binary ( __( 'Show events search?', 'events-manager'), 'dbem_events_page_search_form', __( "If set to yes, a search form will appear just above your list of events.", 'events-manager') );
|
67 |
+
em_options_radio_binary ( __( 'Display calendar in events page?', 'events-manager'), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the full-sized calendar on the events page, instead of the default list.','events-manager') );
|
68 |
+
em_options_radio_binary ( __( 'Disable title rewriting?', 'events-manager'), 'dbem_disable_title_rewrites', __( "Some WordPress themes don't follow best practices when generating navigation menus, and so the automatic title rewriting feature may cause problems, if your menus aren't working correctly on the event pages, try setting this to 'Yes', and provide an appropriate HTML title format below.",'events-manager') );
|
69 |
+
em_options_input_text ( __( 'Event Manager titles', 'events-manager'), 'dbem_title_html', __( "This only setting only matters if you selected 'Yes' to above. You will notice the events page titles aren't being rewritten, and you have a new title underneath the default page name. This is where you control the HTML of this title. Make sure you keep the #_PAGETITLE placeholder here, as that's what is rewritten by events manager. To control what's rewritten in this title, see settings further down for page titles.", 'events-manager') );
|
70 |
+
?>
|
71 |
+
</tbody>
|
72 |
+
<tr class="em-header">
|
73 |
+
<td colspan="2">
|
74 |
+
<h4><?php echo sprintf(__('WordPress %s Archives','events-manager'), __('Event','events-manager')); ?></h4>
|
75 |
+
<p><?php echo sprintf(__('%s custom post types can have archives, just like normal WordPress posts. If enabled, should you visit your base slug url %s and you will see an post-formatted archive of previous %s', 'events-manager'), __('Event','events-manager'), '<code>'.home_url().'/'.esc_html(get_option('dbem_cp_events_slug',EM_POST_TYPE_EVENT_SLUG)).'/</code>', __('events','events-manager')); ?></p>
|
76 |
+
<p><?php echo sprintf(__('Note that assigning a %s page above will override this archive if the URLs collide (which is the default setting, and is recommended for maximum plugin compatibility). You can have both at the same time, but you must ensure that your page and %s slugs are different.','events-manager'), __('events','events-manager'), __('event','events-manager')); ?></p>
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<tbody class="em-event-archive-options">
|
80 |
+
<?php
|
81 |
+
em_options_radio_binary ( __( 'Enable Archives?', 'events-manager'), 'dbem_cp_events_has_archive', __( "Allow WordPress post-style archives.", 'events-manager') );
|
82 |
+
?>
|
83 |
+
</tbody>
|
84 |
+
<tbody class="em-event-archive-options em-event-archive-sub-options">
|
85 |
+
<tr valign="top">
|
86 |
+
<th scope="row"><?php _e('Default event archive ordering','events-manager'); ?></th>
|
87 |
+
<td>
|
88 |
+
<select name="dbem_events_default_archive_orderby" >
|
89 |
+
<?php
|
90 |
+
$event_archive_orderby_options = apply_filters('em_settings_events_default_archive_orderby_ddm', array(
|
91 |
+
'_event_start' => __('Order by start date, start time','events-manager'),
|
92 |
+
'title' => __('Order by name','events-manager')
|
93 |
+
));
|
94 |
+
?>
|
95 |
+
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
96 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
97 |
+
<?php echo esc_html($value); ?>
|
98 |
+
</option>
|
99 |
+
<?php endforeach; ?>
|
100 |
+
</select>
|
101 |
+
<select name="dbem_events_default_archive_order" >
|
102 |
+
<?php
|
103 |
+
$ascending = __('Ascending','events-manager');
|
104 |
+
$descending = __('Descending','events-manager');
|
105 |
+
$event_archive_order_options = apply_filters('em_settings_events_default_archive_order_ddm', array(
|
106 |
+
'ASC' => __('Ascending','events-manager'),
|
107 |
+
'DESC' => __('Descending','events-manager')
|
108 |
+
));
|
109 |
+
?>
|
110 |
+
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
111 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
112 |
+
<?php echo esc_html($value); ?>
|
113 |
+
</option>
|
114 |
+
<?php endforeach; ?>
|
115 |
+
</select>
|
116 |
+
<br/>
|
117 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
<?php
|
121 |
+
em_options_select( __('Event archives scope','events-manager'), 'dbem_events_archive_scope', em_get_scopes() );
|
122 |
+
?>
|
123 |
+
</tbody>
|
124 |
+
<tr class="em-header">
|
125 |
+
<td colspan="2">
|
126 |
+
<h4><?php echo _e('General settings','events-manager'); ?></h4>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
<?php
|
130 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_events_archive_formats', sprintf($format_override_tip,__('events','events-manager')));
|
131 |
+
em_options_radio_binary ( __( 'Override Excerpts with Formats?', 'events-manager'), 'dbem_cp_events_excerpt_formats', sprintf($format_override_tip,__('events','events-manager')));
|
132 |
+
em_options_radio_binary ( __( 'Are current events past events?', 'events-manager'), 'dbem_events_current_are_past', __( "By default, events that have an end date later than today will be included in searches, set this to yes to consider events that started 'yesterday' as past.", 'events-manager') );
|
133 |
+
em_options_radio_binary ( __( 'Include in WordPress Searches?', 'events-manager'), 'dbem_cp_events_search_results', sprintf(__( "Allow %s to appear in the built-in search results.", 'events-manager'),__('events','events-manager')) );
|
134 |
+
?>
|
135 |
+
<tr class="em-header">
|
136 |
+
<td colspan="2">
|
137 |
+
<h4><?php echo sprintf(__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
|
138 |
+
<p><?php _e('These can be overridden when using shortcode or template tags.','events-manager'); ?></p>
|
139 |
+
</td>
|
140 |
+
</tr>
|
141 |
+
<tr valign="top" id='dbem_events_default_orderby_row'>
|
142 |
+
<th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
|
143 |
+
<td>
|
144 |
+
<select name="dbem_events_default_orderby" >
|
145 |
+
<?php
|
146 |
+
$event_list_orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
|
147 |
+
'event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name','events-manager'),
|
148 |
+
'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time','events-manager'),
|
149 |
+
'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time','events-manager'),
|
150 |
+
'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name','events-manager'),
|
151 |
+
));
|
152 |
+
?>
|
153 |
+
<?php foreach($event_list_orderby_options as $key => $value) : ?>
|
154 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_orderby')) ? "selected='selected'" : ''; ?>>
|
155 |
+
<?php echo esc_html($value); ?>
|
156 |
+
</option>
|
157 |
+
<?php endforeach; ?>
|
158 |
+
</select>
|
159 |
+
<select name="dbem_events_default_order" >
|
160 |
+
<?php
|
161 |
+
$ascending = __('Ascending','events-manager');
|
162 |
+
$descending = __('Descending','events-manager');
|
163 |
+
$event_list_order_options = apply_filters('em_settings_events_default_order_ddm', array(
|
164 |
+
'ASC' => __('All Ascending','events-manager'),
|
165 |
+
'DESC,ASC,ASC' => __("$descending, $ascending, $ascending",'events-manager'),
|
166 |
+
'DESC,DESC,ASC' => __("$descending, $descending, $ascending",'events-manager'),
|
167 |
+
'DESC' => __('All Descending','events-manager'),
|
168 |
+
'ASC,DESC,ASC' => __("$ascending, $descending, $ascending",'events-manager'),
|
169 |
+
'ASC,DESC,DESC' => __("$ascending, $descending, $descending",'events-manager'),
|
170 |
+
'ASC,ASC,DESC' => __("$ascending, $ascending, $descending",'events-manager'),
|
171 |
+
'DESC,ASC,DESC' => __("$descending, $ascending, $descending",'events-manager'),
|
172 |
+
));
|
173 |
+
?>
|
174 |
+
<?php foreach( $event_list_order_options as $key => $value) : ?>
|
175 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_events_default_order')) ? "selected='selected'" : ''; ?>>
|
176 |
+
<?php echo esc_html($value); ?>
|
177 |
+
</option>
|
178 |
+
<?php endforeach; ?>
|
179 |
+
</select>
|
180 |
+
<br/>
|
181 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
182 |
+
</td>
|
183 |
+
</tr>
|
184 |
+
<?php
|
185 |
+
em_options_select( __('Event list scope','events-manager'), 'dbem_events_page_scope', em_get_scopes(), __('Only show events starting within a certain time limit on the events page. Default is future events with no end time limit.','events-manager') );
|
186 |
+
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_events_default_limit', __( "This will control how many events are shown on one list by default.", 'events-manager') );
|
187 |
+
echo $save_button;
|
188 |
+
?>
|
189 |
+
</table>
|
190 |
+
</div> <!-- . inside -->
|
191 |
+
</div> <!-- .postbox -->
|
192 |
+
|
193 |
+
<?php if( get_option('dbem_locations_enabled') ): ?>
|
194 |
+
<div class="postbox " id="em-opt-location-pages" >
|
195 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','events-manager'),__('Location','events-manager')); ?></span></h3>
|
196 |
+
<div class="inside">
|
197 |
+
<table class="form-table">
|
198 |
+
<?php
|
199 |
+
//em_options_radio_binary ( sprintf(__( 'Display %s as', 'events-manager'),__('locations','events-manager')), 'dbem_cp_locations_template_page', sprintf($template_page_tip, EM_POST_TYPE_LOCATION), array(__('Posts'),__('Pages')) );
|
200 |
+
em_options_select( sprintf(__( 'Display %s as', 'events-manager'),__('locations','events-manager')), 'dbem_cp_locations_template', $page_templates, sprintf($template_page_tip, __('locations','events-manager'), EM_POST_TYPE_LOCATION) );
|
201 |
+
em_options_input_text( __('Body Classes','events-manager'), 'dbem_cp_locations_body_class', sprintf($body_class_tip, __('location','events-manager')) );
|
202 |
+
em_options_input_text( __('Post Classes','events-manager'), 'dbem_cp_locations_post_class', $post_class_tip );
|
203 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_locations_formats', sprintf($format_override_tip,__('locations','events-manager')));
|
204 |
+
em_options_radio_binary ( __( 'Enable Comments?', 'events-manager'), 'dbem_cp_locations_comments', sprintf(__('If you would like to disable comments entirely, disable this, otherwise you can disable comments on each single %s. Note that %s with comments enabled will still be until you resave them.','events-manager'),__('location','events-manager'),__('locations','events-manager')));
|
205 |
+
?>
|
206 |
+
<tr class="em-header">
|
207 |
+
<td colspan="2">
|
208 |
+
<h4><?php echo sprintf(esc_html__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
|
209 |
+
<p><?php echo sprintf(esc_html__('The options below are applied to the %s placeholders.', 'events-manager'), '<code>#_LOCATIONNEXTEVENTS</code>, <code>#_LOCATIONPASTEVENTS</code>, <code>#_LOCATIONALLEVENTS</code>'); ?></p>
|
210 |
+
</td>
|
211 |
+
</tr>
|
212 |
+
<tr valign="top" id='dbem_location_events_default_orderby_row'>
|
213 |
+
<th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
|
214 |
+
<td>
|
215 |
+
<select name="dbem_location_event_list_orderby" >
|
216 |
+
<?php foreach($event_list_orderby_options as $key => $value) : ?>
|
217 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_location_event_list_orderby')) ? "selected='selected'" : ''; ?>>
|
218 |
+
<?php echo esc_html($value); ?>
|
219 |
+
</option>
|
220 |
+
<?php endforeach; ?>
|
221 |
+
</select>
|
222 |
+
<select name="dbem_location_event_list_order" >
|
223 |
+
<?php foreach( $event_list_order_options as $key => $value) : ?>
|
224 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_location_event_list_order')) ? "selected='selected'" : ''; ?>>
|
225 |
+
<?php echo esc_html($value); ?>
|
226 |
+
</option>
|
227 |
+
<?php endforeach; ?>
|
228 |
+
</select>
|
229 |
+
<br/>
|
230 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
231 |
+
</td>
|
232 |
+
</tr>
|
233 |
+
<?php
|
234 |
+
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_location_event_list_limit', sprintf(__( "Controls how many events being held at a location are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_LOCATIONNEXTEVENTS</code>') );
|
235 |
+
echo $save_button;
|
236 |
+
?>
|
237 |
+
</table>
|
238 |
+
</div> <!-- . inside -->
|
239 |
+
</div> <!-- .postbox -->
|
240 |
+
|
241 |
+
<div class="postbox " id="em-opt-location-archives" >
|
242 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s List/Archives','events-manager'),__('Location','events-manager')); ?></span></h3>
|
243 |
+
<div class="inside">
|
244 |
+
<table class="form-table">
|
245 |
+
<tr>
|
246 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('Locations','events-manager')); ?></th>
|
247 |
+
<td>
|
248 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_locations_page', 'selected'=>get_option('dbem_locations_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'events-manager'),__('Locations','events-manager')) )); ?>
|
249 |
+
<br />
|
250 |
+
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page. If you do not select a %s page, to display lists you can enable archives or use the appropriate shortcodes and/or template tags.','events-manager'),__('locations','events-manager'),__('locations','events-manager')); ?></em>
|
251 |
+
</td>
|
252 |
+
</tr>
|
253 |
+
<?php
|
254 |
+
em_options_radio_binary ( __( 'Show locations search?', 'events-manager'), 'dbem_locations_page_search_form', __( "If set to yes, a search form will appear just above your list of locations.", 'events-manager') );
|
255 |
+
?>
|
256 |
+
<tr class="em-header">
|
257 |
+
<td colspan="2">
|
258 |
+
<h4><?php echo sprintf(__('WordPress %s Archives','events-manager'), __('Location','events-manager')); ?></h4>
|
259 |
+
<p><?php echo sprintf(__('%s custom post types can have archives, just like normal WordPress posts. If enabled, should you visit your base slug url %s and you will see an post-formatted archive of previous %s', 'events-manager'), __('Location','events-manager'), '<code>'.home_url().'/'.esc_html(get_option('dbem_cp_locations_slug',EM_POST_TYPE_LOCATION_SLUG)).'/</code>', __('locations','events-manager')); ?></p>
|
260 |
+
<p><?php echo sprintf(__('Note that assigning a %s page above will override this archive if the URLs collide (which is the default settings, and is recommended for maximum plugin compatibility). You can have both at the same time, but you must ensure that your page and %s slugs are different.','events-manager'), __('locations','events-manager'), __('location','events-manager')); ?></p>
|
261 |
+
</td>
|
262 |
+
</tr>
|
263 |
+
<tbody class="em-location-archive-options">
|
264 |
+
<?php
|
265 |
+
em_options_radio_binary ( __( 'Enable Archives?', 'events-manager'), 'dbem_cp_locations_has_archive', __( "Allow WordPress post-style archives.", 'events-manager') );
|
266 |
+
?>
|
267 |
+
</tbody>
|
268 |
+
<tbody class="em-location-archive-options em-location-archive-sub-options">
|
269 |
+
<tr valign="top">
|
270 |
+
<th scope="row"><?php _e('Default archive ordering','events-manager'); ?></th>
|
271 |
+
<td>
|
272 |
+
<select name="dbem_locations_default_archive_orderby" >
|
273 |
+
<?php
|
274 |
+
$locations_list_orderby_options = apply_filters('em_settings_locations_default_archive_orderby_ddm', array(
|
275 |
+
'_location_country' => sprintf(__('Order by %s','events-manager'),__('Country','events-manager')),
|
276 |
+
'_location_town' => sprintf(__('Order by %s','events-manager'),__('Town','events-manager')),
|
277 |
+
'title' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager'))
|
278 |
+
));
|
279 |
+
?>
|
280 |
+
<?php foreach($locations_list_orderby_options as $key => $value) : ?>
|
281 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
282 |
+
<?php echo esc_html($value) ?>
|
283 |
+
</option>
|
284 |
+
<?php endforeach; ?>
|
285 |
+
</select>
|
286 |
+
<select name="dbem_locations_default_archive_order" >
|
287 |
+
<?php
|
288 |
+
$ascending = __('Ascending','events-manager');
|
289 |
+
$descending = __('Descending','events-manager');
|
290 |
+
$locations_list_order_options = apply_filters('em_settings_locations_default_archive_order_ddm', array(
|
291 |
+
'ASC' => __('Ascending','events-manager'),
|
292 |
+
'DESC' => __('Descending','events-manager')
|
293 |
+
));
|
294 |
+
?>
|
295 |
+
<?php foreach( $locations_list_order_options as $key => $value) : ?>
|
296 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
297 |
+
<?php echo esc_html($value) ?>
|
298 |
+
</option>
|
299 |
+
<?php endforeach; ?>
|
300 |
+
</select>
|
301 |
+
</td>
|
302 |
+
</tr>
|
303 |
+
</tbody>
|
304 |
+
<tr class="em-header">
|
305 |
+
<td colspan="2">
|
306 |
+
<h4><?php echo _e('General settings','events-manager'); ?></h4>
|
307 |
+
</td>
|
308 |
+
</tr>
|
309 |
+
<?php
|
310 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_locations_archive_formats', sprintf($format_override_tip,__('locations','events-manager')));
|
311 |
+
em_options_radio_binary ( __( 'Override Excerpts with Formats?', 'events-manager'), 'dbem_cp_locations_excerpt_formats', sprintf($format_override_tip,__('locations','events-manager')));
|
312 |
+
em_options_radio_binary ( __( 'Include in WordPress Searches?', 'events-manager'), 'dbem_cp_locations_search_results', sprintf(__( "Allow %s to appear in the built-in search results.", 'events-manager'),__('locations','events-manager')) );
|
313 |
+
?>
|
314 |
+
<tr class="em-header">
|
315 |
+
<td colspan="2">
|
316 |
+
<h4><?php echo sprintf(__('Default %s list options','events-manager'), __('location','events-manager')); ?></h4>
|
317 |
+
<p><?php _e('These can be overridden when using shortcode or template tags.','events-manager'); ?></p>
|
318 |
+
</td>
|
319 |
+
</tr>
|
320 |
+
<tr valign="top" id='dbem_locations_default_orderby_row'>
|
321 |
+
<th scope="row"><?php _e('Default list ordering','events-manager'); ?></th>
|
322 |
+
<td>
|
323 |
+
<select name="dbem_locations_default_orderby" >
|
324 |
+
<?php
|
325 |
+
$locations_list_orderby_options = apply_filters('em_settings_locations_default_orderby_ddm', array(
|
326 |
+
'location_country' => sprintf(__('Order by %s','events-manager'),__('Country','events-manager')),
|
327 |
+
'location_town' => sprintf(__('Order by %s','events-manager'),__('Town','events-manager')),
|
328 |
+
'location_name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager'))
|
329 |
+
));
|
330 |
+
?>
|
331 |
+
<?php foreach($locations_list_orderby_options as $key => $value) : ?>
|
332 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_orderby')) ? "selected='selected'" : ''; ?>>
|
333 |
+
<?php echo esc_html($value) ?>
|
334 |
+
</option>
|
335 |
+
<?php endforeach; ?>
|
336 |
+
</select>
|
337 |
+
<select name="dbem_locations_default_order" >
|
338 |
+
<?php
|
339 |
+
$ascending = __('Ascending','events-manager');
|
340 |
+
$descending = __('Descending','events-manager');
|
341 |
+
$locations_list_order_options = apply_filters('em_settings_locations_default_order_ddm', array(
|
342 |
+
'ASC' => __('Ascending','events-manager'),
|
343 |
+
'DESC' => __('Descending','events-manager')
|
344 |
+
));
|
345 |
+
?>
|
346 |
+
<?php foreach( $locations_list_order_options as $key => $value) : ?>
|
347 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_locations_default_order')) ? "selected='selected'" : ''; ?>>
|
348 |
+
<?php echo esc_html($value) ?>
|
349 |
+
</option>
|
350 |
+
<?php endforeach; ?>
|
351 |
+
</select>
|
352 |
+
</td>
|
353 |
+
</tr>
|
354 |
+
<?php
|
355 |
+
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_locations_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('locations','events-manager')) );
|
356 |
+
echo $save_button;
|
357 |
+
?>
|
358 |
+
</table>
|
359 |
+
</div> <!-- . inside -->
|
360 |
+
</div> <!-- .postbox -->
|
361 |
+
<?php endif; ?>
|
362 |
+
|
363 |
+
<?php if( get_option('dbem_categories_enabled') && !(EM_MS_GLOBAL && !is_main_site()) ): ?>
|
364 |
+
<div class="postbox " id="em-opt-categories-pages" >
|
365 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo __('Event Categories','events-manager'); ?></span></h3>
|
366 |
+
<div class="inside">
|
367 |
+
<div class="em-boxheader">
|
368 |
+
<p>
|
369 |
+
<?php echo sprintf(__('%s are a <a href="%s" target="_blank">WordPress custom taxonomy</a>.','events-manager'), __('Event Categories','events-manager'), 'http://codex.wordpress.org/Taxonomies');?>
|
370 |
+
<?php echo sprintf(__('%s can be displayed just like normal WordPress custom taxonomies in an archive-style format, however Events Manager by default allows you to completely change the standard look of these archives and use our own <a href="%s">custom formatting</a> methods.','events-manager'), __('Event Categories','events-manager'), EM_ADMIN_URL .'&page=events-manager-help#event-placeholders'); ?>
|
371 |
+
</p>
|
372 |
+
<p>
|
373 |
+
<?php echo sprintf(__('Due to how we change how this custom taxonomy is displayed when overriding with formats it is strongly advised that you assign a %s page below, which increases compatibility with various plugins and themes.','events-manager'), __('categories','events-manager')); ?>
|
374 |
+
<?php sprintf(__('<a href="%s">See some more information</a> on how %s work when overriding with formats.','events-manager'), '#', __('categories','events-manager')); //not ready yet, but make translatable ?>
|
375 |
+
</p>
|
376 |
+
</div>
|
377 |
+
<table class="form-table">
|
378 |
+
<tr>
|
379 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('Categories','events-manager')); ?></th>
|
380 |
+
<td>
|
381 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_categories_page','selected'=>get_option('dbem_categories_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'events-manager'),__('Categories','events-manager')) )); ?>
|
382 |
+
<br />
|
383 |
+
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page.','events-manager'),__('categories','events-manager')); ?></em>
|
384 |
+
</td>
|
385 |
+
</tr>
|
386 |
+
<tr class="em-header">
|
387 |
+
<td colspan="2">
|
388 |
+
<h4><?php echo _e('General settings','events-manager'); ?></h4>
|
389 |
+
<p><?php echo esc_html(sprintf(__('Viewing a general WordPress taxonomy page such as %s will show a list of events just like it would regular posts for a regular category or tag. Below you can edit things such as the order events are displayed, or completely override the archive look with our formats feature.','events-manager'), __('categories', 'events-manager'))); ?></p>
|
390 |
+
</td>
|
391 |
+
</tr>
|
392 |
+
<?php
|
393 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_categories_formats', sprintf($format_override_tip,__('categories','events-manager'))." ".__('Setting this to yes will make categories display as a page rather than an archive.', 'events-manager'), '', '.em-default-categories-archive-ordering', true);
|
394 |
+
?>
|
395 |
+
<tr valign="top" class="em-default-categories-archive-ordering">
|
396 |
+
<th scope="row"><?php _e('Default event archive ordering','events-manager'); ?></th>
|
397 |
+
<td>
|
398 |
+
<select name="dbem_categories_default_archive_orderby" >
|
399 |
+
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
400 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
401 |
+
<?php echo esc_html($value) ?>
|
402 |
+
</option>
|
403 |
+
<?php endforeach; ?>
|
404 |
+
</select>
|
405 |
+
<select name="dbem_categories_default_archive_order" >
|
406 |
+
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
407 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
408 |
+
<?php echo esc_html($value) ?>
|
409 |
+
</option>
|
410 |
+
<?php endforeach; ?>
|
411 |
+
</select>
|
412 |
+
<br /><?php echo esc_html(sprintf(__('When listing event archives for a %s, this order is applied.', 'events-manager'), __('category', 'events-manager'))); ?>
|
413 |
+
</td>
|
414 |
+
</tr>
|
415 |
+
<tr class="em-header">
|
416 |
+
<td colspan="2">
|
417 |
+
<h4><?php echo sprintf(__('Default %s list options','events-manager'), __('category','events-manager')); ?></h4>
|
418 |
+
<p><?php _e('These can be overridden when using shortcode or template tags.','events-manager'); ?></p>
|
419 |
+
</td>
|
420 |
+
</tr>
|
421 |
+
<tr valign="top" id='dbem_categories_default_orderby_row'>
|
422 |
+
<th scope="row"><?php _e('Default list ordering','events-manager'); ?></th>
|
423 |
+
<td>
|
424 |
+
<select name="dbem_categories_default_orderby" >
|
425 |
+
<?php
|
426 |
+
$categories_list_orderby_options = apply_filters('em_settings_categories_default_orderby_ddm', array(
|
427 |
+
'id' => sprintf(__('Order by %s','events-manager'),__('ID','events-manager')),
|
428 |
+
'count' => sprintf(__('Order by %s','events-manager'),__('Count','events-manager')),
|
429 |
+
'name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager')),
|
430 |
+
'slug' => sprintf(__('Order by %s','events-manager'),__('Slug','events-manager')),
|
431 |
+
'term_group' => sprintf(__('Order by %s','events-manager'),'term_group'),
|
432 |
+
));
|
433 |
+
?>
|
434 |
+
<?php foreach($categories_list_orderby_options as $key => $value) : ?>
|
435 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_orderby')) ? "selected='selected'" : ''; ?>>
|
436 |
+
<?php echo esc_html($value) ?>
|
437 |
+
</option>
|
438 |
+
<?php endforeach; ?>
|
439 |
+
</select>
|
440 |
+
<select name="dbem_categories_default_order" >
|
441 |
+
<?php
|
442 |
+
$ascending = __('Ascending','events-manager');
|
443 |
+
$descending = __('Descending','events-manager');
|
444 |
+
$categories_list_order_options = apply_filters('em_settings_categories_default_order_ddm', array(
|
445 |
+
'ASC' => __('Ascending','events-manager'),
|
446 |
+
'DESC' => __('Descending','events-manager')
|
447 |
+
));
|
448 |
+
?>
|
449 |
+
<?php foreach( $categories_list_order_options as $key => $value) : ?>
|
450 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_categories_default_order')) ? "selected='selected'" : ''; ?>>
|
451 |
+
<?php echo esc_html($value) ?>
|
452 |
+
</option>
|
453 |
+
<?php endforeach; ?>
|
454 |
+
</select>
|
455 |
+
<br /><?php echo __('When listing categories, this order is applied.', 'events-manager'); ?>
|
456 |
+
</td>
|
457 |
+
</tr>
|
458 |
+
<?php
|
459 |
+
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_categories_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('categories','events-manager')) );
|
460 |
+
?>
|
461 |
+
<tr class="em-header">
|
462 |
+
<td colspan="2">
|
463 |
+
<h4><?php echo sprintf(esc_html__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
|
464 |
+
<p><?php echo sprintf(esc_html__('The options below are applied to the %s placeholders.', 'events-manager'), '<code>#_CATEGORYPASTEVENTS</code>, <code>#_CATEGORYNEXTEVENTS</code>, <code>#_CATEGORYALLEVENTS</code>'); ?></p>
|
465 |
+
</td>
|
466 |
+
</tr>
|
467 |
+
<tr valign="top" id='dbem_category_events_default_orderby_row'>
|
468 |
+
<th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
|
469 |
+
<td>
|
470 |
+
<select name="dbem_category_event_list_orderby" >
|
471 |
+
<?php foreach($event_list_orderby_options as $key => $value) : ?>
|
472 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_category_event_list_orderby')) ? "selected='selected'" : ''; ?>>
|
473 |
+
<?php echo esc_html($value); ?>
|
474 |
+
</option>
|
475 |
+
<?php endforeach; ?>
|
476 |
+
</select>
|
477 |
+
<select name="dbem_category_event_list_order" >
|
478 |
+
<?php foreach( $event_list_order_options as $key => $value) : ?>
|
479 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_category_event_list_order')) ? "selected='selected'" : ''; ?>>
|
480 |
+
<?php echo esc_html($value); ?>
|
481 |
+
</option>
|
482 |
+
<?php endforeach; ?>
|
483 |
+
</select>
|
484 |
+
<br/>
|
485 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
486 |
+
</td>
|
487 |
+
</tr>
|
488 |
+
<?php
|
489 |
+
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_category_event_list_limit', sprintf(__( "Controls how many events belonging to a category are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_CATEGORYNEXTEVENTS</code>') );
|
490 |
+
echo $save_button;
|
491 |
+
?>
|
492 |
+
</table>
|
493 |
+
</div> <!-- . inside -->
|
494 |
+
</div> <!-- .postbox -->
|
495 |
+
<?php endif; ?>
|
496 |
+
|
497 |
+
<?php if( get_option('dbem_tags_enabled') ): //disabled for now, will add tag stuff later ?>
|
498 |
+
<div class="postbox " id="em-opt-tags-pages" >
|
499 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo __('Event Tags','events-manager'); ?></span></h3>
|
500 |
+
<div class="inside">
|
501 |
+
<div class="em-boxheader">
|
502 |
+
<p>
|
503 |
+
<?php echo sprintf(__('%s are a <a href="%s" target="_blank">WordPress custom taxonomy</a>.','events-manager'), __('Event Tags','events-manager'), 'http://codex.wordpress.org/Taxonomies');?>
|
504 |
+
<?php echo sprintf(__('%s can be displayed just like normal WordPress custom taxonomies in an archive-style format, however Events Manager by default allows you to completely change the standard look of these archives and use our own <a href="%s">custom formatting</a> methods.','events-manager'), __('Event Tags','events-manager'), EM_ADMIN_URL .'&page=events-manager-help#event-placeholders'); ?>
|
505 |
+
</p>
|
506 |
+
<p>
|
507 |
+
<?php echo sprintf(__('Due to how we change how this custom taxonomy is displayed when overriding with formats it is strongly advised that you assign a %s page below, which increases compatibility with various plugins and themes.','events-manager'), __('tags','events-manager')); ?>
|
508 |
+
<?php sprintf(__('<a href="%s">See some more information</a> on how %s work when overriding with formats.','events-manager'), '#', __('tags','events-manager')); //not ready yet, but make translatable ?>
|
509 |
+
</p>
|
510 |
+
</div>
|
511 |
+
<table class="form-table">
|
512 |
+
<tr>
|
513 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('Tags','events-manager')); ?></th>
|
514 |
+
<td>
|
515 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_tags_page','selected'=>get_option('dbem_tags_page'), 'show_option_none'=>sprintf(__('[No %s Page]', 'events-manager'),__('Tags','events-manager')) )); ?>
|
516 |
+
<br />
|
517 |
+
<em><?php echo sprintf(__( 'This option allows you to select which page to use as the %s page.','events-manager'),__('tags','events-manager'),__('tags','events-manager')); ?></em>
|
518 |
+
</td>
|
519 |
+
</tr>
|
520 |
+
<tr class="em-header">
|
521 |
+
<td colspan="2">
|
522 |
+
<h4><?php echo _e('General settings','events-manager'); ?></h4>
|
523 |
+
<p><?php echo esc_html(sprintf(__('Viewing a general WordPress taxonomy page such as %s will show a list of events just like it would regular posts for a regular category or tag. Below you can edit things such as the order events are displayed, or completely override the archive look with our formats feature.','events-manager'), __('tags', 'events-manager'))); ?></p>
|
524 |
+
</td>
|
525 |
+
</tr>
|
526 |
+
<?php
|
527 |
+
em_options_radio_binary ( __( 'Override with Formats?', 'events-manager'), 'dbem_cp_tags_formats', sprintf($format_override_tip,__('tags','events-manager')), '', '.em-default-tags-archive-ordering', true);
|
528 |
+
?>
|
529 |
+
<tr valign="top" class="em-default-tags-archive-ordering">
|
530 |
+
<th scope="row"><?php _e('Default event archive ordering','events-manager'); ?></th>
|
531 |
+
<td>
|
532 |
+
<select name="dbem_tags_default_archive_orderby" >
|
533 |
+
<?php foreach($event_archive_orderby_options as $key => $value) : ?>
|
534 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_archive_orderby')) ? "selected='selected'" : ''; ?>>
|
535 |
+
<?php echo esc_html($value) ?>
|
536 |
+
</option>
|
537 |
+
<?php endforeach; ?>
|
538 |
+
</select>
|
539 |
+
<select name="dbem_tags_default_archive_order" >
|
540 |
+
<?php foreach( $event_archive_order_options as $key => $value) : ?>
|
541 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_archive_order')) ? "selected='selected'" : ''; ?>>
|
542 |
+
<?php echo esc_html($value) ?>
|
543 |
+
</option>
|
544 |
+
<?php endforeach; ?>
|
545 |
+
</select>
|
546 |
+
<br /><?php echo esc_html(sprintf(__('When listing event archives for a %s, this order is applied.', 'events-manager'), __('tag', 'events-manager'))); ?>
|
547 |
+
</td>
|
548 |
+
</tr>
|
549 |
+
<tr class="em-header">
|
550 |
+
<td colspan="2">
|
551 |
+
<h4><?php echo sprintf(__('Default %s list options','events-manager'), __('tag','events-manager')); ?></h4>
|
552 |
+
<p><?php _e('These can be overridden when using shortcode or template tags.','events-manager'); ?></p>
|
553 |
+
</td>
|
554 |
+
</tr>
|
555 |
+
<tr valign="top" id='dbem_tags_default_orderby_row'>
|
556 |
+
<th scope="row"><?php _e('Default list ordering','events-manager'); ?></th>
|
557 |
+
<td>
|
558 |
+
<select name="dbem_tags_default_orderby" >
|
559 |
+
<?php
|
560 |
+
$tags_list_orderby_options = apply_filters('em_settings_tags_default_orderby_ddm', array(
|
561 |
+
'id' => sprintf(__('Order by %s','events-manager'),__('ID','events-manager')),
|
562 |
+
'count' => sprintf(__('Order by %s','events-manager'),__('Count','events-manager')),
|
563 |
+
'name' => sprintf(__('Order by %s','events-manager'),__('Name','events-manager')),
|
564 |
+
'slug' => sprintf(__('Order by %s','events-manager'),__('Slug','events-manager')),
|
565 |
+
'term_group' => sprintf(__('Order by %s','events-manager'),'term_group'),
|
566 |
+
));
|
567 |
+
?>
|
568 |
+
<?php foreach($tags_list_orderby_options as $key => $value) : ?>
|
569 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_orderby')) ? "selected='selected'" : ''; ?>>
|
570 |
+
<?php echo esc_html($value) ?>
|
571 |
+
</option>
|
572 |
+
<?php endforeach; ?>
|
573 |
+
</select>
|
574 |
+
<select name="dbem_tags_default_order" >
|
575 |
+
<?php
|
576 |
+
$ascending = __('Ascending','events-manager');
|
577 |
+
$descending = __('Descending','events-manager');
|
578 |
+
$tags_list_order_options = apply_filters('em_settings_tags_default_order_ddm', array(
|
579 |
+
'ASC' => __('Ascending','events-manager'),
|
580 |
+
'DESC' => __('Descending','events-manager')
|
581 |
+
));
|
582 |
+
?>
|
583 |
+
<?php foreach( $tags_list_order_options as $key => $value) : ?>
|
584 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tags_default_order')) ? "selected='selected'" : ''; ?>>
|
585 |
+
<?php echo esc_html($value) ?>
|
586 |
+
</option>
|
587 |
+
<?php endforeach; ?>
|
588 |
+
</select>
|
589 |
+
<br /><?php echo __('When listing tags, this order is applied.', 'events-manager'); ?>
|
590 |
+
</td>
|
591 |
+
</tr>
|
592 |
+
<?php
|
593 |
+
em_options_input_text ( __( 'List Limits', 'events-manager'), 'dbem_tags_default_limit', sprintf(__( "This will control how many %s are shown on one list by default.", 'events-manager'),__('tags','events-manager')) );
|
594 |
+
?>
|
595 |
+
<tr class="em-header">
|
596 |
+
<td colspan="2">
|
597 |
+
<h4><?php echo sprintf(esc_html__('Default %s list options','events-manager'), __('event','events-manager')); ?></h4>
|
598 |
+
<p><?php echo sprintf(esc_html__('The options below are applied to the %s placeholders.', 'events-manager'), '<code>#_TAGPASTEVENTS</code>, <code>#_TAGNEXTEVENTS</code>, <code>#_TAGALLEVENTS</code>'); ?></p>
|
599 |
+
</td>
|
600 |
+
</tr>
|
601 |
+
<tr valign="top" id='dbem_tag_events_default_orderby_row'>
|
602 |
+
<th scope="row"><?php _e('Default event list ordering','events-manager'); ?></th>
|
603 |
+
<td>
|
604 |
+
<select name="dbem_tag_event_list_orderby" >
|
605 |
+
<?php foreach($event_list_orderby_options as $key => $value) : ?>
|
606 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tag_event_list_orderby')) ? "selected='selected'" : ''; ?>>
|
607 |
+
<?php echo esc_html($value); ?>
|
608 |
+
</option>
|
609 |
+
<?php endforeach; ?>
|
610 |
+
</select>
|
611 |
+
<select name="dbem_tag_event_list_order" >
|
612 |
+
<?php foreach( $event_list_order_options as $key => $value) : ?>
|
613 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_tag_event_list_order')) ? "selected='selected'" : ''; ?>>
|
614 |
+
<?php echo esc_html($value); ?>
|
615 |
+
</option>
|
616 |
+
<?php endforeach; ?>
|
617 |
+
</select>
|
618 |
+
<br/>
|
619 |
+
<em><?php _e('When Events Manager displays lists of events the default behavior is ordering by start date in ascending order. To change this, modify the values above.','events-manager'); ?></em>
|
620 |
+
</td>
|
621 |
+
</tr>
|
622 |
+
<?php
|
623 |
+
em_options_input_text ( __( 'Event List Limits', 'events-manager'), 'dbem_tag_event_list_limit', sprintf(__( "Controls how many events belonging to a tag are shown per page when using placeholders such as %s. Leave blank for no limit.", 'events-manager'), '<code>#_TAGNEXTEVENTS</code>') );
|
624 |
+
echo $save_button; ?>
|
625 |
+
</table>
|
626 |
+
</div> <!-- . inside -->
|
627 |
+
</div> <!-- .postbox -->
|
628 |
+
<?php endif; ?>
|
629 |
+
|
630 |
+
<div class="postbox " id="em-opt-other-pages" >
|
631 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3><span><?php echo sprintf(__('%s Pages','events-manager'),__('Other','events-manager')); ?></span></h3>
|
632 |
+
<div class="inside">
|
633 |
+
<p class="em-boxheader"><?php _e('These pages allow you to provide an event management interface outside the admin area on whatever page you want on your website. Bear in mind that this is overridden by BuddyPress if activated.', 'events-manager'); ?></p>
|
634 |
+
<table class="form-table">
|
635 |
+
<?php
|
636 |
+
$other_pages_tip = 'Using the %s shortcode, you can allow users to manage %s outside the admin area.';
|
637 |
+
?>
|
638 |
+
<tr class="em-header">
|
639 |
+
<td colspan="2">
|
640 |
+
<h4><?php _e('My Bookings','events-manager'); ?></h4>
|
641 |
+
<p><?php _e('This page is where people that have made bookings for an event can go and view their previous bookings.','events-manager'); ?>
|
642 |
+
</td>
|
643 |
+
</tr>
|
644 |
+
<tr>
|
645 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('My bookings','events-manager')); ?>
|
646 |
+
</th>
|
647 |
+
<td>
|
648 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_my_bookings_page', 'selected'=>get_option('dbem_my_bookings_page'), 'show_option_none'=>'['.__('None', 'events-manager').']' )); ?>
|
649 |
+
<br />
|
650 |
+
<em><?php echo sprintf(__('Users can view their bookings for other events on this page.','events-manager'),'<code>[my_bookings]</code>',__('bookings','events-manager')); ?></em>
|
651 |
+
</td>
|
652 |
+
</tr>
|
653 |
+
<tr valign="top" id='dbem_bookings_default_orderby_row'>
|
654 |
+
<th scope="row"><?php _e('Default list ordering','events-manager'); ?></th>
|
655 |
+
<td>
|
656 |
+
<select name="dbem_bookings_default_orderby" >
|
657 |
+
<?php
|
658 |
+
$orderby_options = apply_filters('em_settings_bookings_default_orderby_ddm', array(
|
659 |
+
'event_name' => sprintf(__('Order by %s','events-manager'),__('Event Name','events-manager')),
|
660 |
+
'event_start_date' => sprintf(__('Order by %s','events-manager'),__('Start Date','events-manager')),
|
661 |
+
'booking_date' => sprintf(__('Order by %s','events-manager'),__('Booking Date','events-manager'))
|
662 |
+
));
|
663 |
+
?>
|
664 |
+
<?php foreach($orderby_options as $key => $value) : ?>
|
665 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_bookings_default_orderby')) ? "selected='selected'" : ''; ?>>
|
666 |
+
<?php echo esc_html($value) ?>
|
667 |
+
</option>
|
668 |
+
<?php endforeach; ?>
|
669 |
+
</select>
|
670 |
+
<select name="dbem_bookings_default_order" >
|
671 |
+
<?php
|
672 |
+
$ascending = __('Ascending','events-manager');
|
673 |
+
$descending = __('Descending','events-manager');
|
674 |
+
$order_options = apply_filters('em_settings_bookings_default_order_ddm', array(
|
675 |
+
'ASC' => __('Ascending','events-manager'),
|
676 |
+
'DESC' => __('Descending','events-manager')
|
677 |
+
));
|
678 |
+
?>
|
679 |
+
<?php foreach( $order_options as $key => $value) : ?>
|
680 |
+
<option value='<?php echo esc_attr($key) ?>' <?php echo ($key == get_option('dbem_bookings_default_order')) ? "selected='selected'" : ''; ?>>
|
681 |
+
<?php echo esc_html($value) ?>
|
682 |
+
</option>
|
683 |
+
<?php endforeach; ?>
|
684 |
+
</select>
|
685 |
+
</td>
|
686 |
+
</tr>
|
687 |
+
<tr class="em-header">
|
688 |
+
<td colspan="2">
|
689 |
+
<h4><?php _e('Front-end management pages','events-manager'); ?></h4>
|
690 |
+
<p><?php _e('Users with the relevant permissions can manage their own events and bookings to these events on the following pages.','events-manager'); ?></p>
|
691 |
+
</td>
|
692 |
+
</tr>
|
693 |
+
<tr>
|
694 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('Edit events','events-manager')); ?></th>
|
695 |
+
<td>
|
696 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_edit_events_page', 'selected'=>get_option('dbem_edit_events_page'), 'show_option_none'=>'['.__('None', 'events-manager').']' )); ?>
|
697 |
+
<br />
|
698 |
+
<em><?php echo sprintf(__('Users can view, add and edit their %s on this page.','events-manager'),__('events','events-manager')); ?></em>
|
699 |
+
</td>
|
700 |
+
</tr>
|
701 |
+
<tr>
|
702 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('Edit locations','events-manager')); ?></th>
|
703 |
+
<td>
|
704 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_edit_locations_page', 'selected'=>get_option('dbem_edit_locations_page'), 'show_option_none'=>'['.__('None', 'events-manager').']' )); ?>
|
705 |
+
<br />
|
706 |
+
<em><?php echo sprintf(__('Users can view, add and edit their %s on this page.','events-manager'),__('locations','events-manager')); ?></em>
|
707 |
+
</td>
|
708 |
+
</tr>
|
709 |
+
<tr>
|
710 |
+
<th><?php echo sprintf(__( '%s page', 'events-manager'),__('Manage bookings','events-manager')); ?></th>
|
711 |
+
<td>
|
712 |
+
<?php wp_dropdown_pages(array('name'=>'dbem_edit_bookings_page', 'selected'=>get_option('dbem_edit_bookings_page'), 'show_option_none'=>'['.__('None', 'events-manager').']' )); ?>
|
713 |
+
<br />
|
714 |
+
<em><?php _e('Users can manage bookings for their events on this page.','events-manager'); ?></em>
|
715 |
+
</td>
|
716 |
+
</tr>
|
717 |
+
<?php echo $save_button; ?>
|
718 |
+
</table>
|
719 |
+
</div> <!-- . inside -->
|
720 |
+
</div> <!-- .postbox -->
|
721 |
+
|
722 |
+
<?php do_action('em_options_page_footer_pages'); ?>
|
723 |
+
|
724 |
+
</div> <!-- .em-menu-pages -->
|
trunk/admin/settings/updates/timezone-backcompat.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//This file will handle upgradeing from EM < 5.9 for timezones, removing the unecessary postmeta fields.
|
3 |
+
function em_admin_update_timezone_backcompat_site( $site_id = false ){
|
4 |
+
global $wpdb;
|
5 |
+
if( is_multisite() && $site_id != false ){ switch_to_blog($site_id); }
|
6 |
+
$sql = $wpdb->prepare('DELETE FROM '.$wpdb->postmeta.' WHERE meta_key=%s OR meta_key=%s', array('_start_ts', '_end_ts'));
|
7 |
+
$result = $wpdb->query($sql);
|
8 |
+
if( $result !== false && !is_multisite() ){
|
9 |
+
EM_Options::remove('updates', 'timezone-backcompat');
|
10 |
+
EM_Admin_Notices::remove('date_time_migration');
|
11 |
+
}
|
12 |
+
if( is_multisite() && $site_id != false ){ restore_current_blog(); }
|
13 |
+
return $result !== false;
|
14 |
+
}
|
15 |
+
|
16 |
+
function em_admin_update_timezone_backcompat(){
|
17 |
+
if( !empty($_REQUEST['confirmed']) && check_admin_referer('em_timezone_backcompat_confirmed') && em_wp_is_super_admin() ){
|
18 |
+
global $wpdb, $EM_Notices;
|
19 |
+
if( em_admin_update_timezone_backcompat_site() ){
|
20 |
+
$EM_Notices->add_confirm(__('You have successfully finalized upgrading your site.', 'events-manager'), true);
|
21 |
+
$redirect = esc_url_raw( remove_query_arg(array('action','update','confirmed','_wpnonce')) );
|
22 |
+
wp_safe_redirect($redirect);
|
23 |
+
exit();
|
24 |
+
}else{
|
25 |
+
$EM_Notices->add_error(__('There was an error upgrading your site, please try again or contact support.', 'events-manager'), true);
|
26 |
+
$redirect = esc_url_raw( remove_query_arg(array('confirmed','_wpnonce')) );
|
27 |
+
wp_safe_redirect($redirect);
|
28 |
+
exit();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
add_action('em_admin_update_timezone-backcompat', 'em_admin_update_timezone_backcompat');
|
33 |
+
|
34 |
+
function em_admin_update_settings_timezone_backcompat(){
|
35 |
+
if( is_multisite() ) return;
|
36 |
+
?>
|
37 |
+
<div>
|
38 |
+
<h4 style="color:#ca4a1f;"><?php esc_html_e ( 'Finalize Timezones Upgrade', 'events-manager'); ?></h4>
|
39 |
+
<p><?php esc_html_e('Events Manager 5.9 introduced timezone functionality, which does not require certain fields in your database. To maintain backwards compatibility with earlier versions, these fields will still be created.','events-manager'); ?></p>
|
40 |
+
<p><?php esc_html_e('This is not a required step to enable any extra functionality, and therefore is not urgent. Only until you are happy with the upgrade and are confident you don\'t need to downgrade, finalize your upgrade by deleting and discontinuing these fields.','events-manager'); ?></p>
|
41 |
+
<p><a href="<?php echo esc_url(EM_ADMIN_URL.'&page=events-manager-options&action=update&update_action=timezone-backcompat'); ?>" class="button-secondary"><?php esc_html_e ( 'Finalize Timezones Upgrade', 'events-manager'); ?></a>
|
42 |
+
</div>
|
43 |
+
<?php
|
44 |
+
}
|
45 |
+
add_action('em_admin_update_settings_timezone-backcompat', 'em_admin_update_settings_timezone_backcompat');
|
46 |
+
|
47 |
+
function em_admin_update_settings_confirm_timezone_backcompat(){
|
48 |
+
?>
|
49 |
+
<div class="wrap">
|
50 |
+
<h1><?php esc_html_e ( 'Finalize Timezones Upgrade', 'events-manager'); ?></h1>
|
51 |
+
<p><?php esc_html_e('Events Manager 5.9 introduced timezone functionality, which does not require certain fields in your database. To maintain backwards compatibility with earlier versions, these fields will still be created.','events-manager'); ?></p>
|
52 |
+
<p><?php esc_html_e('This is not a required step to enable any extra functionality, and therefore is not urgent. Only until you are happy with the upgrade and are confident you don\'t need to downgrade, finalize your upgrade by deleting and discontinuing these fields.','events-manager'); ?></p>
|
53 |
+
<p style="font-weight:bold;"><?php esc_html_e('We recommend you back up your database! Once the upgrade is finalized, you cannot downgrade to an earlier version of the plugin. This cannot be undone.','events-manager')?></p>
|
54 |
+
<p>
|
55 |
+
<a href="<?php echo esc_url(add_query_arg(array('_wpnonce' => wp_create_nonce('em_timezone_backcompat_confirmed'), 'confirmed'=>1))); ?>" class="button-primary"><?php _e('Finalize Timezones Upgrade','events-manager'); ?></a>
|
56 |
+
<a href="<?php echo esc_url(em_wp_get_referer()); ?>" class="button-secondary"><?php _e('Cancel','events-manager'); ?></a>
|
57 |
+
</p>
|
58 |
+
</div>
|
59 |
+
<?php
|
60 |
+
}
|
61 |
+
add_action('em_admin_update_settings_confirm_timezone-backcompat', 'em_admin_update_settings_confirm_timezone_backcompat');
|
62 |
+
|
63 |
+
function em_admin_update_ms_settings_timezone_backcompat(){
|
64 |
+
?>
|
65 |
+
<div>
|
66 |
+
<br><hr>
|
67 |
+
<h2 style="color:#ca4a1f;"><?php esc_html_e( 'Finalize Timezones Upgrade', 'events-manager'); ?></h2>
|
68 |
+
<p><?php esc_html_e('Events Manager 5.9 introduced timezone functionality, which does not require certain fields in your database. To maintain backwards compatibility with earlier versions, these fields will still be created.','events-manager'); ?></p>
|
69 |
+
<p><?php esc_html_e('This is not a required step to enable any extra functionality, and therefore is not urgent. Only until you are happy with the upgrade and are confident you don\'t need to downgrade, finalize your upgrade by deleting and discontinuing these fields.','events-manager'); ?></p>
|
70 |
+
<p style="font-weight:bold;"><?php esc_html_e('We recommend you back up your database! Once the upgrade is finalized, you cannot downgrade to an earlier version of the plugin. This cannot be undone.','events-manager')?></p>
|
71 |
+
<p>
|
72 |
+
<a href="<?php echo esc_url(add_query_arg(array('action'=>'timezone-backcompat', '_wpnonce' => wp_create_nonce('em_ms_finalize_timezone_upgrade')))); ?>" class="button-primary">
|
73 |
+
<?php esc_html_e ( 'Finalize Timezones Upgrade', 'events-manager'); ?>
|
74 |
+
</a>
|
75 |
+
</p>
|
76 |
+
</div>
|
77 |
+
<?php
|
78 |
+
}
|
79 |
+
add_action('em_admin_update_ms_settings_timezone-backcompat', 'em_admin_update_ms_settings_timezone_backcompat');
|
80 |
+
|
81 |
+
function em_admin_update_ms_timezone_backcompat(){
|
82 |
+
if( check_admin_referer('em_ms_finalize_timezone_upgrade') && em_wp_is_super_admin() ){
|
83 |
+
global $current_site,$wpdb;
|
84 |
+
$blog_ids = $wpdb->get_col('SELECT blog_id FROM '.$wpdb->blogs.' WHERE site_id='.$current_site->id);
|
85 |
+
$result = true;
|
86 |
+
echo '<h2 style="color:#ca4a1f;">'. esc_html__( 'Finalize Timezones Upgrade', 'events-manager') .'</h2>';
|
87 |
+
echo '<ul>';
|
88 |
+
$plugin_basename = plugin_basename(EM_DIR.'/events-manager.php');
|
89 |
+
$network_active = is_plugin_active_for_network($plugin_basename);
|
90 |
+
foreach($blog_ids as $blog_id){
|
91 |
+
if( $network_active || is_plugin_active($plugin_basename.'/events-manager.php') ){
|
92 |
+
if( em_admin_update_timezone_backcompat_site($blog_id) ){
|
93 |
+
echo "<li>".sprintf(_x('Updated %s.', 'Multisite Blog Update','events-manager'), get_blog_option($blog_id, 'blogname'))."</li>";
|
94 |
+
}else{
|
95 |
+
echo "<li>".sprintf(_x('Failed to update %s.', 'Multisite Blog Update','events-manager'), get_blog_option($blog_id, 'blogname'))."</li>";
|
96 |
+
$result = false;
|
97 |
+
}
|
98 |
+
}else{
|
99 |
+
echo "<li>".sprintf(_x('%s does not have Events Manager activated.', 'Multisite Blog Update','events-manager'), get_blog_option($blog_id, 'blogname'))."</li>";
|
100 |
+
}
|
101 |
+
}
|
102 |
+
echo '</ul>';
|
103 |
+
if( $result ){
|
104 |
+
EM_Admin_Notices::remove('date_time_migration', true);
|
105 |
+
EM_Options::site_remove('updates', 'timezone-backcompat');
|
106 |
+
echo "<p>".esc_html__('Update process has finished.', 'events-manager')."</p>";
|
107 |
+
}else{
|
108 |
+
echo "<p>".esc_html__('An error has occurred, not all sites were upgraded successfully.', 'events-manager')."</p>";
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
add_action('em_admin_update_ms_timezone-backcompat', 'em_admin_update_ms_timezone_backcompat');
|
trunk/admin/settings/wpfc-admin.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adds a note to the event post type in the admin area, so it's obvious EM is interfering.
|
4 |
+
*/
|
5 |
+
function wpfc_admin_options_post_type_event(){
|
6 |
+
echo " - <i>powered by Events Manager</i>";
|
7 |
+
}
|
8 |
+
add_action('wpfc_admin_options_post_type_event','wpfc_admin_options_post_type_event');
|
9 |
+
|
10 |
+
function wpfc_em_admin_notice(){
|
11 |
+
if( !empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-fullcalendar'){
|
12 |
+
?>
|
13 |
+
<div class="updated"><p><?php echo sprintf(__('If you choose the Event post type whilst Events Manager is activated, you can also visit the <a href="%s">Events Manager settings page</a> for a few more options when displaying event information on your calendar.','events-manager'), admin_url('edit.php?post_type='.EM_POST_TYPE_EVENT.'&page=events-manager-options')); ?></p></div>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
}
|
17 |
+
add_action('admin_notices', 'wpfc_em_admin_notice');
|
18 |
+
|
19 |
+
function wpfc_em_admin_options(){
|
20 |
+
?>
|
21 |
+
<div class="postbox " >
|
22 |
+
<div class="handlediv" title="<?php __('Click to toggle', 'events-manager'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Full Calendar Options', 'events-manager'); ?> </span></h3>
|
23 |
+
<div class="inside">
|
24 |
+
<p class="em-boxheader"><?php echo sprintf(__('Looking for the rest of the FullCalendar Options? They\'ve moved <a href="%s">here</a>, the options below are for overriding specific bits relevant to Events Manager.','events-manager'), admin_url('options-general.php?page=wp-fullcalendar')); ?></p>
|
25 |
+
<table class='form-table'>
|
26 |
+
<?php
|
27 |
+
global $events_placeholder_tip, $save_button;
|
28 |
+
em_options_radio_binary ( __( 'Override calendar on events page?', 'events-manager'), 'dbem_emfc_override_calendar', __( 'If set to yes, the FullCalendar will be used instead of the standard calendar on the events page.', 'events-manager') );
|
29 |
+
em_options_radio_binary ( __( 'Override calendar shortcode?', 'events-manager'), 'dbem_emfc_override_shortcode', __( 'Overrides the default calendar shortcode. You can also use [events_fullcalendar] instead.','events-manager') );
|
30 |
+
em_options_input_text ( __( 'Event title format', 'events-manager'), 'dbem_emfc_full_calendar_event_format', __('HTML is not accepted.','events-manager').' '.$events_placeholder_tip, '#_EVENTNAME' );
|
31 |
+
em_options_textarea( __( 'Event tooltips format', 'events-manager'), 'dbem_emfc_qtips_format', __('If you enable tips, this information will be shown, which can include HTML.','events-manager').' '.$events_placeholder_tip, '#_EVENTNAME' );$positions_options = array();
|
32 |
+
?>
|
33 |
+
</table>
|
34 |
+
<?php echo $save_button; ?>
|
35 |
+
</div> <!-- . inside -->
|
36 |
+
</div> <!-- .postbox -->
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
add_action('em_options_page_footer', 'wpfc_em_admin_options');
|
40 |
+
|
41 |
+
function wpfc_em_install(){
|
42 |
+
//check for updates - try adding one option, if it works then it's a first time install so add more
|
43 |
+
if( current_user_can('manage_options') && get_option('dbem_emfc_full_calendar_event_format', false) ){
|
44 |
+
add_option('dbem_emfc_full_calendar_event_format','#_EVENTTIMES - #_EVENTNAME');
|
45 |
+
add_option('dbem_emfc_qtips_format', '{has_image}<div style="float:left; margin:5px 10px 5px 0px;">#_EVENTIMAGE{75,75}</div>{/has_image}#_EVENTEXCERPT');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
add_action('init', 'wpfc_em_install');
|
trunk/buddypress/bp-em-activity.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// This file handles hooks/filter requiring activity stream publications
|
3 |
+
|
4 |
+
/**
|
5 |
+
* bp_em_record_activity()
|
6 |
+
*
|
7 |
+
* If the activity stream component is installed, this function will record activity items for your
|
8 |
+
* component.
|
9 |
+
*/
|
10 |
+
function bp_em_record_activity( $args = '' ) {
|
11 |
+
if ( !function_exists( 'bp_activity_add' ) )
|
12 |
+
return false;
|
13 |
+
|
14 |
+
$defaults = array(
|
15 |
+
'id' => false,
|
16 |
+
'user_id' => '',
|
17 |
+
'action' => '',
|
18 |
+
'content' => '',
|
19 |
+
'primary_link' => '',
|
20 |
+
'component' => 'events-manager',
|
21 |
+
'type' => false,
|
22 |
+
'item_id' => false,
|
23 |
+
'secondary_item_id' => false,
|
24 |
+
'recorded_time' => gmdate( "Y-m-d H:i:s" ),
|
25 |
+
'hide_sitewide' => false
|
26 |
+
);
|
27 |
+
|
28 |
+
$r = wp_parse_args( $args, $defaults );
|
29 |
+
extract( $r );
|
30 |
+
return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
function em_bp_register_activity_actions() {
|
34 |
+
|
35 |
+
if ( !bp_is_active( 'events' ) ) {
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
$bp = buddypress();
|
40 |
+
|
41 |
+
// @todo - Figure out why adding a second bp_activity_set_action creates two 'Bookings' actions in backend and different booking status front-end e.g. when friendships created/accepted do not
|
42 |
+
bp_activity_set_action(
|
43 |
+
$bp->events->id,
|
44 |
+
'new_booking',
|
45 |
+
__( 'Bookings', 'events-manager'),
|
46 |
+
'em_bp_events_format_activity_action_bookings',
|
47 |
+
__( 'Bookings', 'events-manager'),
|
48 |
+
array( 'activity', 'member' )
|
49 |
+
);
|
50 |
+
/*
|
51 |
+
bp_activity_set_action(
|
52 |
+
$bp->events->id,
|
53 |
+
'booking_cancelled',
|
54 |
+
__( 'Booking Cancelled', 'events-manager'),
|
55 |
+
'em_bp_events_format_activity_action_bookings',
|
56 |
+
__( 'Bookings', 'events-manager'),
|
57 |
+
array( 'activity', 'member' )
|
58 |
+
);
|
59 |
+
*/
|
60 |
+
|
61 |
+
bp_activity_set_action(
|
62 |
+
$bp->events->id,
|
63 |
+
'new_event',
|
64 |
+
__('New Event','events-manager'),
|
65 |
+
'em_bp_events_format_activity_action_events',
|
66 |
+
__( 'Events', 'events-manager'),
|
67 |
+
array( 'activity', 'member' )
|
68 |
+
);
|
69 |
+
}
|
70 |
+
add_action( 'bp_register_activity_actions', 'em_bp_register_activity_actions' );
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Not yet used fully - formats booking-related actions
|
74 |
+
* @param string $action
|
75 |
+
* @param object $activity
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
function em_bp_events_format_activity_action_bookings( $action, $activity ) {
|
79 |
+
return '';
|
80 |
+
$member_link = bp_core_get_userlink( $activity->user_id );
|
81 |
+
$EM_Booking = em_get_booking( $activity->item );
|
82 |
+
|
83 |
+
$action = '';
|
84 |
+
switch ($activity->type){
|
85 |
+
case 'new_booking':
|
86 |
+
if( $activity->component == 'groups' ){
|
87 |
+
$action = sprintf(__('%s is attending %s of the group %s.','events-manager'), $member_link, $event_link, $group_link );
|
88 |
+
}else{
|
89 |
+
$action = sprintf(__('%s is attending %s.','events-manager'), $member_link, $event_link );
|
90 |
+
}
|
91 |
+
break;
|
92 |
+
case 'cancelled_booking':
|
93 |
+
if( $activity->component == 'groups' ){
|
94 |
+
$action = sprintf(__('%s will not be attending %s of group %s anymore.','events-manager'), $user_link, $event_link, $group_link );
|
95 |
+
}else{
|
96 |
+
$action = sprintf(__('%s will not be attending %s anymore.','events-manager'), $user_link, $event_link );
|
97 |
+
}
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
|
101 |
+
return apply_filters( 'bp_events_format_activity_action_bookings', $action, $activity );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Not yet used fully - formats event-related actions
|
106 |
+
* @param string $action
|
107 |
+
* @param object $activity
|
108 |
+
* @return string
|
109 |
+
*/
|
110 |
+
function em_bp_events_format_activity_action_events( $action, $activity ) {
|
111 |
+
return '';
|
112 |
+
$member_link = bp_core_get_userlink( $activity->user_id );
|
113 |
+
$EM_Event = em_get_event( $activity->item_id );
|
114 |
+
|
115 |
+
$action = sprintf(__('%s added the event %s','events-manager'), $member_link, $EM_Event->output('#_EVENTLINK') );
|
116 |
+
|
117 |
+
return apply_filters( 'bp_events_format_activity_action_events', $action, $activity );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Records new events to the activity stream.
|
122 |
+
* @param unknown_type $result
|
123 |
+
* @param unknown_type $EM_Event
|
124 |
+
* @return unknown
|
125 |
+
*/
|
126 |
+
function bp_em_record_activity_event_save( $result, $EM_Event ){
|
127 |
+
if( $result && $EM_Event->event_status == 1 && $EM_Event->get_previous_status() != 1 ){
|
128 |
+
$user = get_userdata($EM_Event->event_owner);
|
129 |
+
$member_link = bp_core_get_user_domain($user->ID);
|
130 |
+
if( empty($EM_Event->group_id) ){
|
131 |
+
bp_em_record_activity( array(
|
132 |
+
'user_id' => $user->ID,
|
133 |
+
'action' => sprintf(__('%s added the event %s','events-manager'), "<a href='".$member_link."'>".$user->display_name."</a>", $EM_Event->output('#_EVENTLINK') ),
|
134 |
+
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
135 |
+
'type' => 'new_event',
|
136 |
+
'item_id' => $EM_Event->event_id,
|
137 |
+
'hide_sitewide' => $EM_Event->event_private
|
138 |
+
));
|
139 |
+
}else{
|
140 |
+
//tis a group event
|
141 |
+
$group = new BP_Groups_Group($EM_Event->group_id);
|
142 |
+
bp_em_record_activity( array(
|
143 |
+
'user_id' => $user->ID,
|
144 |
+
'action' => sprintf(__('%s added the event %s to %s.','events-manager'), "<a href='".$member_link."'>".$user->display_name."</a>", $EM_Event->output('#_EVENTLINK'), '<a href="'.bp_get_group_permalink($group).'">'.bp_get_group_name($group).'</a>' ),
|
145 |
+
'component' => 'groups',
|
146 |
+
'type' => 'new_event',
|
147 |
+
'item_id' => $EM_Event->group_id,
|
148 |
+
'hide_sitewide' => $EM_Event->event_private
|
149 |
+
));
|
150 |
+
}
|
151 |
+
}
|
152 |
+
return $result;
|
153 |
+
}
|
154 |
+
add_filter('em_event_save','bp_em_record_activity_event_save', 10, 2);
|
155 |
+
|
156 |
+
/**
|
157 |
+
* @param boolean $result
|
158 |
+
* @param EM_Booking $EM_Booking
|
159 |
+
* @return boolean
|
160 |
+
*/
|
161 |
+
function bp_em_record_activity_booking_save( $result, $EM_Booking ){
|
162 |
+
/* @todo this isn't good at detecting status changes. */
|
163 |
+
if( !empty($EM_Booking->event_id) && $result ){
|
164 |
+
$action_type = 'new_booking';
|
165 |
+
if( !empty($EM_Booking->last_bp_activity) && $EM_Booking->last_bp_activity == $action_type ) return $result; //prevent duplicates
|
166 |
+
$EM_Booking->last_bp_activity = $action_type;
|
167 |
+
$rejected_statuses = array(0,2,3); //these statuses apply to rejected/cancelled bookings
|
168 |
+
$user = $EM_Booking->get_person();
|
169 |
+
$member_link = bp_core_get_user_domain($user->ID);
|
170 |
+
$user_link = "<a href='".$member_link."/'>".$user->display_name."</a>";
|
171 |
+
$event_link = $EM_Booking->get_event()->output('#_EVENTLINK');
|
172 |
+
$status = $EM_Booking->booking_status;
|
173 |
+
$EM_Event = $EM_Booking->get_event();
|
174 |
+
if( empty($EM_Event->group_id) ){
|
175 |
+
if( $status == 1 || (!get_option('dbem_bookings_approval') && $status < 2) ){
|
176 |
+
$action = sprintf(__('%s is attending %s.','events-manager'), $user_link, $event_link );
|
177 |
+
}elseif( ($EM_Booking->previous_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2)) && in_array($status, $rejected_statuses) ){
|
178 |
+
$action = sprintf(__('%s will not be attending %s anymore.','events-manager'), $user_link, $event_link );
|
179 |
+
//$action_type = 'cancelled_booking';
|
180 |
+
}
|
181 |
+
}else{
|
182 |
+
$group = new BP_Groups_Group($EM_Event->group_id);
|
183 |
+
$group_link = '<a href="'.bp_get_group_permalink($group).'">'.bp_get_group_name($group).'</a>';
|
184 |
+
if( $status == 1 || (!get_option('dbem_bookings_approval') && $status < 2) ){
|
185 |
+
$action = sprintf(__('%s is attending %s of the group %s.','events-manager'), $user_link, $event_link, $group_link );
|
186 |
+
}elseif( ($EM_Booking->previous_status == 1 || (!get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2)) && in_array($status, $rejected_statuses) ){
|
187 |
+
$action = sprintf(__('%s will not be attending %s of group %s anymore.','events-manager'), $user_link, $event_link, $group_link );
|
188 |
+
//$action_type = 'cancelled_booking';
|
189 |
+
}
|
190 |
+
}
|
191 |
+
if( !empty($action) ){
|
192 |
+
if( empty($EM_Event->group_id) ){
|
193 |
+
bp_em_record_activity( array(
|
194 |
+
'user_id' => $EM_Booking->person->ID,
|
195 |
+
'action' => $action,
|
196 |
+
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
197 |
+
'type' => $action_type,
|
198 |
+
'item_id' => $EM_Event->event_id,
|
199 |
+
'secondary_item_id' => $EM_Booking->booking_id,
|
200 |
+
'hide_sitewide' => $EM_Event->event_private
|
201 |
+
));
|
202 |
+
}else{
|
203 |
+
//tis a group event
|
204 |
+
bp_em_record_activity( array(
|
205 |
+
'component' => 'groups',
|
206 |
+
'user_id' => $EM_Booking->person->ID,
|
207 |
+
'action' => $action,
|
208 |
+
'primary_link' => $EM_Event->output('#_EVENTURL'),
|
209 |
+
'type' => $action_type,
|
210 |
+
'item_id' => $EM_Event->group_id,
|
211 |
+
'secondary_item_id' => $EM_Booking->booking_id,
|
212 |
+
'hide_sitewide' => $EM_Event->event_private
|
213 |
+
));
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
return $result;
|
218 |
+
}
|
219 |
+
add_filter('em_booking_set_status','bp_em_record_activity_booking_save', 100, 2);
|
220 |
+
add_filter('em_booking_save','bp_em_record_activity_booking_save', 100, 2);
|
221 |
+
add_filter('em_booking_delete','bp_em_record_activity_booking_save', 100, 2);
|
trunk/buddypress/bp-em-core.php
ADDED
@@ -0,0 +1,352 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//Main loader for buddypress
|
3 |
+
/**
|
4 |
+
* Events Manager component for BuddyPress
|
5 |
+
* @author marcus
|
6 |
+
* @since 5.0
|
7 |
+
*/
|
8 |
+
class BP_EM_Component extends BP_Component {
|
9 |
+
|
10 |
+
function __construct() {
|
11 |
+
global $bp;
|
12 |
+
parent::start('events', __('Events', 'events-manager'), EM_DIR);
|
13 |
+
$this->includes();
|
14 |
+
//TODO make BP component optional
|
15 |
+
$bp->active_components[$this->id] = '1';
|
16 |
+
}
|
17 |
+
|
18 |
+
function includes( $includes = array() ) {
|
19 |
+
// Files to include
|
20 |
+
$includes = array(
|
21 |
+
'buddypress/bp-em-activity.php',
|
22 |
+
'buddypress/bp-em-templatetags.php',
|
23 |
+
'buddypress/bp-em-notifications.php',
|
24 |
+
'buddypress/screens/profile.php',
|
25 |
+
'buddypress/screens/my-events.php',
|
26 |
+
'buddypress/screens/my-locations.php',
|
27 |
+
'buddypress/screens/attending.php',
|
28 |
+
'buddypress/screens/my-bookings.php',
|
29 |
+
'buddypress/screens/my-group-events.php'
|
30 |
+
);
|
31 |
+
if( bp_is_active('groups') ){
|
32 |
+
$includes[] = 'buddypress/screens/group-events.php';
|
33 |
+
$includes[] = 'buddypress/bp-em-groups.php';
|
34 |
+
}
|
35 |
+
parent::includes( $includes );
|
36 |
+
//TODO add admin pages for extra BP specific settings
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Sets up the global Events Manager BuddyPress Components
|
41 |
+
*/
|
42 |
+
function setup_globals( $args = array() ) {
|
43 |
+
global $bp, $wpdb;
|
44 |
+
// Define a slug constant that will be used to view this components pages
|
45 |
+
if ( !defined( 'BP_EM_SLUG' ) )
|
46 |
+
define ( 'BP_EM_SLUG', str_replace('/','-', EM_POST_TYPE_EVENT_SLUG) );
|
47 |
+
|
48 |
+
// Set up the $globals array to be passed along to parent::setup_globals()
|
49 |
+
$globals = array(
|
50 |
+
'slug' => BP_EM_SLUG,
|
51 |
+
'has_directory' => false, //already done by EM
|
52 |
+
'notification_callback' => 'bp_em_format_notifications',
|
53 |
+
'search_string' => sprintf(__( 'Search %s...', 'events-manager'),__('Events','events-manager')),
|
54 |
+
);
|
55 |
+
|
56 |
+
// Let BP_Component::setup_globals() do its work.
|
57 |
+
parent::setup_globals( $globals );
|
58 |
+
|
59 |
+
//quick link shortcut - may need to revisit this
|
60 |
+
$bp->{$this->id}->link = trailingslashit($bp->loggedin_user->domain).BP_EM_SLUG.'/';
|
61 |
+
}
|
62 |
+
|
63 |
+
public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
|
64 |
+
global $blog_id;
|
65 |
+
//check multisite or normal mode for correct permission checking
|
66 |
+
if(is_multisite() && $blog_id != BP_ROOT_BLOG){
|
67 |
+
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
|
68 |
+
switch_to_blog(BP_ROOT_BLOG);
|
69 |
+
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
|
70 |
+
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
|
71 |
+
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
|
72 |
+
restore_current_blog();
|
73 |
+
}else{
|
74 |
+
$can_manage_events = current_user_can('edit_events');
|
75 |
+
$can_manage_locations = current_user_can('edit_locations');
|
76 |
+
$can_manage_bookings = current_user_can('manage_bookings');
|
77 |
+
}
|
78 |
+
/* Add 'Events' to the main user profile navigation */
|
79 |
+
$event_count = EM_Events::count( array( 'scope'=>'future', 'owner'=> bp_displayed_user_id() ));
|
80 |
+
if( empty($event_count) ) $event_count = 0;
|
81 |
+
$event_count_span = $event_count > 0 ? ' <span class="count">'.esc_html($event_count).'</span>':'';
|
82 |
+
$main_nav = array(
|
83 |
+
'name' => __( 'Events', 'events-manager'). $event_count_span,
|
84 |
+
'slug' => em_bp_get_slug(),
|
85 |
+
'position' => 80,
|
86 |
+
'screen_function' => 'bp_em_events',
|
87 |
+
'default_subnav_slug' => 'profile'
|
88 |
+
);
|
89 |
+
|
90 |
+
$em_link = trailingslashit( bp_displayed_user_domain() . em_bp_get_slug() );
|
91 |
+
|
92 |
+
/* Create SubNav Items */
|
93 |
+
$sub_nav[] = array(
|
94 |
+
'name' => __( 'My Profile', 'events-manager'),
|
95 |
+
'slug' => 'profile',
|
96 |
+
'parent_slug' => em_bp_get_slug(),
|
97 |
+
'parent_url' => $em_link,
|
98 |
+
'screen_function' => 'bp_em_events',
|
99 |
+
'position' => 10
|
100 |
+
);
|
101 |
+
|
102 |
+
if( get_option('dbem_rsvp_enabled') ) { // Only if bookings enabled
|
103 |
+
$sub_nav[] = array(
|
104 |
+
'name' => __( 'Events I\'m Attending', 'events-manager'),
|
105 |
+
'slug' => 'attending',
|
106 |
+
'parent_slug' => em_bp_get_slug(),
|
107 |
+
'parent_url' => $em_link,
|
108 |
+
'screen_function' => 'bp_em_attending',
|
109 |
+
'position' => 20,
|
110 |
+
'user_has_access' => bp_is_my_profile() // Only the logged in user can access this on his/her profile
|
111 |
+
);
|
112 |
+
}
|
113 |
+
|
114 |
+
if( $can_manage_events ){
|
115 |
+
$sub_nav[] = array(
|
116 |
+
'name' => __( 'My Events', 'events-manager'),
|
117 |
+
'slug' => 'my-events',
|
118 |
+
'parent_slug' => em_bp_get_slug(),
|
119 |
+
'parent_url' => $em_link,
|
120 |
+
'screen_function' => 'bp_em_my_events',
|
121 |
+
'position' => 30,
|
122 |
+
'user_has_access' => bp_is_my_profile() // Only the logged in user can access this on his/her profile
|
123 |
+
);
|
124 |
+
}
|
125 |
+
|
126 |
+
if( $can_manage_locations && get_option('dbem_locations_enabled') ){
|
127 |
+
$sub_nav[] = array(
|
128 |
+
'name' => __( 'My Locations', 'events-manager'),
|
129 |
+
'slug' => 'my-locations',
|
130 |
+
'parent_slug' => em_bp_get_slug(),
|
131 |
+
'parent_url' => $em_link,
|
132 |
+
'screen_function' => 'bp_em_my_locations',
|
133 |
+
'position' => 40,
|
134 |
+
'user_has_access' => bp_is_my_profile() // Only the logged in user can access this on his/her profile
|
135 |
+
);
|
136 |
+
}
|
137 |
+
|
138 |
+
if( $can_manage_bookings && get_option('dbem_rsvp_enabled') ){
|
139 |
+
$sub_nav[] = array(
|
140 |
+
'name' => __( 'My Event Bookings', 'events-manager'),
|
141 |
+
'slug' => 'my-bookings',
|
142 |
+
'parent_slug' => em_bp_get_slug(),
|
143 |
+
'parent_url' => $em_link,
|
144 |
+
'screen_function' => 'bp_em_my_bookings',
|
145 |
+
'position' => 50,
|
146 |
+
'user_has_access' => bp_is_my_profile() // Only the logged in user can access this on his/her profile
|
147 |
+
);
|
148 |
+
}
|
149 |
+
|
150 |
+
if( bp_is_active('groups') ){
|
151 |
+
/* Create Profile Group Sub-Nav */
|
152 |
+
$sub_nav[] = array(
|
153 |
+
'name' => __( 'Events', 'events-manager'),
|
154 |
+
'slug' => 'group-events',
|
155 |
+
'parent_slug' => bp_get_groups_slug(),
|
156 |
+
'parent_url' =>trailingslashit( bp_displayed_user_domain() . bp_get_groups_slug() ),
|
157 |
+
'screen_function' => 'bp_em_my_group_events',
|
158 |
+
'position' => 60,
|
159 |
+
'user_has_access' => bp_is_my_profile() // Only the logged in user can access this on his/her profile
|
160 |
+
);
|
161 |
+
}
|
162 |
+
|
163 |
+
$main_nav = apply_filters('em_bp_menu_main_nav', $main_nav);
|
164 |
+
$sub_nav = apply_filters('em_bp_menu_sub_nav', $sub_nav);
|
165 |
+
|
166 |
+
parent::setup_nav( $main_nav, $sub_nav );
|
167 |
+
add_action( 'bp_init', array(&$this, 'setup_group_nav') );
|
168 |
+
}
|
169 |
+
|
170 |
+
public function setup_admin_bar( $wp_admin_nav = array() ) {
|
171 |
+
global $bp, $blog_id;
|
172 |
+
|
173 |
+
// Prevent debug notices
|
174 |
+
$wp_admin_nav = array();
|
175 |
+
|
176 |
+
// Menus for logged in user
|
177 |
+
if ( is_user_logged_in() ) {
|
178 |
+
//check multisite or normal mode for correct permission checking
|
179 |
+
if(is_multisite() && $blog_id != BP_ROOT_BLOG){
|
180 |
+
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
|
181 |
+
$current_blog = $blog_id;
|
182 |
+
switch_to_blog(BP_ROOT_BLOG);
|
183 |
+
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
|
184 |
+
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
|
185 |
+
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
|
186 |
+
restore_current_blog();
|
187 |
+
}else{
|
188 |
+
$can_manage_events = current_user_can('edit_events');
|
189 |
+
$can_manage_locations = current_user_can('edit_locations');
|
190 |
+
$can_manage_bookings = current_user_can('manage_bookings');
|
191 |
+
}
|
192 |
+
|
193 |
+
$em_link = trailingslashit( bp_loggedin_user_domain() . em_bp_get_slug() );
|
194 |
+
|
195 |
+
/* Add 'Events' to the main user profile navigation */
|
196 |
+
$wp_admin_nav[] = array(
|
197 |
+
'parent' => $bp->my_account_menu_id,
|
198 |
+
'id' => 'my-em-' . $this->id,
|
199 |
+
'title' => __( 'Events', 'events-manager'),
|
200 |
+
'href' => $em_link
|
201 |
+
);
|
202 |
+
|
203 |
+
/* Create SubNav Items */
|
204 |
+
$wp_admin_nav[] = array(
|
205 |
+
'parent' => 'my-em-' . $this->id,
|
206 |
+
'id' => 'my-em-' . $this->id .'-profile',
|
207 |
+
'title' => __( 'My Profile', 'events-manager'),
|
208 |
+
'href' => $em_link.'profile/'
|
209 |
+
);
|
210 |
+
|
211 |
+
$wp_admin_nav[] = array(
|
212 |
+
'parent' => 'my-em-' . $this->id,
|
213 |
+
'id' => 'my-em-' . $this->id .'-attending',
|
214 |
+
'title' => __( 'Events I\'m Attending', 'events-manager'),
|
215 |
+
'href' => $em_link.'attending/'
|
216 |
+
);
|
217 |
+
|
218 |
+
if( $can_manage_events ){
|
219 |
+
$wp_admin_nav[] = array(
|
220 |
+
'parent' => 'my-em-' . $this->id,
|
221 |
+
'id' => 'my-em-' . $this->id .'-my-events',
|
222 |
+
'title' => __( 'My Events', 'events-manager'),
|
223 |
+
'href' => $em_link.'my-events/'
|
224 |
+
);
|
225 |
+
}
|
226 |
+
|
227 |
+
if( $can_manage_locations && get_option('dbem_locations_enabled') ){
|
228 |
+
$wp_admin_nav[] = array(
|
229 |
+
'parent' => 'my-em-' . $this->id,
|
230 |
+
'id' => 'my-em-' . $this->id .'-my-locations',
|
231 |
+
'title' => __( 'My Locations', 'events-manager'),
|
232 |
+
'href' => $em_link.'my-locations/'
|
233 |
+
);
|
234 |
+
}
|
235 |
+
|
236 |
+
if( $can_manage_bookings && get_option('dbem_rsvp_enabled') ){
|
237 |
+
$wp_admin_nav[] = array(
|
238 |
+
'parent' => 'my-em-' . $this->id,
|
239 |
+
'id' => 'my-em-' . $this->id .'-my-bookings',
|
240 |
+
'title' => __( 'My Event Bookings', 'events-manager'),
|
241 |
+
'href' => $em_link.'my-bookings/'
|
242 |
+
);
|
243 |
+
}
|
244 |
+
|
245 |
+
if( bp_is_active('groups') ){
|
246 |
+
/* Create Profile Group Sub-Nav */
|
247 |
+
$wp_admin_nav[] = array(
|
248 |
+
'parent' => 'my-account-groups',
|
249 |
+
'id' => 'my-account-groups-' . $this->id ,
|
250 |
+
'title' => __( 'Events', 'events-manager'),
|
251 |
+
'href' => trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . 'group-events/'
|
252 |
+
);
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
parent::setup_admin_bar( $wp_admin_nav );
|
257 |
+
}
|
258 |
+
|
259 |
+
function setup_group_nav(){
|
260 |
+
global $bp;
|
261 |
+
/* Add some group subnav items */
|
262 |
+
$user_access = false;
|
263 |
+
$group_link = '';
|
264 |
+
if( bp_is_active('groups') && !empty($bp->groups->current_group) ){
|
265 |
+
$group_link = $bp->root_domain . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug . '/';
|
266 |
+
$user_access = $bp->groups->current_group->user_has_access;
|
267 |
+
if( !empty($bp->current_component) && $bp->current_component == 'groups' ){
|
268 |
+
$count = EM_Events::count(array('group'=>$bp->groups->current_group->id));
|
269 |
+
if( empty($count) ) $count = 0;
|
270 |
+
}
|
271 |
+
bp_core_new_subnav_item( array(
|
272 |
+
'name' => __( 'Events', 'events-manager') . " <span>$count</span>",
|
273 |
+
'slug' => 'events',
|
274 |
+
'parent_url' => $group_link,
|
275 |
+
'parent_slug' => $bp->groups->current_group->slug,
|
276 |
+
'screen_function' => 'bp_em_group_events',
|
277 |
+
'position' => 50,
|
278 |
+
'user_has_access' => $user_access,
|
279 |
+
'item_css_id' => 'events'
|
280 |
+
));
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
function bp_em_load_core_component() {
|
285 |
+
global $bp;
|
286 |
+
$bp->events = new BP_EM_Component();
|
287 |
+
}
|
288 |
+
add_action( 'bp_loaded', 'bp_em_load_core_component' );
|
289 |
+
|
290 |
+
if( !is_admin() || ( defined('DOING_AJAX') && !empty($_REQUEST['is_public'])) ){
|
291 |
+
/*
|
292 |
+
* Links and URL Rewriting
|
293 |
+
*/
|
294 |
+
function em_bp_rewrite_edit_url($url, $EM_Event){
|
295 |
+
global $bp;
|
296 |
+
return $bp->events->link.'my-events/?action=edit&event_id='.$EM_Event->event_id;
|
297 |
+
}
|
298 |
+
function em_bp_rewrite_events_admin_url( $url ){
|
299 |
+
global $bp;
|
300 |
+
return $bp->events->link.'my-events/';
|
301 |
+
}
|
302 |
+
if( !get_option('dbem_edit_events_page') ){
|
303 |
+
add_filter('em_event_get_edit_url','em_bp_rewrite_edit_url',10,2);
|
304 |
+
add_filter('em_get_events_admin_url','em_bp_rewrite_edit_url',10,2);
|
305 |
+
}
|
306 |
+
|
307 |
+
function em_bp_rewrite_bookings_url($url, $EM_Event){
|
308 |
+
global $bp;
|
309 |
+
return $bp->events->link.'my-bookings/?event_id='.$EM_Event->event_id;
|
310 |
+
}
|
311 |
+
if( !get_option('dbem_edit_bookings_page') ){
|
312 |
+
add_filter('em_event_get_bookings_url','em_bp_rewrite_bookings_url',10,2);
|
313 |
+
}
|
314 |
+
|
315 |
+
function em_bp_rewrite_edit_location_url($url, $EM_Location){
|
316 |
+
global $bp;
|
317 |
+
return $bp->events->link.'my-locations/?action=edit&location_id='.$EM_Location->location_id;
|
318 |
+
}
|
319 |
+
if( !get_option('dbem_edit_locations_page') ){
|
320 |
+
add_filter('em_location_get_edit_url','em_bp_rewrite_edit_location_url',10,2);
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
//CSS and JS Loading
|
325 |
+
function bp_em_enqueue_scripts( ){
|
326 |
+
if( bp_is_current_component('events') || (bp_is_current_component('groups') && bp_is_current_action('group-events')) ){
|
327 |
+
add_filter('option_dbem_js_limit', '__return_false');
|
328 |
+
add_filter('option_dbem_css_limit', '__return_false');
|
329 |
+
}
|
330 |
+
|
331 |
+
}
|
332 |
+
add_action('wp_enqueue_scripts','bp_em_enqueue_scripts',1);
|
333 |
+
|
334 |
+
function bp_em_messages_js_compat() {
|
335 |
+
if(bp_is_messages_compose_screen()){
|
336 |
+
wp_deregister_script( 'events-manager' );
|
337 |
+
}
|
338 |
+
}
|
339 |
+
add_action( 'wp_print_scripts', 'bp_em_messages_js_compat', 100 );
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Delete events when you delete a user.
|
343 |
+
*/
|
344 |
+
function bp_em_remove_data( $user_id ) {
|
345 |
+
$EM_Events = EM_Events::get(array('scope'=>'all','owner'=>$user_id, 'status'=>false));
|
346 |
+
EM_Events::delete($EM_Events);
|
347 |
+
}
|
348 |
+
add_action( 'wpmu_delete_user', 'bp_em_remove_data', 1 );
|
349 |
+
add_action( 'delete_user', 'bp_em_remove_data', 1 );
|
350 |
+
|
351 |
+
define('EM_BP_LOADED',true); //so we know
|
352 |
+
?>
|
trunk/buddypress/bp-em-groups.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Turns an event private if the event belongs to a private BP Group
|
4 |
+
* @param EM_Event $EM_Event
|
5 |
+
*/
|
6 |
+
function bp_em_group_event_save($result, $EM_Event){
|
7 |
+
if( is_object($EM_Event) && !empty($EM_Event->event_id) ){
|
8 |
+
if( !empty($_REQUEST['group_id']) && is_numeric($_REQUEST['group_id']) && bp_is_active('groups') ){
|
9 |
+
//firstly, we check that the event has been published, otherwise users without publish rights can submit an event at a private group and event is marked private/published immediately
|
10 |
+
if( $EM_Event->event_status == 1 ){
|
11 |
+
//we have been requested an event creation tied to a group, so does this group exist, and does this person have admin rights to it?
|
12 |
+
if( groups_is_user_admin(get_current_user_id(), absint($_REQUEST['group_id']) ) ){
|
13 |
+
$EM_Event->group_id = absint($_REQUEST['group_id']);
|
14 |
+
}
|
15 |
+
if( !empty($EM_Event->group_id) ){
|
16 |
+
//if group is private, make it private
|
17 |
+
$group = groups_get_group(array('group_id'=>$EM_Event->group_id));
|
18 |
+
$is_member = groups_is_user_member(get_current_user_id(), $EM_Event->group_id) || groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) || groups_is_user_mod(get_current_user_id(), $EM_Event->group_id);
|
19 |
+
if( $group->status != 'public' && $is_member ){
|
20 |
+
//Make sure event status is private and set post status to private
|
21 |
+
global $wpdb;
|
22 |
+
$EM_Event->event_private = 1;
|
23 |
+
$wpdb->update($wpdb->posts, array('post_status'=>'private'), array('ID'=>$EM_Event->post_id));
|
24 |
+
$wpdb->update(EM_EVENTS_TABLE, array('event_private'=>1), array('event_id'=>$EM_Event->event_id));
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}else{
|
29 |
+
$EM_Event->group_id = null;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $result;
|
33 |
+
}
|
34 |
+
add_action('em_event_save','bp_em_group_event_save',1,2);
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Overrides the default capability of the user for another owner's event if the user is a group admin and the event belongs to a group.
|
38 |
+
* User must have the relevant permissions globally in order to inherit that capability for this event as well.
|
39 |
+
* @param boolean $result
|
40 |
+
* @param EM_Event $EM_Event
|
41 |
+
*/
|
42 |
+
function bp_em_group_event_can_manage( $result, $EM_Event, $owner_capability, $admin_capability, $user_to_check){
|
43 |
+
if( !$result && $EM_Event->event_owner != get_current_user_id() && !empty($EM_Event->group_id) && bp_is_active('groups') ){ //only override if already false, incase it's true
|
44 |
+
//if the user is an admin of this group, and actually has the relevant permissions globally, they can manage this event
|
45 |
+
$EM_Object = new EM_Object(); //create new object to prevent infinite loop should we call $EM_Event->can_manage();
|
46 |
+
if( groups_is_user_admin(get_current_user_id(),$EM_Event->group_id) && $EM_Object->can_manage($owner_capability, $admin_capability, $user_to_check) ){
|
47 |
+
//This user is an admin of the owner's group, so they can edit this event.
|
48 |
+
array_pop($EM_Event->errors); //remove last error
|
49 |
+
return true;
|
50 |
+
}else{
|
51 |
+
$EM_Event->add_error($EM_Object->get_errors()); //add any applicable errors
|
52 |
+
}
|
53 |
+
}
|
54 |
+
return $result;
|
55 |
+
}
|
56 |
+
add_filter('em_event_can_manage','bp_em_group_event_can_manage',1,5);
|
57 |
+
|
58 |
+
|
59 |
+
function bp_em_group_events_accepted_searches($searches){
|
60 |
+
if( bp_is_active('groups') ){
|
61 |
+
$searches[] = 'group';
|
62 |
+
}
|
63 |
+
return $searches;
|
64 |
+
}
|
65 |
+
add_filter('em_accepted_searches','bp_em_group_events_accepted_searches',1,1);
|
66 |
+
|
67 |
+
function bp_em_group_events_get_default_search($searches, $array){
|
68 |
+
if( !empty($array['group']) && (is_numeric($array['group']) || $array['group'] == 'my' || $array['group'] == 'this') && bp_is_active('groups') ){
|
69 |
+
if($array['group'] == 'this'){ //shows current group, if applicable
|
70 |
+
if( is_numeric(bp_get_current_group_id()) ){
|
71 |
+
$searches['group'] = bp_get_current_group_id();
|
72 |
+
}
|
73 |
+
}else{
|
74 |
+
$searches['group'] = $array['group'];
|
75 |
+
}
|
76 |
+
}
|
77 |
+
return $searches;
|
78 |
+
}
|
79 |
+
add_filter('em_events_get_default_search','bp_em_group_events_get_default_search',1,2);
|
80 |
+
|
81 |
+
/*
|
82 |
+
* Privacy Functions
|
83 |
+
*/
|
84 |
+
function bp_em_group_events_build_sql_conditions( $conditions, $args ){
|
85 |
+
if( !empty($args['group']) && is_numeric($args['group']) ){
|
86 |
+
$conditions['group'] = "( `group_id`={$args['group']} )";
|
87 |
+
}elseif( !empty($args['group']) && $args['group'] == 'my' ){
|
88 |
+
$groups = groups_get_user_groups(get_current_user_id());
|
89 |
+
if( count($groups) > 0 ){
|
90 |
+
$conditions['group'] = "( `group_id` IN (".implode(',',$groups['groups']).") )";
|
91 |
+
}
|
92 |
+
}
|
93 |
+
//deal with private groups and events
|
94 |
+
if( is_user_logged_in() ){
|
95 |
+
global $wpdb;
|
96 |
+
//find out what private groups they belong to, and don't show private group events not in their memberships
|
97 |
+
$group_ids = BP_Groups_Member::get_group_ids(get_current_user_id());
|
98 |
+
if( $group_ids['total'] > 0){
|
99 |
+
$conditions['group_privacy'] = "(`event_private`=0 OR (`event_private`=1 AND (`group_id` IS NULL OR `group_id` = 0)) OR (`event_private`=1 AND `group_id` IN (".implode(',',$group_ids['groups']).")))";
|
100 |
+
}else{
|
101 |
+
//find out what private groups they belong to, and don't show private group events not in their memberships
|
102 |
+
$conditions['group_privacy'] = "(`event_private`=0 OR (`event_private`=1 AND (`group_id` IS NULL OR `group_id` = 0)))";
|
103 |
+
}
|
104 |
+
}
|
105 |
+
return $conditions;
|
106 |
+
}
|
107 |
+
add_filter('em_events_build_sql_conditions','bp_em_group_events_build_sql_conditions',1,2);
|
108 |
+
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks if the event is private and either belongs to a group or private group, as members of that group should be able to see the post even if not able to see private events.
|
112 |
+
* @param string $template
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
function bp_em_private_event_check($template){
|
116 |
+
global $post, $wpdb, $wp_query, $bp;
|
117 |
+
if( $post->post_type == EM_POST_TYPE_EVENT ){
|
118 |
+
$EM_Event = em_get_event($post);
|
119 |
+
/
|