My Calendar - Version 3.1.11

Version Description

  • New filter on mc_user_permissions operated on wrong variable.
Download this release

Release Info

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

Code changes from version 3.1.6 to 3.1.11

css/mc-styles.css CHANGED
@@ -398,14 +398,15 @@ strong.label {
398
  display: none;
399
  }
400
 
401
- .my-calendar-admin .ui-accordion-header, .mc-settings-page #mc-sortable li {
402
  border: 1px solid #ddd;
403
  background: rgba(0, 0, 0, .10);
404
  padding: .5em 1em;
405
  margin: 1px 0;
406
  }
407
 
408
- .mc-settings-page #mc-sortable .mc-updated {
 
409
  background-color: #ffa;
410
  }
411
 
@@ -463,6 +464,11 @@ input[name="mc_uri"] {
463
  color: #eee;
464
  }
465
 
 
 
 
 
 
466
  #mc-sortable li.mc-stop.mc-updated {
467
  color: #000;
468
  }
398
  display: none;
399
  }
400
 
401
+ .my-calendar-admin .ui-accordion-header, #mc-sortable li {
402
  border: 1px solid #ddd;
403
  background: rgba(0, 0, 0, .10);
404
  padding: .5em 1em;
405
  margin: 1px 0;
406
  }
407
 
408
+ .mc-settings-page #mc-sortable .mc-updated,
409
+ .mc-generator #mc-sortable .mc-updated {
410
  background-color: #ffa;
411
  }
412
 
464
  color: #eee;
465
  }
466
 
467
+ #mc-sortable .mc-ui-state-highlight {
468
+ background: #ffa !important;
469
+ height: 1.6em;
470
+ }
471
+
472
  #mc-sortable li.mc-stop.mc-updated {
473
  color: #000;
474
  }
includes/deprecated.php CHANGED
@@ -216,7 +216,7 @@ if ( ! function_exists( 'is_ssl' ) ) {
216
  }
217
 
218
  /**
219
- * Old name of template drawing function
220
  *
221
  * @see mc_draw_template()
222
  *
216
  }
217
 
218
  /**
219
+ * Old name of template drawing function. Deprecated 6/14/2018. Removed in Pro 3/31/2019.
220
  *
221
  * @see mc_draw_template()
222
  *
includes/widgets/class-my-calendar-today-widget.php CHANGED
@@ -69,7 +69,7 @@ class My_Calendar_Today_Widget extends WP_Widget {
69
  $site = ( isset( $instance['mc_site'] ) ) ? $instance['mc_site'] : false;
70
 
71
  if ( false !== strpos( $widget_title, '{date}' ) ) {
72
- $widget_title = str_replace( '{date}', date_i18n( get_option( 'mc_date_format' ), current_time( 'timestamp' ) ), $widget_title );
73
  }
74
  $widget_title = ( '' == $widget_link ) ? $widget_title : "<a href='$widget_link'>$widget_title</a>";
75
  $widget_title = ( '' != $widget_title ) ? $before_title . $widget_title . $after_title : '';
69
  $site = ( isset( $instance['mc_site'] ) ) ? $instance['mc_site'] : false;
70
 
71
  if ( false !== strpos( $widget_title, '{date}' ) ) {
72
+ $widget_title = str_replace( '{date}', date_i18n( mc_date_format(), current_time( 'timestamp' ) ), $widget_title );
73
  }
74
  $widget_title = ( '' == $widget_link ) ? $widget_title : "<a href='$widget_link'>$widget_title</a>";
75
  $widget_title = ( '' != $widget_title ) ? $before_title . $widget_title . $after_title : '';
js/ajax.js CHANGED
@@ -4,9 +4,15 @@
4
  $( '.mc_response' ).hide();
5
  $('button.delete_occurrence').on( 'click', function () {
6
  var value = $(this).attr( 'data-value' );
 
 
 
7
  var data = {
8
  'action': mc_data.action,
9
  'occur_id': value,
 
 
 
10
  'security': mc_data.security
11
  };
12
  $.post( ajaxurl, data, function (response) {
4
  $( '.mc_response' ).hide();
5
  $('button.delete_occurrence').on( 'click', function () {
6
  var value = $(this).attr( 'data-value' );
7
+ var id = $(this).attr( 'data-event' );
8
+ var begin = $(this).attr( 'data-begin' );
9
+ var end = $(this).attr( 'data-end' );
10
  var data = {
11
  'action': mc_data.action,
12
  'occur_id': value,
13
+ 'event_id': id,
14
+ 'occur_begin': begin,
15
+ 'occur_end': end,
16
  'security': mc_data.security
17
  };
18
  $.post( ajaxurl, data, function (response) {
js/jquery.admin.js CHANGED
@@ -2,7 +2,7 @@ jQuery(document).ready(function ($) {
2
  $('#add_field').on('click', function () {
3
  $('#event_span').show();
4
  var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have.
5
- var newNum = new Number(num + 1); // the numeric ID of the new input field being added.
6
  // create the new element via clone(), and manipulate it's ID using newNum value.
7
  var newElem = $('#event' + num).clone().attr('id', 'event' + newNum);
8
  // insert the new element after the last "duplicatable" input field.
@@ -51,13 +51,13 @@ jQuery(document).ready(function ($) {
51
  }
52
  });
53
 
54
- var publish_text = $( 'input[name=save]' ).val();
55
  $( '#e_approved' ).on( 'change', function (e) {
56
  var event_status = $(this).val();
57
  if ( event_status == 0 ) {
58
  $( 'input[name=save]' ).val( draftText );
59
  } else {
60
- $( 'input[name=save]' ).val( publish_text );
61
  }
62
  });
63
 
@@ -92,6 +92,39 @@ jQuery(document).ready(function ($) {
92
  $( '#mc-generator .custom' ).hide();
93
  }
94
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  });
96
 
97
  var mediaPopup = '';
@@ -147,24 +180,4 @@ var mediaPopup = '';
147
  mediaPopup.open();
148
  })
149
  });
150
- })(jQuery);
151
-
152
- jQuery(document).ready(function ($) {
153
- $('#mc-sortable').sortable({
154
- update: function (event, ui) {
155
- $('#mc-sortable-update').html( 'Submit form to save changes' );
156
- }
157
- });
158
- $('#mc-sortable .up').on('click', function (e) {
159
- e.preventDefault();
160
- $(this).parents('li').insertBefore($(this).parents('li').prev());
161
- $( '#mc-sortable li' ).removeClass( 'mc-updated' );
162
- $(this).parents('li').addClass( 'mc-updated' );
163
- });
164
- $('#mc-sortable .down').on('click', function (e) {
165
- e.preventDefault();
166
- $(this).parents('li').insertAfter($(this).parents('li').next());
167
- $( '#mc-sortable li' ).removeClass( 'mc-updated' );
168
- $(this).parents('li').addClass( 'mc-updated' );
169
- });
170
- });
2
  $('#add_field').on('click', function () {
3
  $('#event_span').show();
4
  var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have.
5
+ var newNum = new Number(num + 1); // the numeric ID of the new input field being added.
6
  // create the new element via clone(), and manipulate it's ID using newNum value.
7
  var newElem = $('#event' + num).clone().attr('id', 'event' + newNum);
8
  // insert the new element after the last "duplicatable" input field.
51
  }
52
  });
53
 
54
+ var publishText = $( 'input[name=save]' ).val();
55
  $( '#e_approved' ).on( 'change', function (e) {
56
  var event_status = $(this).val();
57
  if ( event_status == 0 ) {
58
  $( 'input[name=save]' ).val( draftText );
59
  } else {
60
+ $( 'input[name=save]' ).val( publishText );
61
  }
62
  });
63
 
92
  $( '#mc-generator .custom' ).hide();
93
  }
94
  });
95
+
96
+ $('#mc-sortable').sortable({
97
+ placeholder: 'mc-ui-state-highlight',
98
+ update: function (event, ui) {
99
+ $('#mc-sortable-update').html( 'Submit form to save changes' );
100
+ }
101
+ });
102
+ $('#mc-sortable .up').on('click', function (e) {
103
+ var parentEls = $( this ).parents().map(function() { return this.tagName; } ).get();
104
+ var parentLi = $.inArray( 'LI', parentEls );
105
+ if ( 1 == parentLi ) {
106
+ $(this).parents('li').insertBefore($(this).parents('li').prev());
107
+ $( '#mc-sortable li' ).removeClass( 'mc-updated' );
108
+ $(this).parents('li').addClass( 'mc-updated' );
109
+ } else {
110
+ $(this).parents('tr').insertBefore($(this).parents('tr').prev());
111
+ $( '#mc-sortable tr' ).removeClass( 'mc-updated' );
112
+ $(this).parents('tr').addClass( 'mc-updated' );
113
+ }
114
+ });
115
+ $('#mc-sortable .down').on('click', function (e) {
116
+ var parentEls = $( this ).parents().map(function() { return this.tagName; } ).get();
117
+ var parentLi = $.inArray( 'LI', parentEls );
118
+ if ( 1 == parentLi ) {
119
+ $(this).parents('li').insertAfter($(this).parents('li').next());
120
+ $( '#mc-sortable li' ).removeClass( 'mc-updated' );
121
+ $(this).parents('li').addClass( 'mc-updated' );
122
+ } else {
123
+ $(this).parents('tr').insertAfter($(this).parents('tr').next());
124
+ $( '#mc-sortable tr' ).removeClass( 'mc-updated' );
125
+ $(this).parents('tr').addClass( 'mc-updated' );
126
+ }
127
+ });
128
  });
129
 
130
  var mediaPopup = '';
180
  mediaPopup.open();
181
  })
182
  });
183
+ })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/mc-grid.js CHANGED
@@ -1,31 +1,31 @@
1
  (function ($) {
2
  'use strict';
3
  $(function () {
4
- $(".calendar-event").children().not(".event-title").hide();
5
 
6
- $(document).on("click", ".calendar-event .event-title",
7
  function (e) {
8
  e.preventDefault();
9
- var current_date = $(this).parent().children();
10
 
11
  $(this).closest( '.mc-main' ).toggleClass( 'grid-open' );
12
- $(this).parent().children().not(".event-title").toggle().attr("tabindex", "-1");
13
- $(this).parent().focus();
14
 
15
  var focusable = current_date.find( 'a, object, :input, iframe, [tabindex]' );
16
  var lastFocus = focusable.last();
17
  var firstFocus = focusable.first();
18
  lastFocus.attr( 'data-action', 'shiftback' );
19
 
20
- $(".calendar-event").children().not(".event-title").not( current_date ).hide();
21
  });
22
 
23
- $(document).on("click", ".calendar-event .close",
24
  function (e) {
25
  e.preventDefault();
26
  $(this).closest( '.mc-main' ).removeClass( 'grid-open' );
27
- $(this).closest(".vevent").find(".event-title a").focus();
28
- $(this).closest("div.details").toggle();
29
  });
30
 
31
  $(document).on( 'keydown', function(e) {
1
  (function ($) {
2
  'use strict';
3
  $(function () {
4
+ $('.calendar-event').children().not('.event-title').hide();
5
 
6
+ $(document).on('click', '.calendar-event .event-title a',
7
  function (e) {
8
  e.preventDefault();
9
+ var current_date = $(this).parents( '.vevent' ).children();
10
 
11
  $(this).closest( '.mc-main' ).toggleClass( 'grid-open' );
12
+ $(this).parents( '.vevent' ).children().not('.event-title').toggle().attr('tabindex', '-1');
13
+ $(this).parents( '.vevent' ).focus();
14
 
15
  var focusable = current_date.find( 'a, object, :input, iframe, [tabindex]' );
16
  var lastFocus = focusable.last();
17
  var firstFocus = focusable.first();
18
  lastFocus.attr( 'data-action', 'shiftback' );
19
 
20
+ $('.calendar-event').children().not('.event-title').not( current_date ).hide();
21
  });
22
 
23
+ $(document).on('click', '.calendar-event .close',
24
  function (e) {
25
  e.preventDefault();
26
  $(this).closest( '.mc-main' ).removeClass( 'grid-open' );
27
+ $(this).closest('.vevent').find('.event-title a').focus();
28
+ $(this).closest('div.details').toggle();
29
  });
30
 
31
  $(document).on( 'keydown', function(e) {
js/mc-list.js CHANGED
@@ -1,20 +1,20 @@
1
  (function ($) {
2
- 'use strict';
3
- $(function () {
4
- $("li.mc-events").children().not(".event-date").hide();
5
- $("li.current-day").children().show();
6
- $(document).on( "click", ".event-date button",
7
- function (e) {
8
- e.preventDefault();
9
  var vevent = $( this ).closest( '.mc-events' ).find( '.vevent:first' );
10
- $( this ).closest( '.mc-events' ).find( '.vevent' ).toggle();
11
- vevent.attr("tabindex", "-1").focus();
12
- var visible = $(this).closest( '.mc-events' ).find(".vevent").is(":visible");
13
- if ( visible ) {
14
- $(this).attr("aria-expanded", "true");
15
- } else {
16
- $(this).attr("aria-expanded", "false");
17
- }
18
- });
19
- });
20
- }(jQuery));
1
  (function ($) {
2
+ 'use strict';
3
+ $(function () {
4
+ $('li.mc-events').children().not('.event-date').hide();
5
+ $('li.current-day').children().show();
6
+ $(document).on( 'click', '.event-date button',
7
+ function (e) {
8
+ e.preventDefault();
9
  var vevent = $( this ).closest( '.mc-events' ).find( '.vevent:first' );
10
+ $( this ).closest( '.mc-events' ).find( '.vevent' ).toggle();
11
+ vevent.attr('tabindex', '-1').focus();
12
+ var visible = $(this).closest( '.mc-events' ).find('.vevent').is(':visible');
13
+ if ( visible ) {
14
+ $(this).attr('aria-expanded', 'true');
15
+ } else {
16
+ $(this).attr('aria-expanded', 'false');
17
+ }
18
+ });
19
+ });
20
+ }(jQuery));
my-calendar-api.php CHANGED
@@ -377,11 +377,12 @@ function mc_ics_subscribe_outlook() {
377
  * Generate ICS export of current period of events
378
  */
