My Calendar - Version 3.2.17

Version Description

  • Bug fix: Add parameter for required fields handling to ignore during imports.
  • Add filter handling calendar URLs when using Polylang or WPML.
Download this release

Release Info

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

Code changes from version 3.2.15 to 3.2.17

js/mc-ajax.js CHANGED
@@ -26,16 +26,16 @@
26
  }
27
  // functions to execute when new view loads.
28
  // List view.
29
- if ( typeof( mclist.list ) !== "undefined" && mclist.list == 'true' ) {
30
  $('li.mc-events').children().not('.event-date').hide();
31
  $('li.current-day').children().show();
32
  }
33
  // Grid view.
34
- if ( typeof( mcgrid.grid ) !== "undefined" && mcgrid.grid == 'true' ) {
35
  $('.calendar-event').children().not('.event-title').hide();
36
  }
37
  // Mini view.
38
- if ( typeof( mcmini.mini ) !== "undefined" && mcmini.mini == 'true' ) {
39
  $('.mini .has-events').children().not('.trigger, .mc-date, .event-date').hide();
40
  }
41
  // All views.
26
  }
27
  // functions to execute when new view loads.
28
  // List view.
29
+ if ( typeof( mclist ) !== "undefined" && mclist.list == 'true' ) {
30
  $('li.mc-events').children().not('.event-date').hide();
31
  $('li.current-day').children().show();
32
  }
33
  // Grid view.
34
+ if ( typeof( mcgrid ) !== "undefined" && mcgrid.grid == 'true' ) {
35
  $('.calendar-event').children().not('.event-title').hide();
36
  }
37
  // Mini view.
38
+ if ( typeof( mcmini ) !== "undefined" && mcmini.mini == 'true' ) {
39
  $('.mini .has-events').children().not('.trigger, .mc-date, .event-date').hide();
40
  }
41
  // All views.
my-calendar-core.php CHANGED
@@ -1129,7 +1129,7 @@ function mc_scripts() {
1129
  );
1130
  }
1131
  $count = mc_count_locations();
1132
- if ( $count > apply_filters( 'mc_convert_locations_select_to_autocomplete', 25 ) ) {
1133
  wp_enqueue_script( 'accessible-autocomplete', plugins_url( '/js/accessible-autocomplete.min.js', __FILE__ ) );
1134
  wp_enqueue_script( 'mc-autocomplete', plugins_url( '/js/locations-autocomplete.js', __FILE__ ), array( 'jquery', 'accessible-autocomplete' ), '1.0.0', true );
1135
  wp_localize_script(
1129
  );
1130
  }
1131
  $count = mc_count_locations();
