My Calendar - Version 3.3.24.1

Version Description

  • Bug fix: minified mcjs.min.js was invalid in 3.3.24, breaking jump navigation selector.
Download this release

Release Info

Developer joedolson
Plugin Icon 128x128 My Calendar
Version 3.3.24.1
Comparing to
See all releases

Code changes from version 3.3.23 to 3.3.24.1

js/jquery.admin.js CHANGED
@@ -157,18 +157,39 @@ jQuery(document).ready(function ($) {
157
  var locationValue = locationSelector.value;
158
 
159
  var controls = addLocations.getAttribute( 'aria-controls' );
160
- var target = document.getElementById( controls );
161
- target.classList.add( 'hidden' );
162
  addLocations.addEventListener( 'click', function(e) {
163
  var expanded = this.getAttribute( 'aria-expanded' );
164
  if ( 'true' === expanded ) {
165
  locationSelector.value = locationValue;
166
- target.classList.add( 'hidden' );
167
  this.setAttribute( 'aria-expanded', 'false' );
168
  this.firstChild.classList.add( 'dashicons-plus' );
169
  this.firstChild.classList.remove( 'dashicons-minus' );
170
  } else {
171
  locationSelector.value = 'none';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  target.classList.remove( 'hidden' );
173
  this.setAttribute( 'aria-expanded', 'true' );
174
  this.firstChild.classList.add( 'dashicons-minus' );
157
  var locationValue = locationSelector.value;
158
 
159
  var controls = addLocations.getAttribute( 'aria-controls' );
160
+ var fields = document.getElementById( controls );
161
+ fields.classList.add( 'hidden' );
162
  addLocations.addEventListener( 'click', function(e) {
163
  var expanded = this.getAttribute( 'aria-expanded' );
164
  if ( 'true' === expanded ) {
165
  locationSelector.value = locationValue;
166
+ fields.classList.add( 'hidden' );
167
  this.setAttribute( 'aria-expanded', 'false' );
168
  this.firstChild.classList.add( 'dashicons-plus' );
169
  this.firstChild.classList.remove( 'dashicons-minus' );
170
  } else {
171
  locationSelector.value = 'none';
172
+ fields.classList.remove( 'hidden' );
173
+ this.setAttribute( 'aria-expanded', 'true' );
174
+ this.firstChild.classList.add( 'dashicons-minus' );
175
+ this.firstChild.classList.remove( 'dashicons-plus' );
176
+ }
177
+ });
178
+ }
179
+
180
+ var toggleInside = document.querySelector( '.toggle-inside' );
181
+ if ( null !== toggleInside ) {
182
+ var parentEl = toggleInside.parentNode.parentNode;
183
+ var target = parentEl.querySelector( '.inside' );
184
+ target.classList.add( 'hidden' );
185
+ toggleInside.addEventListener( 'click', function(e) {
186
+ var expanded = this.getAttribute( 'aria-expanded' );
187
+ if ( 'true' === expanded ) {
188
+ target.classList.add( 'hidden' );
189
+ this.setAttribute( 'aria-expanded', 'false' );
190
+ this.firstChild.classList.add( 'dashicons-plus' );
191
+ this.firstChild.classList.remove( 'dashicons-minus' );
192
+ } else {
193
  target.classList.remove( 'hidden' );
194
  this.setAttribute( 'aria-expanded', 'true' );
195
  this.firstChild.classList.add( 'dashicons-minus' );
js/mcjs.js CHANGED
@@ -113,7 +113,7 @@
113
 
114
  if ( 'true' === my_calendar.ajax ) {
115
  $(function () {
116
- $(document).on('click', ".my-calendar-header a, .my-calendar-footer a, .my-calendar-header input[type=submit], .my-calendar-footer input[type=submit]", function (e) {
117
  e.preventDefault();
118
  var calendar = $( this ).closest( '.mc-main' );
119
  var ref = calendar.attr('id');
113
 
114
  if ( 'true' === my_calendar.ajax ) {
115
  $(function () {
116
+ $(document).on('click', ".my-calendar-header a:not(.mc-print a, .mc-export a), .my-calendar-footer a:not(.mc-print a, .mc-export a), .my-calendar-header input[type=submit], .my-calendar-footer input[type=submit]", function (e) {
117
  e.preventDefault();
118
  var calendar = $( this ).closest( '.mc-main' );
119
  var ref = calendar.attr('id');
js/mcjs.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";function t(){e(".mc-user-time").each((function(){var t=e(this).text(),a=e(this).attr("data-label"),n='<span class="mc-local-time-time">'+new Date(t).toLocaleTimeString().replace(":00 "," ")+"</span>",s='<span class="mc-local-time-date">'+new Date(t).toLocaleDateString()+"</span>";e(this).html('<span class="mc-local-time-label">'+a+"</span> "+s+'<span class="sep">, </span>'+n).attr("data-time",t)}))}e((function(){t(),e(".mc-main").removeClass("mcjs")})),"true"===my_calendar.mini&&e((function(){e(".mini .has-events").children().not(".trigger, .mc-date, .event-date").hide(),e(document).on("click",".mini .has-events .trigger",(function(t){t.preventDefault();var a=e(this).parent().children();a.not(".trigger").toggle().attr("tabindex","-1").trigger("focus"),e(".mini .has-events").children(".trigger").removeClass("active-toggle"),e(".mini .has-events").children().not(".trigger, .mc-date, .event-date").not(a).hide(),e(this).addClass("active-toggle"),t.stopImmediatePropagation()})),e(document).on("click",".calendar-events .close",(function(t){t.preventDefault(),e(this).closest(".mini .has-events").children(".trigger").removeClass("active-toggle"),e(this).closest("div.calendar-events").toggle(),t.stopImmediatePropagation()}))})),"true"===my_calendar.list&&e((function(){e("li.mc-events").children().not(".event-date").hide(),e("li.current-day").children().show(),e("li.current-day .event-date .mc-text-button").attr("aria-expanded",!0),e(document).on("click",".event-date button",(function(t){t.preventDefault();var a=e(this).closest(".mc-events").find(".mc-event:first");return e(this).closest(".mc-events").find(".mc-event").toggle(),a.attr("tabindex","-1").trigger("focus"),e(this).closest(".mc-events").find(".mc-event").is(":visible")?e(this).attr("aria-expanded","true"):e(this).attr("aria-expanded","false"),t.stopImmediatePropagation(),!1}))})),"true"===my_calendar.grid&&e((function(){e(".calendar-event").children().not(".event-title,.screen-reader-text").hide();var t=document.createElement("div");t.classList.add("my-calendar-mask"),document.querySelector("body").insertAdjacentElement("beforeend",t),e(document).on("click",".calendar-event .event-title .open",(function(a){a.preventDefault();var n=e(this).parents(".mc-event").children();t.classList.add("mc-mask-active"),e(this).closest(".mc-main").toggleClass("grid-open"),e(this).parents(".mc-event").children().not(".event-title").toggle().attr("tabindex","-1"),e(this).parents(".mc-event").trigger("focus");var s=n.find("a, object, :input, iframe, [tabindex]"),i=s.last();s.first();return i.attr("data-action","shiftback"),e(".calendar-event").children().not(".event-title,.screen-reader-text").not(n).hide(),a.stopImmediatePropagation(),!1})),e(document).on("click",".calendar-event .close",(function(a){t.classList.remove("mc-mask-active"),a.preventDefault(),e(this).closest(".mc-main").removeClass("grid-open"),e(this).closest(".mc-event").find(".event-title a").trigger("focus"),e(this).closest("div.details").toggle(),a.stopImmediatePropagation()})),e(document).on("keydown",(function(a){27==(a.keyCode?a.keyCode:a.which)&&(t.classList.remove("mc-mask-active"),e(".mc-main ").removeClass("grid-open"),e(".calendar-event div.details").hide())})),e(document).on("keydown",".details a, .details object, .details :input, .details iframe, .details [tabindex]",(function(t){var a=t.keyCode?t.keyCode:t.which,n=e(":focus").attr("data-action");t.shiftKey||9!=a||"shiftback"!=n||(t.preventDefault(),e(".mc-toggle.close").trigger("focus")),t.shiftKey&&9==a&&"shiftforward"==n&&(t.preventDefault(),e("[data-action=shiftback]").trigger("focus"))}))})),"true"===my_calendar.ajax&&e((function(){e(document).on("click",".my-calendar-header a, .my-calendar-footer a, .my-calendar-header input[type=submit], .my-calendar-footer input[type=submit]",(function(a){a.preventDefault();var n=e(this).closest(".mc-main"),s=n.attr("id"),i="",r="",c="",d="",l="",o="",m="";if("INPUT"===this.nodeName){var h=e(this).parents("form");if(h.hasClass("mc-date-switcher"))i=h.find("select[name=month]").val(),r=h.find("select[name=dy]").val(),c=h.find("select[name=yr]").val();if(h.hasClass("mc-categories-switcher"))d=h.find("select[name=mcat]").val();if(h.hasClass("mc-locations-switcher"))l=h.find("select[name=loc]").val();if(h.hasClass("mc-access-switcher"))o=h.find("select[name=access]").val();m=n.find("#mcs").val();var v=e(this).attr("data-href")}else v=e(this).attr("href");let p;try{p=new URL(v),p.searchParams.delete("embed"),"INPUT"===this.nodeName&&(""!==i&&(p.searchParams.delete("month"),p.searchParams.delete("dy"),p.searchParams.delete("yr"),p.searchParams.append("month",parseInt(i)),void 0!==r&&p.searchParams.append("dy",parseInt(r)),p.searchParams.append("yr",parseInt(c))),""!==d&&(p.searchParams.delete("mcat"),p.searchParams.append("mcat",d)),""!==l&&(p.searchParams.delete("loc"),p.searchParams.delete("ltype"),p.searchParams.append("ltype","name"),p.searchParams.append("loc",l)),""!==o&&(p.searchParams.delete("access"),p.searchParams.append("access",parseInt(o))),p.searchParams.delete("mcs"),""!==m&&void 0!==m&&p.searchParams.append("mcs",encodeURIComponent(m)),v=p.toString()),window.history.pushState({},"",p)}catch(e){p=!1}var u=n.height();e("#"+s).html('<div class="mc-loading"></div><div class="loading" style="height:'+u+'px"><span class="screen-reader-text">Loading...</span></div>'),e("#"+s).load(v+" #"+s+" > *",(function(a,n,i){"error"==n&&e("#"+s).html(i.status+" "+i.statusText),"undefined"!=typeof my_calendar&&"true"==my_calendar.list&&(e("li.mc-events").children().not(".event-date").hide(),e("li.current-day").children().show()),"undefined"!=typeof my_calendar&&"true"==my_calendar.grid&&e(".calendar-event").children().not(".event-title").hide(),"undefined"!=typeof my_calendar&&"true"==my_calendar.mini&&e(".mini .has-events").children().not(".trigger, .mc-date, .event-date").hide(),e("#"+s).attr("tabindex","-1").trigger("focus"),t()}))}))})),e(".mc-main a[target=_blank]").append(' <span class="dashicons dashicons-external" aria-hidden="true"></span><span class="screen-reader-text"> '+my_calendar.newWindow+"</span>")}(jQuery);
1
+ !function(e){"use strict";function t(){e(".mc-user-time").each((function(){var t=e(this).text(),a=e(this).attr("data-label"),n='<span class="mc-local-time-time">'+new Date(t).toLocaleTimeString().replace(":00 "," ")+"</span>",s='<span class="mc-local-time-date">'+new Date(t).toLocaleDateString()+"</span>";e(this).html('<span class="mc-local-time-label">'+a+"</span> "+s+'<span class="sep">, </span>'+n).attr("data-time",t)}))}e((function(){t(),e(".mc-main").removeClass("mcjs")})),"true"===my_calendar.mini&&e((function(){e(".mini .has-events").children().not(".trigger, .mc-date, .event-date").hide(),e(document).on("click",".mini .has-events .trigger",(function(t){t.preventDefault();var a=e(this).parent().children();a.not(".trigger").toggle().attr("tabindex","-1").trigger("focus"),e(".mini .has-events").children(".trigger").removeClass("active-toggle"),e(".mini .has-events").children().not(".trigger, .mc-date, .event-date").not(a).hide(),e(this).addClass("active-toggle"),t.stopImmediatePropagation()})),e(document).on("click",".calendar-events .close",(function(t){t.preventDefault(),e(this).closest(".mini .has-events").children(".trigger").removeClass("active-toggle"),e(this).closest("div.calendar-events").toggle(),t.stopImmediatePropagation()}))})),"true"===my_calendar.list&&e((function(){e("li.mc-events").children().not(".event-date").hide(),e("li.current-day").children().show(),e("li.current-day .event-date .mc-text-button").attr("aria-expanded",!0),e(document).on("click",".event-date button",(function(t){t.preventDefault();var a=e(this).closest(".mc-events").find(".mc-event:first");return e(this).closest(".mc-events").find(".mc-event").toggle(),a.attr("tabindex","-1").trigger("focus"),e(this).closest(".mc-events").find(".mc-event").is(":visible")?e(this).attr("aria-expanded","true"):e(this).attr("aria-expanded","false"),t.stopImmediatePropagation(),!1}))})),"true"===my_calendar.grid&&e((function(){e(".calendar-event").children().not(".event-title,.screen-reader-text").hide();var t=document.createElement("div");t.classList.add("my-calendar-mask"),document.querySelector("body").insertAdjacentElement("beforeend",t),e(document).on("click",".calendar-event .event-title .open",(function(a){a.preventDefault();var n=e(this).parents(".mc-event").children();t.classList.add("mc-mask-active"),e(this).closest(".mc-main").toggleClass("grid-open"),e(this).parents(".mc-event").children().not(".event-title").toggle().attr("tabindex","-1"),e(this).parents(".mc-event").trigger("focus");var s=n.find("a, object, :input, iframe, [tabindex]"),i=s.last();s.first();return i.attr("data-action","shiftback"),e(".calendar-event").children().not(".event-title,.screen-reader-text").not(n).hide(),a.stopImmediatePropagation(),!1})),e(document).on("click",".calendar-event .close",(function(a){t.classList.remove("mc-mask-active"),a.preventDefault(),e(this).closest(".mc-main").removeClass("grid-open"),e(this).closest(".mc-event").find(".event-title a").trigger("focus"),e(this).closest("div.details").toggle(),a.stopImmediatePropagation()})),e(document).on("keydown",(function(a){27==(a.keyCode?a.keyCode:a.which)&&(t.classList.remove("mc-mask-active"),e(".mc-main ").removeClass("grid-open"),e(".calendar-event div.details").hide())})),e(document).on("keydown",".details a, .details object, .details :input, .details iframe, .details [tabindex]",(function(t){var a=t.keyCode?t.keyCode:t.which,n=e(":focus").attr("data-action");t.shiftKey||9!=a||"shiftback"!=n||(t.preventDefault(),e(".mc-toggle.close").trigger("focus")),t.shiftKey&&9==a&&"shiftforward"==n&&(t.preventDefault(),e("[data-action=shiftback]").trigger("focus"))}))})),"true"===my_calendar.ajax&&e((function(){e(document).on("click",".my-calendar-header a:not(.mc-print a, .mc-export a), .my-calendar-footer a:not(.mc-print a, .mc-export a), .my-calendar-header input[type=submit], .my-calendar-footer input[type=submit]",(function(a){a.preventDefault();var n=e(this).closest(".mc-main"),s=n.attr("id"),i="",r="",c="",d="",l="",o="",m="";if("INPUT"===this.nodeName){var h=e(this).parents("form");if(h.hasClass("mc-date-switcher"))i=h.find("select[name=month]").val(),r=h.find("select[name=dy]").val(),c=h.find("select[name=yr]").val();if(h.hasClass("mc-categories-switcher"))d=h.find("select[name=mcat]").val();if(h.hasClass("mc-locations-switcher"))l=h.find("select[name=loc]").val();if(h.hasClass("mc-access-switcher"))o=h.find("select[name=access]").val();m=n.find("#mcs").val();var v=e(this).attr("data-href")}else v=e(this).attr("href");let p;try{p=new URL(v),p.searchParams.delete("embed"),"INPUT"===this.nodeName&&(""!==i&&(p.searchParams.delete("month"),p.searchParams.delete("dy"),p.searchParams.delete("yr"),p.searchParams.append("month",parseInt(i)),void 0!==r&&p.searchParams.append("dy",parseInt(r)),p.searchParams.append("yr",parseInt(c))),""!==d&&(p.searchParams.delete("mcat"),p.searchParams.append("mcat",d)),""!==l&&(p.searchParams.delete("loc"),p.searchParams.delete("ltype"),p.searchParams.append("ltype","name"),p.searchParams.append("loc",l)),""!==o&&(p.searchParams.delete("access"),p.searchParams.append("access",parseInt(o))),p.searchParams.delete("mcs"),""!==m&&void 0!==m&&p.searchParams.append("mcs",encodeURIComponent(m)),v=p.toString()),window.history.pushState({},"",p)}catch(e){p=!1}var u=n.height();e("#"+s).html('<div class="mc-loading"></div><div class="loading" style="height:'+u+'px"><span class="screen-reader-text">Loading...</span></div>'),e("#"+s).load(v+" #"+s+" > *",(function(a,n,i){"error"==n&&e("#"+s).html(i.status+" "+i.statusText),"undefined"!=typeof my_calendar&&"true"==my_calendar.list&&(e("li.mc-events").children().not(".event-date").hide(),e("li.current-day").children().show()),"undefined"!=typeof my_calendar&&"true"==my_calendar.grid&&e(".calendar-event").children().not(".event-title").hide(),"undefined"!=typeof my_calendar&&"true"==my_calendar.mini&&e(".mini .has-events").children().not(".trigger, .mc-date, .event-date").hide(),e("#"+s).attr("tabindex","-1").trigger("focus"),t()}))}))})),e(".mc-main a[target=_blank]").append(' <span class="dashicons dashicons-external" aria-hidden="true"></span><span class="screen-reader-text"> '+my_calendar.newWindow+"</span>")}(jQuery);
my-calendar-core.php CHANGED
@@ -1582,6 +1582,7 @@ function mc_scripts() {
1582
  $slug = sanitize_title( __( 'My Calendar', 'my-calendar' ) );
1583
 
1584
  if ( false !== strpos( $id, 'my-calendar' ) ) {
 
1585
  $mcs_version = ( get_option( 'mcs_version', '' ) ) ? get_option( 'mcs_version' ) : 1.0;
1586
  wp_enqueue_script( 'mc.admin', plugins_url( 'js/jquery.admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-sortable', 'wp-a11y' ), $version );
1587
  wp_localize_script(
1582
  $slug = sanitize_title( __( 'My Calendar', 'my-calendar' ) );
1583
 
1584
  if ( false !== strpos( $id, 'my-calendar' ) ) {
1585
+ // Script needs to be aware of current Pro version.
1586
  $mcs_version = ( get_option( 'mcs_version', '' ) ) ? get_option( 'mcs_version' ) : 1.0;
1587
  wp_enqueue_script( 'mc.admin', plugins_url( 'js/jquery.admin.js', __FILE__ ), array( 'jquery', 'jquery-ui-sortable', 'wp-a11y' ), $version );
1588
  wp_localize_script(
my-calendar-event-editor.php CHANGED
@@ -26,16 +26,23 @@ if ( ! defined( 'ABSPATH' ) ) {
26
  function mc_event_post( $action, $data, $event_id, $result = false ) {
27
  // if the event save was successful.
28
  $post_id = false;
 
 
 
 
 
 
 
29
  if ( 'add' === $action || 'copy' === $action ) {
30
  $post_id = mc_create_event_post( $data, $event_id );
31
  } elseif ( 'edit' === $action ) {
32
  if ( isset( $data['event_post'] ) && 'group' === $data['event_post'] ) {
33
  $post_id = mc_get_event_post( $event_id );
34
  } else {
35
- if ( isset( $_POST['event_post'] ) && ( 0 === (int) $_POST['event_post'] || '' === $_POST['event_post'] ) ) {
36
  $post_id = mc_create_event_post( $data, $event_id );
37
  } else {
38
- $post_id = ( isset( $_POST['event_post'] ) ) ? absint( $_POST['event_post'] ) : false;
39
  $post_id = ( isset( $data['event_post'] ) ) ? absint( $data['event_post'] ) : $post_id;
40
  }
41
  }
@@ -100,27 +107,27 @@ function mc_event_post( $action, $data, $event_id, $result = false ) {
100
  delete_post_thumbnail( $post_id );
101
  } else {
102
  // check POST data.
103
- $attachment_id = ( isset( $_POST['event_image_id'] ) && is_numeric( $_POST['event_image_id'] ) ) ? $_POST['event_image_id'] : false;
104
  $attachment_id = ( isset( $data['event_image_id'] ) && is_numeric( $data['event_image_id'] ) ) ? $data['event_image_id'] : $attachment_id;
105
  if ( $attachment_id ) {
106
  set_post_thumbnail( $post_id, $attachment_id );
107
  }
108
  }
109
- $access = ( isset( $_POST['events_access'] ) ) ? $_POST['events_access'] : array();
110
  $access_terms = implode( ',', array_values( $access ) );
111
  mc_update_event( 'event_access', $access_terms, $event_id, '%s' );
112
- mc_add_post_meta_data( $post_id, $_POST, $data, $event_id );
113
  /**
114
  * Execute action when an event's post is updated.
115
  *
116
  * @hook mc_update_event_post
117
  *
118
  * @param {int} $post_id Post ID.
119
- * @param {array} $_POST POST data.
120
  * @param {array} $data Submitted event data.
121
  * @param {int} $event_id Event ID.
122
  */
123
- do_action( 'mc_update_event_post', $post_id, $_POST, $data, $event_id );
124
  if ( mc_switch_sites() ) {
125
  restore_current_blog();
126
  }
@@ -197,6 +204,13 @@ function mc_add_post_meta_data( $post_id, $post, $data, $event_id ) {
197
  */
198
  function mc_create_event_post( $data, $event_id ) {
199
  $post_id = mc_get_event_post( $event_id );
 
 
 
 
 
 
 
200
  if ( ! $post_id ) {
201
  $categories = mc_get_categories( $event_id );
202
  $terms = array();
@@ -226,8 +240,8 @@ function mc_create_event_post( $data, $event_id ) {
226
  $description = isset( $data['event_desc'] ) ? $data['event_desc'] : '';
227
  $excerpt = isset( $data['event_short'] ) ? $data['event_short'] : '';
228
  $location_id = isset( $data['event_location'] ) ? $data['event_location'] : 0;
229
- if ( isset( $_POST['location_preset'] ) && is_numeric( $_POST['location_preset'] ) ) {
230
- $location_id = (int) $_POST['location_preset'];
231
  } elseif ( isset( $data['location_preset'] ) && is_numeric( $data['location_preset'] ) ) {
232
  $location_id = $data['location_preset'];
233
  }
@@ -247,8 +261,8 @@ function mc_create_event_post( $data, $event_id ) {
247
  $post_id = wp_insert_post( $my_post );
248
  wp_set_object_terms( $post_id, $terms, 'mc-event-category' );
249
  $attachment_id = false;
250
- if ( isset( $_POST['event_image_id'] ) ) {
251
- $attachment_id = (int) $_POST['event_image_id'];
252
  } elseif ( isset( $data['event_image_id'] ) ) {
253
  $attachment_id = (int) $data['event_image_id'];
254
  }
@@ -257,18 +271,18 @@ function mc_create_event_post( $data, $event_id ) {
257
  }
258
  mc_update_event( 'event_post', $post_id, $event_id );
259
  mc_update_event( 'event_location', $location_id, $event_id );
260
- mc_add_post_meta_data( $post_id, $_POST, $data, $event_id );
261
  /**
262
  * Execute action when an event's post is updated.
263
  *
264
  * @hook mc_update_event_post
265
  *
266
  * @param {int} $post_id Post ID.
267
- * @param {array} $_POST POST data.
268
  * @param {array} $data Submitted event data.
269
  * @param {int} $event_id Event ID.
270
  */
271
- do_action( 'mc_update_event_post', $post_id, $_POST, $data, $event_id );
272
  wp_publish_post( $post_id );
273
  }
274
 
@@ -1742,7 +1756,7 @@ function mc_form_fields( $data, $mode, $event_id ) {
1742
  if ( current_user_can( 'mc_edit_templates' ) || current_user_can( 'manage_options' ) ) {
1743
  ?>
1744
  <div class="postbox">
1745
- <h2><?php esc_html_e( 'Preview Template Output', 'my-calendar' ); ?></h2>
1746
  <div class="inside">
1747
  <p><?php esc_html_e( 'Template tags are used to build custom templates. Preview the output of selected template tags for this event.', 'my-calendar' ); ?></p>
1748
  <div class="mc-preview">
26
  function mc_event_post( $action, $data, $event_id, $result = false ) {
27
  // if the event save was successful.
28
  $post_id = false;
29
+ // Check if this is an ajax request.
30
+ $post_data = ( wp_doing_ajax() ) ? $_POST['post'] : $_POST;
31
+ if ( $post_data !== $_POST ) {
32
+ parse_str( $post_data, $post );
33
+ } else {
34
+ $post = $post_data;
35
+ }
36
  if ( 'add' === $action || 'copy' === $action ) {
37
  $post_id = mc_create_event_post( $data, $event_id );
38
  } elseif ( 'edit' === $action ) {
39
  if ( isset( $data['event_post'] ) && 'group' === $data['event_post'] ) {
40
  $post_id = mc_get_event_post( $event_id );
41
  } else {
42
+ if ( isset( $post['event_post'] ) && ( 0 === (int) $post['event_post'] || '' === $post['event_post'] ) ) {
43
  $post_id = mc_create_event_post( $data, $event_id );
44
  } else {
45
+ $post_id = ( isset( $post['event_post'] ) ) ? absint( $post['event_post'] ) : false;
46
  $post_id = ( isset( $data['event_post'] ) ) ? absint( $data['event_post'] ) : $post_id;
47
  }
48
  }
107
  delete_post_thumbnail( $post_id );
108
  } else {
109
  // check POST data.
110
+ $attachment_id = ( isset( $post['event_image_id'] ) && is_numeric( $post['event_image_id'] ) ) ? $post['event_image_id'] : false;
111
  $attachment_id = ( isset( $data['event_image_id'] ) && is_numeric( $data['event_image_id'] ) ) ? $data['event_image_id'] : $attachment_id;
112
  if ( $attachment_id ) {
113
  set_post_thumbnail( $post_id, $attachment_id );
114
  }
115
  }
116
+ $access = ( isset( $post['events_access'] ) ) ? $post['events_access'] : array();
117
  $access_terms = implode( ',', array_values( $access ) );
118
  mc_update_event( 'event_access', $access_terms, $event_id, '%s' );
119
+ mc_add_post_meta_data( $post_id, $post, $data, $event_id );
120
  /**
121
  * Execute action when an event's post is updated.
122
  *
123
  * @hook mc_update_event_post
124
  *
125
  * @param {int} $post_id Post ID.
126
+ * @param {array} $post POST data.
127
  * @param {array} $data Submitted event data.
128
  * @param {int} $event_id Event ID.
129
  */
130
+ do_action( 'mc_update_event_post', $post_id, $post, $data, $event_id );
131
  if ( mc_switch_sites() ) {
132
  restore_current_blog();
133
  }
204
  */
205
  function mc_create_event_post( $data, $event_id ) {
206
  $post_id = mc_get_event_post( $event_id );
207
+ // Check if this is an ajax request.
208
+ $post_data = ( wp_doing_ajax() ) ? $_POST['post'] : $_POST;
209
+ if ( $post_data !== $_POST ) {
210
+ parse_str( $post_data, $post );
211
+ } else {
212
+ $post = $post_data;
213
+ }
214
  if ( ! $post_id ) {
215
  $categories = mc_get_categories( $event_id );
216
  $terms = array();
240
  $description = isset( $data['event_desc'] ) ? $data['event_desc'] : '';
241
  $excerpt = isset( $data['event_short'] ) ? $data['event_short'] : '';
242
  $location_id = isset( $data['event_location'] ) ? $data['event_location'] : 0;
243
+ if ( isset( $post['location_preset'] ) && is_numeric( $post['location_preset'] ) ) {
244
+ $location_id = (int) $post['location_preset'];
245
  } elseif ( isset( $data['location_preset'] ) && is_numeric( $data['location_preset'] ) ) {
246
  $location_id = $data['location_preset'];
247
  }
261
  $post_id = wp_insert_post( $my_post );
262
  wp_set_object_terms( $post_id, $terms, 'mc-event-category' );
263
  $attachment_id = false;
264
+ if ( isset( $post['event_image_id'] ) ) {
265
+ $attachment_id = (int) $post['event_image_id'];
266
  } elseif ( isset( $data['event_image_id'] ) ) {
267
  $attachment_id = (int) $data['event_image_id'];
268
  }
271
  }
272
  mc_update_event( 'event_post', $post_id, $event_id );
273
  mc_update_event( 'event_location', $location_id, $event_id );
274
+ mc_add_post_meta_data( $post_id, $post, $data, $event_id );
275
  /**
276
  * Execute action when an event's post is updated.
277
  *
278
  * @hook mc_update_event_post
279
  *
280
  * @param {int} $post_id Post ID.
281
+ * @param {array} $post POST data.
282
  * @param {array} $data Submitted event data.
283
  * @param {int} $event_id Event ID.
284
  */
285
+ do_action( 'mc_update_event_post', $post_id, $post, $data, $event_id );
286
  wp_publish_post( $post_id );
287
  }
288
 
1756
  if ( current_user_can( 'mc_edit_templates' ) || current_user_can( 'manage_options' ) ) {
1757
  ?>
1758
  <div class="postbox">
1759
+ <h2><button type="button" class="button-link toggle-inside"><span class="dashicons dashicons-plus" aria-hidden="true"></span><?php esc_html_e( 'Preview Template Output', 'my-calendar' ); ?></button></h2>
1760
  <div class="inside">
1761
  <p><?php esc_html_e( 'Template tags are used to build custom templates. Preview the output of selected template tags for this event.', 'my-calendar' ); ?></p>
1762
  <div class="mc-preview">
my-calendar.php CHANGED
@@ -17,7 +17,7 @@
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
- * Version: 3.3.23
21
  */
22
 
23
  /*
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  }
43
 
44
  global $mc_version, $wpdb;
45
- $mc_version = '3.3.23';
46
 
47
  define( 'MC_DEBUG', false );
48
  define( 'MC_DIRECTORY', plugin_dir_path( __FILE__ ) );
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
+ * Version: 3.3.24.1
21
  */
22
 
23
  /*
42
  }
43
 
44
  global $mc_version, $wpdb;
45
+ $mc_version = '3.3.24.1';
46
 
47
  define( 'MC_DEBUG', false );
48
  define( 'MC_DIRECTORY', plugin_dir_path( __FILE__ ) );
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: calendar, dates, times, event, events, scheduling, schedule, event manager, event calendar, class, concert, venue, location, box office, tickets, registration
5
  Requires at least: 4.4
6
- Tested up to: 6.0
7
  Requires PHP: 7.0
8
  Text domain: my-calendar
9
- Stable tag: 3.3.23
10
  License: GPLv2 or later
11
 
12
  Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
@@ -88,6 +88,16 @@ Translating my plugins is always appreciated. Visit <a href="https://translate.w
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
 
 
 
 
91
  = 3.3.23 =
92
 
93
  * Bug fix: Don't set to default location if location already set.
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: calendar, dates, times, event, events, scheduling, schedule, event manager, event calendar, class, concert, venue, location, box office, tickets, registration
5
  Requires at least: 4.4
6
+ Tested up to: 6.1
7
  Requires PHP: 7.0
8
  Text domain: my-calendar
9
+ Stable tag: 3.3.24.1
10
  License: GPLv2 or later
11
 
12
  Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
88
 
89
  == Changelog ==
90
 
91
+ = 3.3.24.1 =
92
+
93
+ * Bug fix: minified mcjs.min.js was invalid in 3.3.24, breaking jump navigation selector.
94
+
95
+ = 3.3.24 =
96
+
97
+ * Bug fix: Don't catch non-ajax actions in navigation with JS.
98
+ * Change: Collapse template preview by default.
99
+ * Change: Change parsing of POST data when AJAX action executed.
100
+
101
  = 3.3.23 =
102
 
103
  * Bug fix: Don't set to default location if location already set.