My Calendar - Version 3.3.12

Version Description

  • Bug fix: Find title and find event should use nearest event, not first event.
  • Bug fix: Title replacement used event ID improperly if mc_id not passed.
  • Bug fix: Seed GUID with home_url.
  • Bug fix: Don't throw warnings if host/author ID no longer exists.
  • Bug fix: Handle recurring event codes if passed from event importer.
Download this release

Release Info

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

Code changes from version 3.3.11 to 3.3.12

my-calendar-core.php CHANGED
@@ -1880,21 +1880,26 @@ function mc_next_post_link( $output, $format ) {
1880
  function mc_the_title( $title, $post_id = null ) {
1881
  if ( is_singular( 'mc-events' ) && in_the_loop() ) {
1882
  if ( $post_id ) {
1883
- $event_id = ( isset( $_GET['mc_id'] ) && is_numeric( $_GET['mc_id'] ) ) ? $_GET['mc_id'] : get_post_meta( $post_id, '_mc_event_id', true );
 
 
 
 
1884
  if ( is_numeric( $event_id ) ) {
1885
  $event = mc_get_event( $event_id );
1886
  if ( ! is_object( $event ) ) {
1887
- $event = mc_get_first_event( $event_id );
1888
- } else {
1889
- $event_title = stripslashes( $event->event_title );
1890
- if ( $event_title !== $title ) {
1891
- $title = $event_title;
1892
- }
1893
  }
1894
- if ( is_object( $event ) && property_exists( $event, 'category_icon' ) ) {
1895
- $icon = mc_category_icon( $event );
1896
- } else {
1897
- $icon = '';
 
 
 
 
 
 
1898
  }
1899
  $template = mc_get_template( 'title_solo' );
1900
  if ( '' === $template || '{title}' === $template ) {
@@ -1903,6 +1908,9 @@ function mc_the_title( $title, $post_id = null ) {
1903
  $data = mc_create_tags( $event, $event_id );
1904
  $title = mc_draw_template( $data, $template );
1905
  }
 
 
 
1906
  }
1907
  }
1908
  }
1880
  function mc_the_title( $title, $post_id = null ) {
1881
  if ( is_singular( 'mc-events' ) && in_the_loop() ) {
1882
  if ( $post_id ) {
1883
+ $event_id = ( isset( $_GET['mc_id'] ) && is_numeric( $_GET['mc_id'] ) ) ? $_GET['mc_id'] : false;
1884
+ if ( ! $event_id ) {
1885
+ $parent_id = get_post_meta( $post_id, '_mc_event_id', true );
1886
+ $event = mc_get_nearest_event( $event_id );
1887
+ }
1888
  if ( is_numeric( $event_id ) ) {
1889
  $event = mc_get_event( $event_id );
1890
  if ( ! is_object( $event ) ) {
1891
+ $event = mc_get_nearest_event( $event_id );
 
 
 
 
 
1892
  }
1893
+ }
1894
+ if ( is_object( $event ) && property_exists( $event, 'category_icon' ) ) {
1895
+ $icon = mc_category_icon( $event );
1896
+ } else {
1897
+ $icon = '';
1898
+ }
1899
+ if ( is_object( $event ) ) {
1900
+ $event_title = stripslashes( $event->event_title );
1901
+ if ( $event_title !== $title ) {
1902
+ $title = $event_title;
1903
  }
1904
  $template = mc_get_template( 'title_solo' );
1905
  if ( '' === $template || '{title}' === $template ) {
1908
  $data = mc_create_tags( $event, $event_id );
1909
  $title = mc_draw_template( $data, $template );
1910
  }
1911
+ } else {
1912
+ // If both queries fail to get title, return original.
1913
+ return $title;
1914
  }
1915
  }
1916
  }
my-calendar-event-editor.php CHANGED
@@ -1745,11 +1745,14 @@ function mc_check_data( $action, $post, $i, $ignore_required = false ) {
1745
  $desc = ! empty( $post['content'] ) ? trim( $post['content'] ) : '';
1746
  $short = ! empty( $post['event_short'] ) ? trim( $post['event_short'] ) : '';
1747
  $recurs = ( isset( $post['prev_event_recur'] ) ) ? $post['prev_event_recur'] : '';
1748
- $recur = ! empty( $post['event_recur'] ) ? trim( $post['event_recur'] ) : $recur;
1749
  if ( ! isset( $post['event_recur'] ) && isset( $post['event_repeats'] ) ) {
1750
  unset( $post['event_repeats'] );
1751
  }
1752
  $every = ! empty( $post['event_every'] ) ? (int) $post['event_every'] : 1;
 
 
 
1753
  // if this is an all weekdays event, and it's scheduled to start on a weekend, the math gets nasty.
1754
  // ...AND there's no reason to allow it, since weekday events will NEVER happen on the weekend.
1755
  $begin = trim( $post['event_begin'][ $i ] );
1745
  $desc = ! empty( $post['content'] ) ? trim( $post['content'] ) : '';
1746
  $short = ! empty( $post['event_short'] ) ? trim( $post['event_short'] ) : '';
1747
  $recurs = ( isset( $post['prev_event_recur'] ) ) ? $post['prev_event_recur'] : '';
1748
+ $recur = ! empty( $post['event_recur'] ) ? trim( $post['event_recur'] ) : $recurs;
1749
  if ( ! isset( $post['event_recur'] ) && isset( $post['event_repeats'] ) ) {
1750
  unset( $post['event_repeats'] );
1751
  }
1752
  $every = ! empty( $post['event_every'] ) ? (int) $post['event_every'] : 1;
1753
+ if ( strlen( $recur > 1 ) ) {
1754
+ $recur = substr( $recur, 0, 1 );
1755
+ }
1756
  // if this is an all weekdays event, and it's scheduled to start on a weekend, the math gets nasty.
1757
  // ...AND there's no reason to allow it, since weekday events will NEVER happen on the weekend.
1758
  $begin = trim( $post['event_begin'][ $i ] );
my-calendar-events.php CHANGED
@@ -50,7 +50,7 @@ function mc_event_object( $object ) {
50
  * @return string GUID
51
  */
52
  function mc_create_guid( $event ) {
53
- $guid = md5( $event->event_post . $event->event_id . $event->event_title );
54
  update_post_meta( $event->event_post, '_mc_guid', $guid );
55
 
56
  return $guid;
50
  * @return string GUID
51
  */
52
  function mc_create_guid( $event ) {
53
+ $guid = md5( home_url() . $event->event_post . $event->event_id . $event->event_title );
54
  update_post_meta( $event->event_post, '_mc_guid', $guid );
55
 
56
  return $guid;
my-calendar-output.php CHANGED
@@ -285,10 +285,12 @@ function my_calendar_draw_event( $event, $type, $process_date, $time, $template
285
  if ( 0 !== (int) $event->event_author && is_numeric( $event->event_author ) ) {
286
  $avatar = ( $avatars ) ? get_avatar( $event->event_author ) : '';
287
  $a = get_userdata( $event->event_author );
288
- $text = ( '' !== get_option( 'mc_posted_by', '' ) ) ? get_option( 'mc_posted_by' ) : __( 'Posted by', 'my-calendar' );
289
- $author = $avatar . '<p class="event-author"><span class="posted">' . $text . '</span> <span class="author-name">' . $a->display_name . "</span></p>\n";
290
- if ( $avatars ) {
291
- $author = ' <div class="mc-author-card">' . $author . '</div>';
 
 
292
  }
293
  }
294
  }
@@ -296,10 +298,12 @@ function my_calendar_draw_event( $event, $type, $process_date, $time, $template
296
  if ( 0 !== (int) $event->event_host && is_numeric( $event->event_host ) ) {
297
  $havatar = ( $avatars ) ? get_avatar( $event->event_host ) : '';
298
  $h = get_userdata( $event->event_host );
299
- $text = ( '' !== get_option( 'mc_hosted_by', '' ) ) ? get_option( 'mc_hosted_by' ) : __( 'Hosted by', 'my-calendar' );
300
- $host = $havatar . '<p class="event-host"><span class="hosted">' . $text . '</span> <span class="host-name">' . $h->display_name . "</span></p>\n";
301
- if ( $avatars ) {
302
- $host = ' <div class="mc-host-card">' . $host . '</div>';
 
 
303
  }
304
  }
305
  }
285
  if ( 0 !== (int) $event->event_author && is_numeric( $event->event_author ) ) {
286
  $avatar = ( $avatars ) ? get_avatar( $event->event_author ) : '';
287
  $a = get_userdata( $event->event_author );
288
+ if ( $a ) {
289
+ $text = ( '' !== get_option( 'mc_posted_by', '' ) ) ? get_option( 'mc_posted_by' ) : __( 'Posted by', 'my-calendar' );
290
+ $author = $avatar . '<p class="event-author"><span class="posted">' . $text . '</span> <span class="author-name">' . $a->display_name . "</span></p>\n";
291
+ if ( $avatars ) {
292
+ $author = ' <div class="mc-author-card">' . $author . '</div>';
293
+ }
294
  }
295
  }
296
  }
298
  if ( 0 !== (int) $event->event_host && is_numeric( $event->event_host ) ) {
299
  $havatar = ( $avatars ) ? get_avatar( $event->event_host ) : '';
300
  $h = get_userdata( $event->event_host );
301
+ if ( $h ) {
302
+ $text = ( '' !== get_option( 'mc_hosted_by', '' ) ) ? get_option( 'mc_hosted_by' ) : __( 'Hosted by', 'my-calendar' );
303
+ $host = $havatar . '<p class="event-host"><span class="hosted">' . $text . '</span> <span class="host-name">' . $h->display_name . "</span></p>\n";
304
+ if ( $avatars ) {
305
+ $host = ' <div class="mc-host-card">' . $host . '</div>';
306
+ }
307
  }
308
  }
309
  }
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.11
21
  */
22
 
23
  /*
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  }
43
 
44
  global $mc_version, $wpdb;
45
- $mc_version = '3.3.11';
46
 
47
  define( 'MC_DEBUG', false );
48
 
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.12
21
  */
22
 
23
  /*
42
  }
43
 
44
  global $mc_version, $wpdb;
45
+ $mc_version = '3.3.12';
46
 
47
  define( 'MC_DEBUG', false );
48
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Requires at least: 4.4
6
  Tested up to: 5.9
7
  Requires PHP: 7.0
8
  Text domain: my-calendar
9
- Stable tag: 3.3.11
10
  License: GPLv2 or later
11
 
12
  Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
@@ -84,6 +84,14 @@ Translating my plugins is always appreciated. Visit <a href="https://translate.w
84
 
85
  == Changelog ==
86
 
 
 
 
 
 
 
 
 
87
  = 3.3.11 =
88
 
89
  * Bug fix: Modifying a category didn't refresh the icon SVG for that category.
6
  Tested up to: 5.9
7
  Requires PHP: 7.0
8
  Text domain: my-calendar
9
+ Stable tag: 3.3.12
10
  License: GPLv2 or later
11
 
12
  Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
84
 
85
  == Changelog ==
86
 
87
+ = 3.3.12 =
88
+
89
+ * Bug fix: Find title and find event should use nearest event, not first event.
90
+ * Bug fix: Title replacement used event ID improperly if mc_id not passed.
91
+ * Bug fix: Seed GUID with home_url.
92
+ * Bug fix: Don't throw warnings if host/author ID no longer exists.
93
+ * Bug fix: Handle recurring event codes if passed from event importer.
94
+
95
  = 3.3.11 =
96
 
97
  * Bug fix: Modifying a category didn't refresh the icon SVG for that category.