379
  function my_calendar_ical() {
380
- $p = ( isset( $_GET['span'] ) ) ? 'year' : false;
381
- $y = ( isset( $_GET['yr'] ) ) ? $_GET['yr'] : date( 'Y' );
382
- $m = ( isset( $_GET['month'] ) ) ? $_GET['month'] : date( 'n' );
383
- $ny = ( isset( $_GET['nyr'] ) ) ? $_GET['nyr'] : $y;
384
- $nm = ( isset( $_GET['nmonth'] ) ) ? $_GET['nmonth'] : $m;
 
385
 
386
  if ( $p ) {
387
  $from = "$y-1-1";
@@ -392,15 +393,13 @@ function my_calendar_ical() {
392
  $to = "$ny-$nm-$d";
393
  }
394
 
395
- $from = apply_filters( 'mc_ical_download_from', $from, $p );
396
- $to = apply_filters( 'mc_ical_download_to', $to, $p );
397
- $category = ( isset( $_GET['mcat'] ) ) ? intval( $_GET['mcat'] ) : null;
398
-
399
  $site = ( ! isset( $_GET['site'] ) ) ? get_current_blog_id() : intval( $_GET['site'] );
400
  $args = array(
401
  'from' => $from,
402
  'to' => $to,
403
- 'category' => $category,
404
  'ltype' => '',
405
  'lvalue' => '',
406
  'author' => null,
377
  * Generate ICS export of current period of events
378
  */
379
  function my_calendar_ical() {
380
+ $p = ( isset( $_GET['span'] ) ) ? 'year' : false;
381
+ $y = ( isset( $_GET['yr'] ) ) ? $_GET['yr'] : date( 'Y' );
382
+ $m = ( isset( $_GET['month'] ) ) ? $_GET['month'] : date( 'n' );
383
+ $ny = ( isset( $_GET['nyr'] ) ) ? $_GET['nyr'] : $y;
384
+ $nm = ( isset( $_GET['nmonth'] ) ) ? $_GET['nmonth'] : $m;
385
+ $cat = ( isset( $_GET['mcat'] ) ) ? intval( $_GET['mcat'] ) : '';
386
 
387
  if ( $p ) {
388
  $from = "$y-1-1";
393
  $to = "$ny-$nm-$d";
394
  }
395
 
396
+ $from = apply_filters( 'mc_ical_download_from', $from, $p );
397
+ $to = apply_filters( 'mc_ical_download_to', $to, $p );
 
 
398
  $site = ( ! isset( $_GET['site'] ) ) ? get_current_blog_id() : intval( $_GET['site'] );
399
  $args = array(
400
  'from' => $from,
401
  'to' => $to,
402
+ 'category' => $cat,
403
  'ltype' => '',
404
  'lvalue' => '',
405
  'author' => null,
my-calendar-categories.php CHANGED
@@ -394,6 +394,7 @@ function mc_edit_category_form( $view = 'edit', $cat_id = '' ) {
394
  <li>
395
  <label for="cat_icon"><?php _e( 'Category Icon', 'my-calendar' ); ?></label>
396
  <select name="category_icon" id="cat_icon">
 
397
  <?php
398
  foreach ( $iconlist as $value ) {
399
  $selected = ( ( ! empty( $cur_cat ) && is_object( $cur_cat ) ) && $cur_cat->category_icon == $value ) ? ' selected="selected"' : '';
394
  <li>
395
  <label for="cat_icon"><?php _e( 'Category Icon', 'my-calendar' ); ?></label>
396
  <select name="category_icon" id="cat_icon">
397
+ <option value=''><?php _e( 'None', 'my-calendar' ); ?></option>
398
  <?php
399
  foreach ( $iconlist as $value ) {
400
  $selected = ( ( ! empty( $cur_cat ) && is_object( $cur_cat ) ) && $cur_cat->category_icon == $value ) ? ' selected="selected"' : '';
my-calendar-core.php CHANGED
@@ -1139,9 +1139,22 @@ function mc_ajax_delete_occurrence() {
1139
  if ( current_user_can( 'mc_manage_events' ) ) {
1140
  global $wpdb;
1141
  $occur_id = (int) $_REQUEST['occur_id'];
 
 
 
1142
  $delete = 'DELETE FROM `' . my_calendar_event_table() . '` WHERE occur_id = %d';
1143
  $result = $wpdb->query( $wpdb->prepare( $delete, $occur_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
1144
 
 
 
 
 
 
 
 
 
 
 
1145
  if ( $result ) {
1146
  wp_send_json(
1147
  array(
@@ -1207,20 +1220,25 @@ function mc_ajax_add_date() {
1207
  $begin = strtotime( $event_date . ' ' . $event_time );
1208
  $end = ( '' != $event_endtime ) ? strtotime( $event_end . ' ' . $event_endtime ) : strtotime( $event_end . ' ' . $event_time ) + HOUR_IN_SECONDS;
1209
 
1210
- $format = array( '%d', '%s', '%s', '%d' );
1211
- $data = array(
1212
  'occur_event_id' => $event_id,
1213
  'occur_begin' => date( 'Y-m-d H:i:s', $begin ),
1214
  'occur_end' => date( 'Y-m-d H:i:s', $end ),
1215
  'occur_group_id' => $group_id,
1216
  );
1217
- $result = $wpdb->insert( my_calendar_event_table(), $data, $format );
 
 
 
 
 
1218
 
1219
  if ( $result ) {
1220
  wp_send_json(
1221
  array(
1222
  'success' => 1,
1223
- 'response' => __( 'Thanks! I added your new date.', 'my-calendar' ),
1224
  )
1225
  );
1226
  } else {
@@ -1241,6 +1259,7 @@ function mc_ajax_add_date() {
1241
  }
1242
  }
1243
 
 
1244
  /**
1245
  * Test whether currently mobile using wp_is_mobile() with custom filter
1246
  *
1139
  if ( current_user_can( 'mc_manage_events' ) ) {
1140
  global $wpdb;
1141
  $occur_id = (int) $_REQUEST['occur_id'];
1142
+ $event_id = (int) $_REQUEST['event_id'];
1143
+ $begin = $_REQUEST['occur_begin'];
1144
+ $end = $_REQUEST['occur_end'];
1145
  $delete = 'DELETE FROM `' . my_calendar_event_table() . '` WHERE occur_id = %d';
1146
  $result = $wpdb->query( $wpdb->prepare( $delete, $occur_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
1147
 
1148
+ $event_post = mc_get_event_post( $event_id );
1149
+ $instances = get_post_meta( $event_post, '_mc_deleted_instances', true );
1150
+ $instances = ( ! is_array( $instances ) ) ? array() : $instances;
1151
+ $instances[] = array(
1152
+ 'occur_event_id' => $event_id,
1153
+ 'occur_begin' => $begin,
1154
+ 'occur_end' => $end,
1155
+ );
1156
+ update_post_meta( $event_post, '_mc_deleted_instances', $instances );
1157
+
1158
  if ( $result ) {
1159
  wp_send_json(
1160
  array(
1220
  $begin = strtotime( $event_date . ' ' . $event_time );
1221
  $end = ( '' != $event_endtime ) ? strtotime( $event_end . ' ' . $event_endtime ) : strtotime( $event_end . ' ' . $event_time ) + HOUR_IN_SECONDS;
1222
 
1223
+ $format = array( '%d', '%s', '%s', '%d' );
1224
+ $data = array(
1225
  'occur_event_id' => $event_id,
1226
  'occur_begin' => date( 'Y-m-d H:i:s', $begin ),
1227
  'occur_end' => date( 'Y-m-d H:i:s', $end ),
1228
  'occur_group_id' => $group_id,
1229
  );
1230
+ $result = $wpdb->insert( my_calendar_event_table(), $data, $format );
1231
+ $event_post = mc_get_event_post( $event_id );
1232
+ $instances = get_post_meta( $event_post, '_mc_custom_instances', true );
1233
+ $instances = ( ! is_array( $instances ) ) ? array() : $instances;
1234
+ $instances[] = $data;
1235
+ update_post_meta( $event_id, '_mc_custom_instances', $instances );
1236
 
1237
  if ( $result ) {
1238
  wp_send_json(
1239
  array(
1240
  'success' => 1,
1241
+ 'response' => __( 'Thanks! Your new date is saved to your calendar.', 'my-calendar' ),
1242
  )
1243
  );
1244
  } else {
1259
  }
1260
  }
1261
 
1262
+
1263
  /**
1264
  * Test whether currently mobile using wp_is_mobile() with custom filter
1265
  *
my-calendar-event-manager.php CHANGED
@@ -123,6 +123,9 @@ function mc_add_post_meta_data( $post_id, $post, $data, $event_id ) {
123
  update_post_meta( $post_id, '_mc_event_id', $event_id );
124
  update_post_meta( $post_id, '_mc_event_desc', $description );
125
  update_post_meta( $post_id, '_mc_event_image', $image );
 
 
 
126
  update_post_meta( $post_id, '_event_time_label', ( isset( $_POST['event_time_label'] ) ) ? $_POST['event_time_label'] : '' );
127
  $location_id = ( isset( $post['location_preset'] ) ) ? (int) $post['location_preset'] : false;
128
  if ( $location_id ) { // only change location ID if dropdown set.
@@ -785,6 +788,10 @@ function my_calendar_save( $action, $output, $event_id = false ) {
785
  // Function mc_increment_event uses previous events and re-uses same ID if new has same date as old event.
786
  $instances = mc_get_instances( $event_id );
787
  mc_delete_instances( $event_id );
 
 
 
 
788
  mc_increment_event( $event_id, array(), false, $instances );
789
  }
790
  }
@@ -1379,17 +1386,9 @@ function mc_form_fields( $data, $mode, $event_id ) {
1379
  }
1380
  }
1381
  echo apply_filters( 'mc_before_event_form', '', $event_id );
1382
- $action = add_query_arg( $query_args, admin_url( 'admin.php?page=my-calendar' ) );
1383
- if ( ! empty( $data->event_group_id ) && 'copy' != $mode ) {
1384
- $group_id = $data->event_group_id;
1385
- } else {
1386
- $group_id = mc_group_id();
1387
- }
1388
- if ( 'edit' != $mode ) {
1389
- $event_author = $user_ID;
1390
- } else {
1391
- $event_author = $data->event_author;
1392
- }
1393
  ?>
1394
  <form id="my-calendar" method="post" action="<?php echo $action; ?>">
1395
  <div>
@@ -1431,12 +1430,21 @@ function mc_form_fields( $data, $mode, $event_id ) {
1431
  <h2><?php esc_html( $text ); ?></h2>
1432
  <div class="inside">
1433
  <div class='mc-controls'>
1434
- <?php echo mc_controls( $mode, $has_data, $data ); ?>
 
 
 
 
 
 
 
 
 
1435
  </div>
1436
  <?php
1437
  if ( ! empty( $_GET['date'] ) && 'S' != $data->event_recur ) {
1438
  $event = mc_get_event( $instance );
1439
- $date = date_i18n( get_option( 'mc_date_format' ), mc_strtotime( $event->occur_begin ) );
1440
  // Translators: Date of a specific event occurrence.
1441
  $message = sprintf( __( 'You are editing the <strong>%s</strong> instance of this event. Other instances of this event will not be changed.', 'my-calendar' ), $date );
1442
  mc_show_notice( $message );
@@ -2282,8 +2290,7 @@ function mc_list_events() {
2282
  } else {
2283
  $event_time = mc_notime_label( $event );
2284
  }
2285
- $date_format = ( get_option( 'mc_date_format' ) == '' ) ? get_option( 'date_format' ) : get_option( 'mc_date_format' );
2286
- $begin = date_i18n( $date_format, mc_strtotime( $event->event_begin ) );
2287
  echo esc_html( "$begin, $event_time" );
2288
  ?>
2289
  <div class="recurs">
@@ -3063,16 +3070,18 @@ function mc_instance_list( $args ) {
3063
  */
3064
  function mc_admin_instances( $id, $occur = false ) {
3065
  global $wpdb;
3066
- $output = '';
3067
- $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . my_calendar_event_table() . ' WHERE occur_event_id=%d ORDER BY occur_begin ASC', $id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
 
 
3068
  if ( is_array( $results ) && is_admin() ) {
3069
  foreach ( $results as $result ) {
3070
- $begin = "<span id='occur_date_$result->occur_id'>" . date_i18n( get_option( 'mc_date_format' ), mc_strtotime( $result->occur_begin ) ) . ', ' . date( get_option( 'mc_time_format' ), mc_strtotime( $result->occur_begin ) ) . '</span>';
3071
  if ( $result->occur_id == $occur ) {
3072
  $control = '';
3073
  $edit = '<em>' . __( 'Editing Now', 'my-calendar' ) . '</em>';
3074
  } else {
3075
- $control = "$begin: <button class='delete_occurrence' type='button' data-value='$result->occur_id' aria-describedby='occur_date_$result->occur_id' />" . __( 'Delete', 'my-calendar' ) . '</button> ';
3076
  $edit = "<a href='" . admin_url( 'admin.php?page=my-calendar' ) . "&amp;mode=edit&amp;event_id=$id&amp;date=$result->occur_id' aria-describedby='occur_date_$result->occur_id'>" . __( 'Edit', 'my-calendar' ) . '</a>';
3077
  }
3078
  $output .= "<li>$control$edit</li>";
@@ -3132,13 +3141,15 @@ function mc_standard_datetime_input( $form, $has_data, $data, $instance, $contex
3132
  if ( $has_data ) {
3133
  $event_begin = esc_attr( $data->event_begin );
3134
  $event_end = esc_attr( $data->event_end );
 
3135
  if ( isset( $_GET['date'] ) ) {
3136
  $event = mc_get_event( (int) $_GET['date'] );
3137
  $event_begin = date( 'Y-m-d', mc_strtotime( $event->occur_begin ) );
3138
  $event_end = date( 'Y-m-d', mc_strtotime( $event->occur_end ) );
3139
- if ( $event_begin == $event_end ) {
3140
- $event_end = '';
3141
- }
 
3142
  }
3143
  $starttime = ( mc_is_all_day( $data ) ) ? '' : date( apply_filters( 'mc_time_format', 'h:i A' ), mc_strtotime( $data->event_time ) );
3144
  $endtime = ( mc_is_all_day( $data ) ) ? '' : date( apply_filters( 'mc_time_format', 'h:i A' ), mc_strtotime( $data->event_endtime ) );
@@ -3425,7 +3436,7 @@ function mc_related_events( $id ) {
3425
  $event = $result->occur_event_id;
3426
  $current = '<a href="' . admin_url( 'admin.php?page=my-calendar' ) . '&amp;mode=edit&amp;event_id=' . $event . '">';
3427
  $end = '</a>';
3428
- $begin = date_i18n( get_option( 'mc_date_format' ), strtotime( $result->occur_begin ) ) . ', ' . date( get_option( 'mc_time_format' ), strtotime( $result->occur_begin ) );
3429
  $template = $current . $begin . $end;
3430
  $output .= "<li>$template</li>";
3431
  }
@@ -3446,6 +3457,7 @@ function mc_related_events( $id ) {
3446
  */
3447
  function mc_can_edit_category( $category, $user ) {
3448
  $permissions = get_user_meta( $user, 'mc_user_permissions', true );
 
3449
 
3450
  if ( empty( $permissions ) || in_array( 'all', $permissions ) || in_array( $category, $permissions ) || current_user_can( 'manage_options' ) ) {
3451
  return true;
@@ -3754,9 +3766,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3754
  if ( 'test' == $test && $i > 0 ) {
3755
  return $data;
3756
  }
3757
- if ( true == $test ) {
3758
- $return[] = $data;
3759
- }
3760
  if ( ! $test ) {
3761
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'daily' );
3762
  if ( ! $insert ) {
@@ -3786,9 +3796,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3786
  if ( 'test' == $test && $i > 0 ) {
3787
  return $data;
3788
  }
3789
- if ( true == $test ) {
3790
- $return[] = $data;
3791
- }
3792
  if ( ! $test ) {
3793
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'daily' );
3794
  if ( ! $insert ) {
@@ -3815,9 +3823,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3815
  if ( 'test' == $test && $i > 0 ) {
3816
  return $data;
3817
  }
3818
- if ( true == $test ) {
3819
- $return[] = $data;
3820
- }
3821
  if ( ! $test ) {
3822
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'daily' );
3823
  if ( ! $insert ) {
@@ -3842,9 +3848,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3842
  if ( 'test' == $test && $i > 0 ) {
3843
  return $data;
3844
  }
3845
- if ( true == $test ) {
3846
- $return[] = $data;
3847
- }
3848
  if ( ! $test ) {
3849
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'weekly' );
3850
  if ( ! $insert ) {
@@ -3868,9 +3872,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3868
  if ( 'test' == $test && $i > 0 ) {
3869
  return $data;
3870
  }
3871
- if ( true == $test ) {
3872
- $return[] = $data;
3873
- }
3874
  if ( ! $test ) {
3875
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'biweekly' );
3876
  if ( ! $insert ) {
@@ -3894,9 +3896,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3894
  if ( 'test' == $test && $i > 0 ) {
3895
  return $data;
3896
  }
3897
- if ( true == $test ) {
3898
- $return[] = $data;
3899
- }
3900
  if ( ! $test ) {
3901
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'monthly' );
3902
  if ( ! $insert ) {
@@ -3952,6 +3952,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3952
  if ( 'test' == $test && $i > 0 ) {
3953
  return $data;
3954
  }
 
3955
  if ( ! $test ) {
3956
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'month-by-day' );
3957
  if ( ! $insert ) {
@@ -3977,9 +3978,7 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3977
  if ( 'test' == $test && $i > 0 ) {
3978
  return $data;
3979
  }
3980
- if ( true == $test ) {
3981
- $return[] = $data;
3982
- }
3983
  if ( ! $test ) {
3984
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'annual' );
3985
  if ( ! $insert ) {
123
  update_post_meta( $post_id, '_mc_event_id', $event_id );
124
  update_post_meta( $post_id, '_mc_event_desc', $description );
125
  update_post_meta( $post_id, '_mc_event_image', $image );
126
+ // This is only used by My Tickets, so only the first date occurrence is required.
127
+ $event_date = ( is_array( $data['event_begin'] ) ) ? $data['event_begin'][0] : $data['event_begin'];
128
+ update_post_meta( $post_id, '_mc_event_date', strtotime( $event_date ) );
129
  update_post_meta( $post_id, '_event_time_label', ( isset( $_POST['event_time_label'] ) ) ? $_POST['event_time_label'] : '' );
130
  $location_id = ( isset( $post['location_preset'] ) ) ? (int) $post['location_preset'] : false;
131
  if ( $location_id ) { // only change location ID if dropdown set.
788
  // Function mc_increment_event uses previous events and re-uses same ID if new has same date as old event.
789
  $instances = mc_get_instances( $event_id );
790
  mc_delete_instances( $event_id );
791
+ // Delete previously created custom & deleted instance records.
792
+ $post_ID = mc_get_data( 'event_post', $event_id );
793
+ delete_post_meta( $post_ID, '_mc_custom_instances' );
794
+ delete_post_meta( $post_ID, '_mc_deleted_instances' );
795
  mc_increment_event( $event_id, array(), false, $instances );
796
  }
797
  }
1386
  }
1387
  }
1388
  echo apply_filters( 'mc_before_event_form', '', $event_id );
1389
+ $action = add_query_arg( $query_args, admin_url( 'admin.php?page=my-calendar' ) );
1390
+ $group_id = ( ! empty( $data->event_group_id ) && 'copy' != $mode ) ? $data->event_group_id : mc_group_id();
1391
+ $event_author = ( 'edit' != $mode ) ? $user_ID : $data->event_author;
 
 
 
 
 
 
 
 
1392
  ?>
1393
  <form id="my-calendar" method="post" action="<?php echo $action; ?>">
1394
  <div>
1430
  <h2><?php esc_html( $text ); ?></h2>
1431
  <div class="inside">
1432
  <div class='mc-controls'>
1433
+ <?php
1434
+ if ( $post_id ) {
1435
+ $deleted = get_post_meta( $post_id, '_mc_deleted_instances', true );
1436
+ $custom = get_post_meta( $post_id, '_mc_custom_instances', true );
1437
+ if ( $deleted || $custom ) {
1438
+ mc_show_notice( __( 'Some repetitions of this recurring event have been deleted or modified. Update the date or recurring pattern for the event to reset its repeat events.', 'my-calendar' ) );
1439
+ }
1440
+ }
1441
+ echo mc_controls( $mode, $has_data, $data );
1442
+ ?>
1443
  </div>
1444
  <?php
1445
  if ( ! empty( $_GET['date'] ) && 'S' != $data->event_recur ) {
1446
  $event = mc_get_event( $instance );
1447
+ $date = date_i18n( mc_date_format(), mc_strtotime( $event->occur_begin ) );
1448
  // Translators: Date of a specific event occurrence.
1449
  $message = sprintf( __( 'You are editing the <strong>%s</strong> instance of this event. Other instances of this event will not be changed.', 'my-calendar' ), $date );
1450
  mc_show_notice( $message );
2290
  } else {
2291
  $event_time = mc_notime_label( $event );
2292
  }
2293
+ $begin = date_i18n( mc_date_format(), mc_strtotime( $event->event_begin ) );
 
2294
  echo esc_html( "$begin, $event_time" );
2295
  ?>
2296
  <div class="recurs">
3070
  */
3071
  function mc_admin_instances( $id, $occur = false ) {
3072
  global $wpdb;
3073
+ $output = '';
3074
+ $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . my_calendar_event_table() . ' WHERE occur_event_id=%d ORDER BY occur_begin ASC', $id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
3075
+ $event_post = mc_get_event_post( $id );
3076
+ $deleted = get_post_meta( $event_post, '_mc_deleted_instances', true );
3077
  if ( is_array( $results ) && is_admin() ) {
3078
  foreach ( $results as $result ) {
3079
+ $begin = "<span id='occur_date_$result->occur_id'>" . date_i18n( mc_date_format(), mc_strtotime( $result->occur_begin ) ) . ', ' . date( get_option( 'mc_time_format' ), mc_strtotime( $result->occur_begin ) ) . '</span>';
3080
  if ( $result->occur_id == $occur ) {
3081
  $control = '';
3082
  $edit = '<em>' . __( 'Editing Now', 'my-calendar' ) . '</em>';
3083
  } else {
3084
+ $control = "$begin: <button class='delete_occurrence' type='button' data-event='$result->occur_event_id' data-begin='$result->occur_begin' data-end='$result->occur_end' data-value='$result->occur_id' aria-describedby='occur_date_$result->occur_id' />" . __( 'Delete', 'my-calendar' ) . '</button> ';
3085
  $edit = "<a href='" . admin_url( 'admin.php?page=my-calendar' ) . "&amp;mode=edit&amp;event_id=$id&amp;date=$result->occur_id' aria-describedby='occur_date_$result->occur_id'>" . __( 'Edit', 'my-calendar' ) . '</a>';
3086
  }
3087
  $output .= "<li>$control$edit</li>";
3141
  if ( $has_data ) {
3142
  $event_begin = esc_attr( $data->event_begin );
3143
  $event_end = esc_attr( $data->event_end );
3144
+
3145
  if ( isset( $_GET['date'] ) ) {
3146
  $event = mc_get_event( (int) $_GET['date'] );
3147
  $event_begin = date( 'Y-m-d', mc_strtotime( $event->occur_begin ) );
3148
  $event_end = date( 'Y-m-d', mc_strtotime( $event->occur_end ) );
3149
+ }
3150
+ // Set event end to empty if matches begin. Makes input and changes easier.
3151
+ if ( $event_begin == $event_end ) {
3152
+ $event_end = '';
3153
  }
3154
  $starttime = ( mc_is_all_day( $data ) ) ? '' : date( apply_filters( 'mc_time_format', 'h:i A' ), mc_strtotime( $data->event_time ) );
3155
  $endtime = ( mc_is_all_day( $data ) ) ? '' : date( apply_filters( 'mc_time_format', 'h:i A' ), mc_strtotime( $data->event_endtime ) );
3436
  $event = $result->occur_event_id;
3437
  $current = '<a href="' . admin_url( 'admin.php?page=my-calendar' ) . '&amp;mode=edit&amp;event_id=' . $event . '">';
3438
  $end = '</a>';
3439
+ $begin = date_i18n( mc_date_format(), strtotime( $result->occur_begin ) ) . ', ' . date( get_option( 'mc_time_format' ), strtotime( $result->occur_begin ) );
3440
  $template = $current . $begin . $end;
3441
  $output .= "<li>$template</li>";
3442
  }
3457
  */
3458
  function mc_can_edit_category( $category, $user ) {
3459
  $permissions = get_user_meta( $user, 'mc_user_permissions', true );
3460
+ $permissions = (array) apply_filters( 'mc_user_permissions', $permissions, $category, $user );
3461
 
3462
  if ( empty( $permissions ) || in_array( 'all', $permissions ) || in_array( $category, $permissions ) || current_user_can( 'manage_options' ) ) {
3463
  return true;
3766
  if ( 'test' == $test && $i > 0 ) {
3767
  return $data;
3768
  }
3769
+ $return[] = $data;
 
 
3770
  if ( ! $test ) {
3771
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'daily' );
3772
  if ( ! $insert ) {
3796
  if ( 'test' == $test && $i > 0 ) {
3797
  return $data;
3798
  }
3799
+ $return[] = $data;
 
 
3800
  if ( ! $test ) {
3801
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'daily' );
3802
  if ( ! $insert ) {
3823
  if ( 'test' == $test && $i > 0 ) {
3824
  return $data;
3825
  }
3826
+ $return[] = $data;
 
 
3827
  if ( ! $test ) {
3828
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'daily' );
3829
  if ( ! $insert ) {
3848
  if ( 'test' == $test && $i > 0 ) {
3849
  return $data;
3850
  }
3851
+ $return[] = $data;
 
 
3852
  if ( ! $test ) {
3853
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'weekly' );
3854
  if ( ! $insert ) {
3872
  if ( 'test' == $test && $i > 0 ) {
3873
  return $data;
3874
  }
3875
+ $return[] = $data;
 
 
3876
  if ( ! $test ) {
3877
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'biweekly' );
3878
  if ( ! $insert ) {
3896
  if ( 'test' == $test && $i > 0 ) {
3897
  return $data;
3898
  }
3899
+ $return[] = $data;
 
 
3900
  if ( ! $test ) {
3901
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'monthly' );
3902
  if ( ! $insert ) {
3952
  if ( 'test' == $test && $i > 0 ) {
3953
  return $data;
3954
  }
3955
+ $return[] = $data;
3956
  if ( ! $test ) {
3957
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'month-by-day' );
3958
  if ( ! $insert ) {
3978
  if ( 'test' == $test && $i > 0 ) {
3979
  return $data;
3980
  }
3981
+ $return[] = $data;
 
 
3982
  if ( ! $test ) {
3983
  $insert = apply_filters( 'mc_insert_recurring', false, $data, $format, $id, 'annual' );
3984
  if ( ! $insert ) {
my-calendar-group-manager.php CHANGED
@@ -1138,8 +1138,7 @@ function mc_list_groups() {
1138
  ?>
1139
  <td>
1140
  <?php
1141
- $date_format = ( '' == get_option( 'mc_date_format' ) ) ? get_option( 'date_format' ) : get_option( 'mc_date_format' );
1142
- $begin = date_i18n( $date_format, strtotime( $event->event_begin ) );
1143
  echo esc_html( "$begin, $event_time" );
1144
  ?>
1145
  <div class="recurs">
1138
  ?>
1139
  <td>
1140
  <?php
1141
+ $begin = date_i18n( mc_date_format(), strtotime( $event->event_begin ) );
 
1142
  echo esc_html( "$begin, $event_time" );
1143
  ?>
1144
  <div class="recurs">
my-calendar-output.php CHANGED
@@ -33,6 +33,17 @@ function mc_get_template( $template ) {
33
  return trim( $template );
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * HTML output for event time
38
  *
@@ -42,8 +53,8 @@ function mc_get_template( $template ) {
42
  * @return string HTML output.
43
  */
44
  function mc_time_html( $e, $type ) {
45
- $orig_format = get_option( 'mc_date_format' );
46
- $date_format = ( '' != $orig_format ) ? $orig_format : get_option( 'date_format' );
47
  $time_format = get_option( 'mc_time_format' );
48
  $start = date( 'Y-m-d', strtotime( $e->occur_begin ) );
49
  $end = date( 'Y-m-d', strtotime( $e->occur_end ) );
@@ -69,7 +80,7 @@ function mc_time_html( $e, $type ) {
69
  $time_content .= "\n
70
  <span class='event-time dtstart'>
71
  <time class='value-title' datetime='" . $start . 'T' . $e->event_time . "' title='" . $start . 'T' . $e->event_time . "'>" .
72
- date_i18n( $time_format, strtotime( $e->event_time ) ) . '
73
  </time>
74
  </span>';
75
  if ( 0 == $e->event_hide_end ) {
@@ -77,7 +88,7 @@ function mc_time_html( $e, $type ) {
77
  $time_content .= "
78
  <span class='time-separator'> &ndash; </span>$final
79
  <span class='end-time dtend'>
80
- <time class='value-title' datetime='" . $end . 'T' . $e->event_endtime . "' title='" . $end . 'T' . $e->event_endtime . "'>" . date_i18n( $time_format, strtotime( $e->event_endtime ) ) . '
81
  </time>
82
  </span>';
83
  }
@@ -297,9 +308,14 @@ function my_calendar_draw_event( $event, $type = 'calendar', $process_date, $tim
297
  }
298
 
299
  $event_title = mc_draw_template( $data, $title_template );
 
 
 
 
300
  $event_title = ( '' == $event_title ) ? $data['title'] : strip_tags( $event_title, mc_strip_tags() );
 
301
 
302
- if ( ( strpos( $event_title, 'href' ) === false ) && 'mini' != $type && 'list' != $type ) {
303
  if ( 'true' == $open_uri ) {
304
  $details_link = esc_url( mc_get_details_link( $event ) );
305
  $wrap = ( _mc_is_url( $details_link ) ) ? "<a href='$details_link' class='url summary$has_image'>" : '<span class="no-link">';
@@ -542,6 +558,24 @@ function mc_get_event_image( $event, $data ) {
542
  return $meta . $image;
543
  }
544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  /**
546
  * Generate classes for a given event
547
  *
@@ -635,7 +669,9 @@ function mc_category_class( $object, $prefix ) {
635
  * @return boolean
636
  */
637
  function mc_show_details( $time, $type ) {
638
- return ( 'calendar' == $type && 'true' == get_option( 'mc_open_uri' ) && 'day' != $time ) ? false : true;
 
 
639
  }
640
 
641
  add_filter( 'mc_after_event', 'mc_edit_panel', 10, 4 );
@@ -1573,7 +1609,7 @@ function my_calendar( $args ) {
1573
  $grid_js_class = ( 0 == get_option( 'mc_calendar_javascript' ) ) ? 'gridjs' : '';
1574
  $mini_js_class = ( 0 == get_option( 'mc_mini_javascript' ) ) ? 'minijs' : '';
1575
  $ajax_js_class = ( 0 == get_option( 'mc_ajax_javascript' ) ) ? 'ajaxjs' : '';
1576
- $date_format = ( '' != get_option( 'mc_date_format' ) ) ? get_option( 'mc_date_format' ) : get_option( 'date_format' );
1577
  $start_of_week = ( get_option( 'start_of_week' ) == 1 ) ? 1 : 7; // convert start of week to ISO 8601 (Monday/Sunday).
1578
  $show_weekends = ( get_option( 'mc_show_weekends' ) == 'true' ) ? true : false;
1579
  $skip_holidays = get_option( 'mc_skip_holidays_category' );
@@ -2933,7 +2969,7 @@ function mc_build_url( $add, $subtract, $root = '' ) {
2933
  unset( $variables['page_id'] );
2934
  $home = add_query_arg( $variables, $home );
2935
 
2936
- return $home;
2937
  }
2938
 
2939
  /**
33
  return trim( $template );
34
  }
35
 
36
+ /**
37
+ * Get the date format for My Calendar primary views.
38
+ *
39
+ * @return string
40
+ */
41
+ function mc_date_format() {
42
+ $date_format = ( '' == get_option( 'mc_date_format' ) ) ? get_option( 'date_format' ) : get_option( 'mc_date_format' );
43
+
44
+ return $date_format;
45
+ }
46
+
47
  /**
48
  * HTML output for event time
49
  *
53
  * @return string HTML output.
54
  */
55
  function mc_time_html( $e, $type ) {
56
+ $date_format = mc_date_format();
57
+ $orig_format = $date_format;
58
  $time_format = get_option( 'mc_time_format' );
59
  $start = date( 'Y-m-d', strtotime( $e->occur_begin ) );
60
  $end = date( 'Y-m-d', strtotime( $e->occur_end ) );
80
  $time_content .= "\n
81
  <span class='event-time dtstart'>
82
  <time class='value-title' datetime='" . $start . 'T' . $e->event_time . "' title='" . $start . 'T' . $e->event_time . "'>" .
83
+ date_i18n( $time_format, strtotime( $e->occur_begin ) ) . '
84
  </time>
85
  </span>';
86
  if ( 0 == $e->event_hide_end ) {
88
  $time_content .= "
89
  <span class='time-separator'> &ndash; </span>$final
90
  <span class='end-time dtend'>
91
+ <time class='value-title' datetime='" . $end . 'T' . $e->event_endtime . "' title='" . $end . 'T' . $e->event_endtime . "'>" . date_i18n( $time_format, strtotime( $e->occur_end ) ) . '
92
  </time>
93
  </span>';
94
  }
308
  }
309
 
310
  $event_title = mc_draw_template( $data, $title_template );
311
+ if ( 0 === strpos( $event_title, ': ' ) ) {
312
+ // If the first two characters of the title are ": ", this is the default templates but no time.
313
+ $event_title = str_replace( ': ', '', $event_title );
314
+ }
315
  $event_title = ( '' == $event_title ) ? $data['title'] : strip_tags( $event_title, mc_strip_tags() );
316
+ $no_link = apply_filters( 'mc_disable_link', false, $data );
317
 
318
+ if ( ( ( strpos( $event_title, 'href' ) === false ) && 'mini' != $type && 'list' != $type ) && ! $no_link ) {
319
  if ( 'true' == $open_uri ) {
320
  $details_link = esc_url( mc_get_details_link( $event ) );
321
  $wrap = ( _mc_is_url( $details_link ) ) ? "<a href='$details_link' class='url summary$has_image'>" : '<span class="no-link">';
558
  return $meta . $image;
559
  }
560
 
561
+ /**
562
+ * If option to disable link is toggled, disable the link.
563
+ *
564
+ * @param boolean $status Default value.
565
+ * @param array $event Event details.
566
+ *
567
+ * @return boolean
568
+ */
569
+ function mc_disable_link( $status, $event ) {
570
+ $option = get_option( 'mc_no_link' );
571
+ if ( 'true' == $option ) {
572
+ $status = true;
573
+ }
574
+
575
+ return $status;
576
+ }
577
+ add_filter( 'mc_disable_link', 'mc_disable_link', 10, 2 );
578
+
579
  /**
580
  * Generate classes for a given event
581
  *
669
  * @return boolean
670
  */
671
  function mc_show_details( $time, $type ) {
672
+ $no_link = apply_filters( 'mc_disable_link', false, array() );
673
+
674
+ return ( ( 'calendar' == $type && 'true' == get_option( 'mc_open_uri' ) && 'day' != $time ) || $no_link ) ? false : true;
675
  }
676
 
677
  add_filter( 'mc_after_event', 'mc_edit_panel', 10, 4 );
1609
  $grid_js_class = ( 0 == get_option( 'mc_calendar_javascript' ) ) ? 'gridjs' : '';
1610
  $mini_js_class = ( 0 == get_option( 'mc_mini_javascript' ) ) ? 'minijs' : '';
1611
  $ajax_js_class = ( 0 == get_option( 'mc_ajax_javascript' ) ) ? 'ajaxjs' : '';
1612
+ $date_format = mc_date_format();
1613
  $start_of_week = ( get_option( 'start_of_week' ) == 1 ) ? 1 : 7; // convert start of week to ISO 8601 (Monday/Sunday).
1614
  $show_weekends = ( get_option( 'mc_show_weekends' ) == 'true' ) ? true : false;
1615
  $skip_holidays = get_option( 'mc_skip_holidays_category' );
2969
  unset( $variables['page_id'] );
2970
  $home = add_query_arg( $variables, $home );
2971
 
2972
+ return esc_url( $home );
2973
  }
2974
 
2975
  /**
my-calendar-settings.php CHANGED
@@ -263,6 +263,7 @@ function my_calendar_settings() {
263
  $mc_open_day_uri = ( ! empty( $_POST['mc_open_day_uri'] ) ) ? $_POST['mc_open_day_uri'] : '';
264
  update_option( 'mc_use_permalinks', ( ! empty( $_POST['mc_use_permalinks'] ) ) ? 'true' : 'false' );
265
  update_option( 'mc_open_uri', ( ! empty( $_POST['mc_open_uri'] ) && 'on' == $_POST['mc_open_uri'] && '' != get_option( 'mc_uri' ) ) ? 'true' : 'false' );
 
266
  update_option( 'mc_mini_uri', $_POST['mc_mini_uri'] );
267
  update_option( 'mc_open_day_uri', $mc_open_day_uri );
268
  update_option( 'mc_display_author', ( ! empty( $_POST['mc_display_author'] ) && 'on' == $_POST['mc_display_author'] ) ? 'true' : 'false' );
@@ -525,27 +526,7 @@ function my_calendar_settings() {
525
  <?php
526
  }
527
  ?>
528
- <li><?php mc_settings_field( 'mc_remote', __( 'Get data (events, categories and locations) from a remote database.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
529
- <?php
530
- if ( 'true' == get_option( 'mc_remote' ) && ! function_exists( 'mc_remote_db' ) ) {
531
- ?>
532
- <li><?php _e( 'Add this code to your theme\'s <code>functions.php</code> file:', 'my-calendar' ); ?>
533
- <pre>
534
- function mc_remote_db() {
535
- $mcdb = new wpdb('DB_USER','DB_PASSWORD','DB_NAME','DB_ADDRESS');
536
-
537
- return $mcdb;
538
- }
539
- </pre>
540
- <?php _e( 'You will need to allow remote connections from this site to the site hosting your My Calendar events. Replace the above placeholders with the host-site information. The two sites must have the same WP table prefix. While this option is enabled, you may not enter or edit events through this installation.', 'my-calendar' ); ?>
541
- </li>
542
- <?php
543
- }
544
- ?>
545
- <li><?php mc_settings_field( 'mc_api_enabled', __( 'Enable external API.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
546
- <li><?php mc_settings_field( 'remigrate', __( 'Re-generate event occurrences table.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
547
- <li><?php mc_settings_field( 'mc_drop_tables', __( 'Drop MySQL tables on uninstall', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
548
- <li>
549
  <?php
550
  mc_settings_field(
551
  'mc_default_sort',
@@ -576,6 +557,26 @@ function mc_remote_db() {
576
  );
577
  ?>
578
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  <?php
580
  if ( get_site_option( 'mc_multisite' ) == 2 && my_calendar_table() != my_calendar_table( 'global' ) ) {
581
  mc_settings_field(
@@ -620,14 +621,14 @@ function mc_remote_db() {
620
  <fieldset>
621
  <legend class="screen-reader-text"><?php _e( 'Customize Text Fields', 'my-calendar' ); ?></legend>
622
  <ul>
 
 
 
623
  <li><?php mc_settings_field( 'mc_notime_text', __( 'Label for all-day events', 'my-calendar' ), 'All Day' ); ?></li>
624
  <li><?php mc_settings_field( 'mc_previous_events', __( 'Previous events link', 'my-calendar' ), __( 'Previous', 'my-calendar' ), __( 'Use <code>{date}</code> to display date in navigation.', 'my-calendar' ) ); ?></li>
625
  <li><?php mc_settings_field( 'mc_next_events', __( 'Next events link', 'my-calendar' ), __( 'Next', 'my-calendar' ), __( 'Use <code>{date}</code> to display date in navigation.', 'my-calendar' ) ); ?></li>
626
  <li><?php mc_settings_field( 'mc_week_caption', __( 'Week view caption:', 'my-calendar' ), '', __( 'Available tag: <code>{date format=""}</code>', 'my-calendar' ) ); ?></li>
627
  <li><?php mc_settings_field( 'mc_caption', __( 'Extended caption:', 'my-calendar' ), '', __( 'Follows month/year in list views.', 'my-calendar' ) ); ?></li>
628
- <li><?php mc_settings_field( 'mc_title_template', __( 'Event title (Grid)', 'my-calendar' ), $mc_title_template, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
629
- <li><?php mc_settings_field( 'mc_title_template_solo', __( 'Event title (Single)', 'my-calendar' ), $mc_title_template_solo, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
630
- <li><?php mc_settings_field( 'mc_title_template_list', __( 'Event title (List)', 'my-calendar' ), $mc_title_template_list, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
631
  <li><?php mc_settings_field( 'mc_details_label', __( 'Event details link text', 'my-calendar' ), $mc_details_label, __( 'Tags: <code>{title}</code>, <code>{location}</code>, <code>{color}</code>, <code>{icon}</code>, <code>{date}</code>, <code>{time}</code>.', 'my-calendar' ) ); ?></li>
632
  <li><?php mc_settings_field( 'mc_link_label', __( 'Event URL link text', 'my-calendar' ), $mc_link_label, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
633
  <li>
@@ -650,10 +651,10 @@ function mc_remote_db() {
650
  $tomorrow = date( 'j' ) + 1;
651
  $multi_format = ( '' == get_option( 'mc_multidate_format' ) ) ? date_i18n( str_replace( '%d', $tomorrow, 'F j-%d, Y' ) ) : date_i18n( str_replace( '%j', $tomorrow, get_option( 'mc_multidate_format' ) ) );
652
  ?>
653
- <li><?php mc_settings_field( 'mc_month_format', __( 'Month format (calendar headings)', 'my-calendar' ), '', $month_format ); ?></li>
654
  <li><?php mc_settings_field( 'mc_time_format', __( 'Time format', 'my-calendar' ), '', $time_format ); ?></li>
 
655
  <li><?php mc_settings_field( 'mc_week_format', __( 'Date in grid mode, week view', 'my-calendar' ), '', $week_format ); ?></li>
656
- <li><?php mc_settings_field( 'mc_date_format', __( 'Date Format in other views', 'my-calendar' ), '', $date_format ); ?></li>
657
  <li><?php mc_settings_field( 'mc_multidate_format', __( 'Date Format for multi-day events', 'my-calendar' ), 'F j-%d, Y', $multi_format . ' (' . __( 'Use <code>&#37;d</code> to represent the end date.', 'my-calendar' ) . ')' ); ?></li>
658
  </ul>
659
  </fieldset>
@@ -688,6 +689,7 @@ function mc_remote_db() {
688
  ?>
689
  <li><?php mc_settings_field( 'mc_use_permalinks', __( 'Use Pretty Permalinks for Events', 'my-calendar' ), '', $note, array(), 'checkbox-single' ); ?></li>
690
  <li><?php mc_settings_field( 'mc_open_uri', __( 'Open calendar links to event details', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
 
691
  <li><?php mc_settings_field( 'mc_mini_uri', __( 'Target <abbr title="Uniform resource locator">URL</abbr> for mini calendar date links:', 'my-calendar' ), '', '', array( 'size' => '60' ), 'url' ); ?></li>
692
  <?php
693
  $disabled = ( ! get_option( 'mc_uri' ) && ! get_option( 'mc_mini_uri' ) ) ? array( 'disabled' => 'disabled' ) : array();
@@ -751,7 +753,7 @@ function mc_remote_db() {
751
  } else {
752
  $label = $k;
753
  }
754
- $buttons = "<button class='up' type='button'><i class='dashicons dashicons-arrow-up' aria-hidden='true'></i><span class='screen-reader-text'>Up</span></button> <button class='down'><i class='dashicons dashicons-arrow-down' aria-hidden='true'></i><span class='screen-reader-text'>Down</span></button>";
755
  $buttons = "<div class='mc-buttons'>$buttons</div>";
756
  echo "<li class='ui-state-default mc-$k mc-$class'>$buttons <code>$label</code> $v <input type='hidden' name='mc_nav[]' value='$k' /></li>";
757
  $i ++;
263
  $mc_open_day_uri = ( ! empty( $_POST['mc_open_day_uri'] ) ) ? $_POST['mc_open_day_uri'] : '';
264
  update_option( 'mc_use_permalinks', ( ! empty( $_POST['mc_use_permalinks'] ) ) ? 'true' : 'false' );
265
  update_option( 'mc_open_uri', ( ! empty( $_POST['mc_open_uri'] ) && 'on' == $_POST['mc_open_uri'] && '' != get_option( 'mc_uri' ) ) ? 'true' : 'false' );
266
+ update_option( 'mc_no_link', ( ! empty( $_POST['mc_no_link'] ) && 'on' == $_POST['mc_no_link'] ) ? 'true' : 'false' );
267
  update_option( 'mc_mini_uri', $_POST['mc_mini_uri'] );
268
  update_option( 'mc_open_day_uri', $mc_open_day_uri );
269
  update_option( 'mc_display_author', ( ! empty( $_POST['mc_display_author'] ) && 'on' == $_POST['mc_display_author'] ) ? 'true' : 'false' );
526
  <?php
527
  }
528
  ?>
529
+ <li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  <?php
531
  mc_settings_field(
532
  'mc_default_sort',
557
  );
558
  ?>
559
  </li>
560
+ <li><?php mc_settings_field( 'mc_remote', __( 'Get data (events, categories and locations) from a remote database.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
561
+ <?php
562
+ if ( 'true' == get_option( 'mc_remote' ) && ! function_exists( 'mc_remote_db' ) ) {
563
+ ?>
564
+ <li><?php _e( 'Add this code to your theme\'s <code>functions.php</code> file:', 'my-calendar' ); ?>
565
+ <pre>
566
+ function mc_remote_db() {
567
+ $mcdb = new wpdb('DB_USER','DB_PASSWORD','DB_NAME','DB_ADDRESS');
568
+
569
+ return $mcdb;
570
+ }
571
+ </pre>
572
+ <?php _e( 'You will need to allow remote connections from this site to the site hosting your My Calendar events. Replace the above placeholders with the host-site information. The two sites must have the same WP table prefix. While this option is enabled, you may not enter or edit events through this installation.', 'my-calendar' ); ?>
573
+ </li>
574
+ <?php
575
+ }
576
+ ?>
577
+ <li><?php mc_settings_field( 'mc_api_enabled', __( 'Enable external API.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
578
+ <li><?php mc_settings_field( 'remigrate', __( 'Re-generate event occurrences table.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
579
+ <li><?php mc_settings_field( 'mc_drop_tables', __( 'Drop MySQL tables on uninstall', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
580
  <?php
581
  if ( get_site_option( 'mc_multisite' ) == 2 && my_calendar_table() != my_calendar_table( 'global' ) ) {
582
  mc_settings_field(
621
  <fieldset>
622
  <legend class="screen-reader-text"><?php _e( 'Customize Text Fields', 'my-calendar' ); ?></legend>
623
  <ul>
624
+ <li><?php mc_settings_field( 'mc_title_template', __( 'Event title (Grid)', 'my-calendar' ), $mc_title_template, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
625
+ <li><?php mc_settings_field( 'mc_title_template_solo', __( 'Event title (Single)', 'my-calendar' ), $mc_title_template_solo, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
626
+ <li><?php mc_settings_field( 'mc_title_template_list', __( 'Event title (List)', 'my-calendar' ), $mc_title_template_list, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
627
  <li><?php mc_settings_field( 'mc_notime_text', __( 'Label for all-day events', 'my-calendar' ), 'All Day' ); ?></li>
628
  <li><?php mc_settings_field( 'mc_previous_events', __( 'Previous events link', 'my-calendar' ), __( 'Previous', 'my-calendar' ), __( 'Use <code>{date}</code> to display date in navigation.', 'my-calendar' ) ); ?></li>
629
  <li><?php mc_settings_field( 'mc_next_events', __( 'Next events link', 'my-calendar' ), __( 'Next', 'my-calendar' ), __( 'Use <code>{date}</code> to display date in navigation.', 'my-calendar' ) ); ?></li>
630
  <li><?php mc_settings_field( 'mc_week_caption', __( 'Week view caption:', 'my-calendar' ), '', __( 'Available tag: <code>{date format=""}</code>', 'my-calendar' ) ); ?></li>
631
  <li><?php mc_settings_field( 'mc_caption', __( 'Extended caption:', 'my-calendar' ), '', __( 'Follows month/year in list views.', 'my-calendar' ) ); ?></li>
 
 
 
632
  <li><?php mc_settings_field( 'mc_details_label', __( 'Event details link text', 'my-calendar' ), $mc_details_label, __( 'Tags: <code>{title}</code>, <code>{location}</code>, <code>{color}</code>, <code>{icon}</code>, <code>{date}</code>, <code>{time}</code>.', 'my-calendar' ) ); ?></li>
633
  <li><?php mc_settings_field( 'mc_link_label', __( 'Event URL link text', 'my-calendar' ), $mc_link_label, "<a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>' ); ?></li>
634
  <li>
651
  $tomorrow = date( 'j' ) + 1;
652
  $multi_format = ( '' == get_option( 'mc_multidate_format' ) ) ? date_i18n( str_replace( '%d', $tomorrow, 'F j-%d, Y' ) ) : date_i18n( str_replace( '%j', $tomorrow, get_option( 'mc_multidate_format' ) ) );
653
  ?>
654
+ <li><?php mc_settings_field( 'mc_date_format', __( 'Primary Date Format', 'my-calendar' ), '', $date_format ); ?></li>
655
  <li><?php mc_settings_field( 'mc_time_format', __( 'Time format', 'my-calendar' ), '', $time_format ); ?></li>
656
+ <li><?php mc_settings_field( 'mc_month_format', __( 'Month format (calendar headings)', 'my-calendar' ), '', $month_format ); ?></li>
657
  <li><?php mc_settings_field( 'mc_week_format', __( 'Date in grid mode, week view', 'my-calendar' ), '', $week_format ); ?></li>
 
658
  <li><?php mc_settings_field( 'mc_multidate_format', __( 'Date Format for multi-day events', 'my-calendar' ), 'F j-%d, Y', $multi_format . ' (' . __( 'Use <code>&#37;d</code> to represent the end date.', 'my-calendar' ) . ')' ); ?></li>
659
  </ul>
660
  </fieldset>
689
  ?>
690
  <li><?php mc_settings_field( 'mc_use_permalinks', __( 'Use Pretty Permalinks for Events', 'my-calendar' ), '', $note, array(), 'checkbox-single' ); ?></li>
691
  <li><?php mc_settings_field( 'mc_open_uri', __( 'Open calendar links to event details', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
692
+ <li><?php mc_settings_field( 'mc_no_link', __( 'Disable calendar links', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
693
  <li><?php mc_settings_field( 'mc_mini_uri', __( 'Target <abbr title="Uniform resource locator">URL</abbr> for mini calendar date links:', 'my-calendar' ), '', '', array( 'size' => '60' ), 'url' ); ?></li>
694
  <?php
695
  $disabled = ( ! get_option( 'mc_uri' ) && ! get_option( 'mc_mini_uri' ) ) ? array( 'disabled' => 'disabled' ) : array();
753
  } else {
754
  $label = $k;
755
  }
756
+ $buttons = "<button class='up' type='button'><i class='dashicons dashicons-arrow-up' aria-hidden='true'></i><span class='screen-reader-text'>Up</span></button> <button class='down' type='button'><i class='dashicons dashicons-arrow-down' aria-hidden='true'></i><span class='screen-reader-text'>Down</span></button>";
757
  $buttons = "<div class='mc-buttons'>$buttons</div>";
758
  echo "<li class='ui-state-default mc-$k mc-$class'>$buttons <code>$label</code> $v <input type='hidden' name='mc_nav[]' value='$k' /></li>";
759
  $i ++;
my-calendar-templates.php CHANGED
@@ -325,10 +325,10 @@ function mc_create_tags( $event, $context = 'filters' ) {
325
  $event = mc_clean_location( $event, 'event' );
326
  $e = array();
327
  $e['post'] = $event->event_post;
328
- $date_format = ( '' != get_option( 'mc_date_format' ) ) ? get_option( 'mc_date_format' ) : get_option( 'date_format' );
329
  $e = apply_filters( 'mc_insert_author_data', $e, $event );
330
  $e = apply_filters( 'mc_filter_image_data', $e, $event );
331
- $sitelink_html = "<div class='url link'><a href='$event->event_url' class='location-link external'>";
332
 
333
  // Translators: Location name.
334
  $sitelink_html .= sprintf( __( 'Visit web site<span class="screen-reader-text">: %s</span>', 'my-calendar' ), $event->event_label );
@@ -433,17 +433,17 @@ function mc_create_tags( $event, $context = 'filters' ) {
433
  $e_link = mc_get_details_link( $event );
434
  $e['link'] = mc_event_link( $event );
435
  if ( $e['link'] ) {
436
- $e['link_image'] = str_replace( "alt=''", "alt='" . esc_attr( $e['title'] ) . "'", "<a href='" . $e['link'] . "'>" . $e['image'] . '</a>' );
437
- $e['link_title'] = "<a href='" . $event->event_link . "'>" . $e['title'] . '</a>';
438
  } else {
439
  $e['link_image'] = $e['image'];
440
  $e['link_title'] = $e['title'];
441
  }
442
 
443
  $e['details_link'] = $e_link;
444
- $e['details'] = "<a href='$e_link' class='mc-details'>$e_label</a>";
445
  $e['linking'] = ( '' != $e['link'] ) ? $event->event_link : $e_link;
446
- $e['linking_title'] = ( '' != $e['linking'] ) ? "<a href='" . $e['linking'] . "'>" . $e['title'] . '</a>' : $e['title'];
447
 
448
  if ( 'related' != $context && ( is_singular( 'mc-events' ) || isset( $_GET['mc_id'] ) ) ) {
449
  $related_template = apply_filters( 'mc_related_template', '{date}, {time}', $event );
@@ -499,7 +499,7 @@ function mc_create_tags( $event, $context = 'filters' ) {
499
 
500
  $strip_desc = mc_newline_replace( strip_tags( $event->event_desc ) ) . ' ' . $e['link'];
501
  $e['gcal'] = mc_google_cal( $dtstart, $dtend, $e_link, stripcslashes( $event->event_title ), $map_gcal, $strip_desc );
502
- $e['gcal_link'] = "<a href='" . $e['gcal'] . "' class='gcal external' rel='nofollow' aria-describedby='mc_$event->occur_id-title'>" . __( 'Google Calendar', 'my-calendar' ) . '</a>';
503
 
504
  // IDs.
505
  $e['dateid'] = $event->occur_id; // Unique ID for this date of this event.
@@ -508,7 +508,7 @@ function mc_create_tags( $event, $context = 'filters' ) {
508
  $e['event_span'] = $event->event_span;
509
 
510
  // RSS guid.
511
- $e['guid'] = "<guid isPermaLink='true'>$e_link</guid>";
512
 
513
  // ICAL.
514
  $e['ical_description'] = str_replace( "\r", '=0D=0A=', $event->event_desc );
@@ -530,7 +530,7 @@ function mc_create_tags( $event, $context = 'filters' ) {
530
  mc_get_uri( $event )
531
  );
532
  $e['ical'] = $ical_link;
533
- $e['ical_html'] = "<a class='ical' rel='nofollow' href='$ical_link' aria-describedby='mc_$event->occur_id-title'>" . __( 'iCal', 'my-calendar' ) . '</a>';
534
  $e = apply_filters( 'mc_filter_shortcodes', $e, $event );
535
 
536
  return $e;
@@ -967,8 +967,8 @@ function mc_format_date_span( $dates, $display = 'simple', $default = '' ) {
967
  if ( 'simple' == $display ) {
968
  $begin = $dates[0]->occur_begin;
969
  $end = $dates[ $last ]->occur_end;
970
- $begin = date_i18n( apply_filters( 'mc_date_format', get_option( 'mc_date_format' ), 'date_span_begin' ), strtotime( $begin ) );
971
- $end = date_i18n( apply_filters( 'mc_date_format', get_option( 'mc_date_format' ), 'date_span_end' ), strtotime( $end ) );
972
  $return = $begin . ' <span>&ndash;</span> ' . $end;
973
  } else {
974
  $return = '<ul class="multidate">';
@@ -977,9 +977,9 @@ function mc_format_date_span( $dates, $display = 'simple', $default = '' ) {
977
  $end = $date->occur_end;
978
  $day_begin = date( 'Y-m-d', strtotime( $begin ) );
979
  $day_end = date( 'Y-m-d', strtotime( $end ) );
980
- $bformat = '<span class="multidate-date">' . date_i18n( get_option( 'mc_date_format' ), strtotime( $begin ) ) . "</span> <span class='multidate-time'>" . date_i18n( get_option( 'mc_time_format' ), strtotime( $begin ) ) . '</span>';
981
  $endtimeformat = ( '00:00:00' == $date->occur_end ) ? '' : ' ' . get_option( 'mc_time_format' );
982
- $eformat = ( $day_begin != $day_end ) ? get_option( 'mc_date_format' ) . $endtimeformat : $endtimeformat;
983
  $span = ( '' != $eformat ) ? " <span>&ndash;</span> <span class='multidate-end'>" : '';
984
  $endspan = ( '' != $eformat ) ? '</span>' : '';
985
  $return .= "<li>$bformat" . $span . date_i18n( $eformat, strtotime( $end ) ) . "$endspan</li>";
325
  $event = mc_clean_location( $event, 'event' );
326
  $e = array();
327
  $e['post'] = $event->event_post;
328
+ $date_format = mc_date_format();
329
  $e = apply_filters( 'mc_insert_author_data', $e, $event );
330
  $e = apply_filters( 'mc_filter_image_data', $e, $event );
331
+ $sitelink_html = "<div class='url link'><a href='" . esc_url( $event->event_url ) . "' class='location-link external'>";
332
 
333
  // Translators: Location name.
334
  $sitelink_html .= sprintf( __( 'Visit web site<span class="screen-reader-text">: %s</span>', 'my-calendar' ), $event->event_label );
433
  $e_link = mc_get_details_link( $event );
434
  $e['link'] = mc_event_link( $event );
435
  if ( $e['link'] ) {
436
+ $e['link_image'] = str_replace( "alt=''", "alt='" . esc_attr( $e['title'] ) . "'", "<a href='" . esc_url( $e['link'] ) . "'>" . $e['image'] . '</a>' );
437
+ $e['link_title'] = "<a href='" . esc_url( $event->event_link ) . "'>" . $e['title'] . '</a>';
438
  } else {
439
  $e['link_image'] = $e['image'];
440
  $e['link_title'] = $e['title'];
441
  }
442
 
443
  $e['details_link'] = $e_link;
444
+ $e['details'] = "<a href='" . esc_url( $e_link ) . "' class='mc-details'>$e_label</a>";
445
  $e['linking'] = ( '' != $e['link'] ) ? $event->event_link : $e_link;
446
+ $e['linking_title'] = ( '' != $e['linking'] ) ? "<a href='" . esc_url( $e['linking'] ) . "'>" . $e['title'] . '</a>' : $e['title'];
447
 
448
  if ( 'related' != $context && ( is_singular( 'mc-events' ) || isset( $_GET['mc_id'] ) ) ) {
449
  $related_template = apply_filters( 'mc_related_template', '{date}, {time}', $event );
499
 
500
  $strip_desc = mc_newline_replace( strip_tags( $event->event_desc ) ) . ' ' . $e['link'];
501
  $e['gcal'] = mc_google_cal( $dtstart, $dtend, $e_link, stripcslashes( $event->event_title ), $map_gcal, $strip_desc );
502
+ $e['gcal_link'] = "<a href='" . esc_url( $e['gcal'] ) . "' class='gcal external' rel='nofollow' aria-describedby='mc_$event->occur_id-title'>" . __( 'Google Calendar', 'my-calendar' ) . '</a>';
503
 
504
  // IDs.
505
  $e['dateid'] = $event->occur_id; // Unique ID for this date of this event.
508
  $e['event_span'] = $event->event_span;
509
 
510
  // RSS guid.
511
+ $e['guid'] = "<guid isPermaLink='true'>" . esc_url( $e_link ) . "</guid>";
512
 
513
  // ICAL.
514
  $e['ical_description'] = str_replace( "\r", '=0D=0A=', $event->event_desc );
530
  mc_get_uri( $event )
531
  );
532
  $e['ical'] = $ical_link;
533
+ $e['ical_html'] = "<a class='ical' rel='nofollow' href='" . esc_url( $ical_link ) . "' aria-describedby='mc_$event->occur_id-title'>" . __( 'iCal', 'my-calendar' ) . '</a>';
534
  $e = apply_filters( 'mc_filter_shortcodes', $e, $event );
535
 
536
  return $e;
967
  if ( 'simple' == $display ) {
968
  $begin = $dates[0]->occur_begin;
969
  $end = $dates[ $last ]->occur_end;
970
+ $begin = date_i18n( apply_filters( 'mc_date_format', mc_date_format(), 'date_span_begin' ), strtotime( $begin ) );
971
+ $end = date_i18n( apply_filters( 'mc_date_format', mc_date_format(), 'date_span_end' ), strtotime( $end ) );
972
  $return = $begin . ' <span>&ndash;</span> ' . $end;
973
  } else {
974
  $return = '<ul class="multidate">';
977
  $end = $date->occur_end;
978
  $day_begin = date( 'Y-m-d', strtotime( $begin ) );
979
  $day_end = date( 'Y-m-d', strtotime( $end ) );
980
+ $bformat = '<span class="multidate-date">' . date_i18n( mc_date_format(), strtotime( $begin ) ) . "</span> <span class='multidate-time'>" . date_i18n( get_option( 'mc_time_format' ), strtotime( $begin ) ) . '</span>';
981
  $endtimeformat = ( '00:00:00' == $date->occur_end ) ? '' : ' ' . get_option( 'mc_time_format' );
982
+ $eformat = ( $day_begin != $day_end ) ? mc_date_format() . $endtimeformat : $endtimeformat;
983
  $span = ( '' != $eformat ) ? " <span>&ndash;</span> <span class='multidate-end'>" : '';
984
  $endspan = ( '' != $eformat ) ? '</span>' : '';
985
  $return .= "<li>$bformat" . $span . date_i18n( $eformat, strtotime( $end ) ) . "$endspan</li>";
my-calendar.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package MyCalendar
6
  * @author Joe Dolson
7
- * @copyright 2009-2018 Joe Dolson
8
  * @license GPL-2.0+
9
  *
10
  * @wordpress-plugin
@@ -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.1.6
21
  */
22
 
23
  /*
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  }
43
 
44
  global $mc_version, $wpdb;
45
- $mc_version = '3.1.6';
46
 
47
  define( 'MC_DEBUG', false );
48
 
@@ -148,10 +148,23 @@ function mc_custom_canonical() {
148
  if ( isset( $_GET['mc_id'] ) ) {
149
  add_action( 'wp_head', 'mc_canonical' );
150
  remove_action( 'wp_head', 'rel_canonical' );
 
151
  }
152
  }
153
 
154
- add_action( 'init', 'mc_start_session', 1 );
 
 
 
 
 
 
 
 
 
 
 
 
155
  /**
156
  * Makes sure session is started to be able to save search results.
157
  */
4
  *
5
  * @package MyCalendar
6
  * @author Joe Dolson
7
+ * @copyright 2009-2019 Joe Dolson
8
  * @license GPL-2.0+
9
  *
10
  * @wordpress-plugin
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
+ * Version: 3.1.11
21
  */
22
 
23
  /*
42
  }
43
 
44
  global $mc_version, $wpdb;
45
+ $mc_version = '3.1.11';
46
 
47
  define( 'MC_DEBUG', false );
48
 
148
  if ( isset( $_GET['mc_id'] ) ) {
149
  add_action( 'wp_head', 'mc_canonical' );
150
  remove_action( 'wp_head', 'rel_canonical' );
151
+ add_filter( 'wpseo_canonical', 'mc_disable_yoast_canonical' );
152
  }
153
  }
154
 
155
+ /**
156
+ * When Yoast is enabled with canonical URLs, it returns an invalid URL for single events. Disable on single events.
157
+ *
158
+ * @return boolean
159
+ */
160
+ function mc_disable_yoast_canonical() {
161
+ return false;
162
+ }
163
+
164
+ if ( isset( $_REQUEST['mcs'] ) ) {
165
+ // Only call a session if a search has been performed.
166
+ add_action( 'init', 'mc_start_session', 1 );
167
+ }
168
  /**
169
  * Makes sure session is started to be able to save search results.
170
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: calendar, dates, times, event, events, scheduling, schedule, event manager
5
  Requires at least: 4.4
6
  Tested up to: 5.1
7
  Requires PHP: 5.3
8
- Stable tag: 3.1.6
9
  Text domain: my-calendar
10
  License: GPLv2 or later
11
 
@@ -83,6 +83,37 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  = 3.1.6 =
87
 
88
  * Bug fix: If a category name was blank, it would automatically be filtered to by upcoming events lists.
@@ -366,4 +397,4 @@ The search feature in My Calendar is pretty basic; but [buying My Calendar Pro](
366
 
367
  == Upgrade Notice ==
368
 
369
- * 3.1.0 Bug fixes; couple minor new features.
5
  Requires at least: 4.4
6
  Tested up to: 5.1
7
  Requires PHP: 5.3
8
+ Stable tag: 3.1.11
9
  Text domain: my-calendar
10
  License: GPLv2 or later
11
 
83
 
84
  == Changelog ==
85
 
86
+ = 3.1.11 =
87
+
88
+ * New filter on mc_user_permissions operated on wrong variable.
89
+
90
+ = 3.1.10 =
91
+
92
+ * SECURITY FIX: XSS scripting vulnerability. Update immediately.
93
+ * Support for defining individual categories as having no category icon.
94
+
95
+ = 3.1.9 =
96
+
97
+ * Undefined variable notice.
98
+ * Disable Yoast canonical URL output on single events
99
+ * Use same time variable in templates & in main layout.
100
+ * Using default title template and empty time text, don't display unneeded colon.
101
+
102
+ = 3.1.8 =
103
+
104
+ * Bug fix: 'event_begin' is not always a string, so 'mc_event_date' not always registered correctly.
105
+ * Update 'sortable' code to be prepared for My Calendar Pro 1.9.0.
106
+ * Add 'mc_date_format()' function to get appropriate date format
107
+ * Minor settings design changes.
108
+
109
+ = 3.1.7 =
110
+
111
+ * Add meta field '_mc_event_date' for use in My Tickets
112
+ * Add option to disable output link using an explicit option.
113
+ * Change the JS so popups are only attached to links.
114
+ * Better UI with custom & deleted occurrences in recurring events.
115
+ * Bug fix: sessions should only be started if a search has been performed.
116
+
117
  = 3.1.6 =
118
 
119
  * Bug fix: If a category name was blank, it would automatically be filtered to by upcoming events lists.
397
 
398
  == Upgrade Notice ==
399
 
400
+ * 3.1.10 IMPORTANT SECURITY UPDATE: XSS Scripting Vulnerability