1132
+ if ( $count > apply_filters( 'mc_convert_locations_select_to_autocomplete', 50 ) ) {
1133
  wp_enqueue_script( 'accessible-autocomplete', plugins_url( '/js/accessible-autocomplete.min.js', __FILE__ ) );
1134
  wp_enqueue_script( 'mc-autocomplete', plugins_url( '/js/locations-autocomplete.js', __FILE__ ), array( 'jquery', 'accessible-autocomplete' ), '1.0.0', true );
1135
  wp_localize_script(
my-calendar-event-manager.php CHANGED
@@ -1845,7 +1845,7 @@ function mc_event_location_dropdown_block( $data ) {
1845
  $output = '<div class="mc-event-location-dropdown">';
1846
  $autocomplete = false;
1847
  $count = mc_count_locations();
1848
- if ( $count > apply_filters( 'mc_convert_locations_select_to_autocomplete', 25 ) ) {
1849
  $autocomplete = true;
1850
  }
1851
  if ( 0 !== $count ) {
@@ -2642,10 +2642,11 @@ function mc_list_events() {
2642
  * @param string $action Type of action being performed.
2643
  * @param array $post Post data.
2644
  * @param int $i If multiple events submitted, which index this is.
 
2645
  *
2646
  * @return array Modified data and information about approval.
2647
  */
2648
- function mc_check_data( $action, $post, $i ) {
2649
  global $wpdb, $submission;
2650
  $user = wp_get_current_user();
2651
  $post = apply_filters( 'mc_pre_checkdata', $post, $action, $i );
@@ -2985,7 +2986,7 @@ function mc_check_data( $action, $post, $i ) {
2985
  // Array: removed before DB insertion.
2986
  'event_categories' => $cats,
2987
  );
2988
- $errors = apply_filters( 'mc_fields_required', $errors, $submit );
2989
 
2990
  if ( '' === $errors ) {
2991
  $ok = true;
1845
  $output = '<div class="mc-event-location-dropdown">';
1846
  $autocomplete = false;
1847
  $count = mc_count_locations();
1848
+ if ( $count > apply_filters( 'mc_convert_locations_select_to_autocomplete', 50 ) ) {
1849
  $autocomplete = true;
1850
  }
1851
  if ( 0 !== $count ) {
2642
  * @param string $action Type of action being performed.
2643
  * @param array $post Post data.
2644
  * @param int $i If multiple events submitted, which index this is.
2645
+ * @param bool $ignore_required Pass 'true' to ignore required fields.
2646
  *
2647
  * @return array Modified data and information about approval.
2648
  */
2649
+ function mc_check_data( $action, $post, $i, $ignore_required = false ) {
2650
  global $wpdb, $submission;
2651
  $user = wp_get_current_user();
2652
  $post = apply_filters( 'mc_pre_checkdata', $post, $action, $i );
2986
  // Array: removed before DB insertion.
2987
  'event_categories' => $cats,
2988
  );
2989
+ $errors = ( $ignore_required ) ? $errors : apply_filters( 'mc_fields_required', $errors, $submit );
2990
 
2991
  if ( '' === $errors ) {
2992
  $ok = true;
my-calendar-install.php CHANGED
@@ -615,6 +615,10 @@ function my_calendar_copyr( $source, $dest ) {
615
  */
616
  function my_calendar_rmdirr( $dirname ) {
617
  // Sanity check.
 
 
 
 
618
  if ( ! file_exists( $dirname ) ) {
619
  return false;
620
  }
@@ -624,15 +628,16 @@ function my_calendar_rmdirr( $dirname ) {
624
  }
625
  // List files for deletion.
626
  $files = list_files( $dirname, 2 );
 
627
  foreach ( $files as $file ) {
628
  if ( is_dir( $file ) ) {
629
- rmdir( $file );
630
  } elseif ( is_file( $file ) ) {
631
  unlink( $file );
632
  }
633
  }
634
 
635
- return rmdir( $dirname );
636
  }
637
 
638
  /**
615
  */
616
  function my_calendar_rmdirr( $dirname ) {
617
  // Sanity check.
618
+ if ( empty( $dirname ) ) {
619
+ return false;
620
+ }
621
+ // Another sanity check.
622
  if ( ! file_exists( $dirname ) ) {
623
  return false;
624
  }
628
  }
629
  // List files for deletion.
630
  $files = list_files( $dirname, 2 );
631
+ // Make sure we wait to remove directories until after everything is removed.
632
  foreach ( $files as $file ) {
633
  if ( is_dir( $file ) ) {
634
+ my_calendar_rmdirr( $file );
635
  } elseif ( is_file( $file ) ) {
636
  unlink( $file );
637
  }
638
  }
639
 
640
+ return @rmdir( $dirname );
641
  }
642
 
643
  /**
my-calendar-output.php CHANGED
@@ -3055,10 +3055,38 @@ function mc_build_url( $add, $subtract, $root = '' ) {
3055
 
3056
  unset( $variables['page_id'] );
3057
  $home = add_query_arg( $variables, $home );
 
3058
 
3059
  return esc_url( $home );
3060
  }
3061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3062
  /**
3063
  * Default My Calendar search form.
3064
  *
3055
 
3056
  unset( $variables['page_id'] );
3057
  $home = add_query_arg( $variables, $home );
3058
+ $home = apply_filters( 'mc_build_url', $home, $add, $subtract, $root );
3059
 
3060
  return esc_url( $home );
3061
  }
3062
 
3063
+ /**
3064
+ * Re-parse URL for translation plug-ins.
3065
+ *
3066
+ * @param string $url Original URL.
3067
+ *
3068
+ * @return string
3069
+ */
3070
+ function mc_translate_url( $url ) {
3071
+ $is_default = true;
3072
+ // Polylang support.
3073
+ if ( function_exists( 'pll_home_url' ) ) {
3074
+ $home_url = pll_home_url();
3075
+ $is_default = ( pll_current_language() === pll_default_language() ) ? true : false;
3076
+ }
3077
+ // WPML support.
3078
+ if ( function_exists( 'wpml_current_language' ) ) {
3079
+ $home_url = apply_filters( 'wpml_home_url', home_url() );
3080
+ $is_default = ( apply_filters( 'wpml_current_language', null ) === apply_filters( 'wpml_default_language', null ) ) ? true : false;
3081
+ }
3082
+ if ( ! $is_default ) {
3083
+ $url = str_replace( home_url(), $home_url, $url );
3084
+ }
3085
+
3086
+ return $url;
3087
+ }
3088
+ add_filter( 'mc_build_url', 'mc_translate_url' );
3089
+
3090
  /**
3091
  * Default My Calendar search form.
3092
  *
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.2.15
21
  */
22
 
23
  /*
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  }
43
 
44
  global $mc_version, $wpdb;
45
- $mc_version = '3.2.15';
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.2.17
21
  */
22
 
23
  /*
42
  }
43
 
44
  global $mc_version, $wpdb;
45
+ $mc_version = '3.2.17';
46
 
47
  define( 'MC_DEBUG', false );
48
 
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: 5.6
7
  Requires PHP: 5.6
8
  Text domain: my-calendar
9
- Stable tag: 3.2.15
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,17 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
84
 
85
  == Changelog ==
86
 
 
 
 
 
 
 
 
 
 
 
 
87
  = 3.2.15 =
88
 
89
  * Bug fix: Hide event details section if no fields are visible for section.
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: 5.7
7
  Requires PHP: 5.6
8
  Text domain: my-calendar
9
+ Stable tag: 3.2.17
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.2.17 =
88
+
89
+ * Bug fix: Add parameter for required fields handling to ignore during imports.
90
+ * Add filter handling calendar URLs when using Polylang or WPML.
91
+
92
+ = 3.2.16 =
93
+
94
+ * Bug fix: Check for undefined objects in localization, not for undefined object props.
95
+ * Change: Set parameter for location autocomplete switchover to 50 instead of 25 locations.
96
+ * Change: Tweak directory removal process slightly.
97
+
98
  = 3.2.15 =
99
 
100
  * Bug fix: Hide event details section if no fields are visible for section.