My Calendar - Version 3.1.18

Version Description

  • Add filters to 'Add to Google Calendar' link: mc_gcal_location & mc_gcal_description
  • Add 'nofollow' to links to past events.
  • Include recurrence info in post meta box.
  • Change limit on adding occurrences from 20 to 40.
  • Minor code refactoring.
Download this release

Release Info

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

Code changes from version 3.1.17 to 3.1.18

includes/general-utilities.php CHANGED
@@ -87,6 +87,10 @@ function mc_add_inner_box() {
87
$url = admin_url( 'admin.php?page=my-calendar&mode=edit&event_id=' . $event_id );
88
$event = mc_get_first_event( $event_id );
89
$content = '<p><strong>' . strip_tags( $event->event_title, mc_strip_tags() ) . '</strong><br />' . $event->event_begin . ' @ ' . $event->event_time . '</p>';
90
if ( '' != $event->event_label ) {
91
// Translators: Name of event location.
92
$content .= '<p>' . sprintf( __( '<strong>Location:</strong> %s', 'my-calendar' ), strip_tags( $event->event_label, mc_strip_tags() ) ) . '</p>';
87
$url = admin_url( 'admin.php?page=my-calendar&mode=edit&event_id=' . $event_id );
88
$event = mc_get_first_event( $event_id );
89
$content = '<p><strong>' . strip_tags( $event->event_title, mc_strip_tags() ) . '</strong><br />' . $event->event_begin . ' @ ' . $event->event_time . '</p>';
90
+ if ( $event->event_recur != 'S' ) {
91
+ $recur = mc_event_recur_string( $event, $event->event_begin );
92
+ $content .= wpautop( $recur );
93
+ }
94
if ( '' != $event->event_label ) {
95
// Translators: Name of event location.
96
$content .= '<p>' . sprintf( __( '<strong>Location:</strong> %s', 'my-calendar' ), strip_tags( $event->event_label, mc_strip_tags() ) ) . '</p>';
js/jquery.admin.js CHANGED
@@ -9,8 +9,8 @@ jQuery(document).ready(function ($) {
9
$('#event' + num).after(newElem);
10
// enable the "remove" button.
11
$('#del_field').removeAttr('disabled');
12
- // business rule: you can only add 10 occurrences.
13
- if ( newNum == 20 ) {
14
$('#add_field').attr('disabled', 'disabled');
15
}
16
});
9
$('#event' + num).after(newElem);
10
// enable the "remove" button.
11
$('#del_field').removeAttr('disabled');
12
+ // business rule: you can only add 40 occurrences.
13
+ if ( newNum == 40 ) {
14
$('#add_field').attr('disabled', 'disabled');
15
}
16
});
my-calendar-core.php CHANGED
@@ -1220,8 +1220,8 @@ function mc_ajax_add_date() {
1220
$format = array( '%d', '%s', '%s', '%d' );
1221
$data = array(
1222
'occur_event_id' => $event_id,
1223
- 'occur_begin' => date( 'Y-m-d H:i:s', $begin ),
1224
- 'occur_end' => date( 'Y-m-d H:i:s', $end ),
1225
'occur_group_id' => $group_id,
1226
);
1227
$result = $wpdb->insert( my_calendar_event_table(), $data, $format );
1220
$format = array( '%d', '%s', '%s', '%d' );
1221
$data = array(
1222
'occur_event_id' => $event_id,
1223
+ 'occur_begin' => date( 'Y-m-d H:i:s', $begin ), // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
1224
+ 'occur_end' => date( 'Y-m-d H:i:s', $end ), // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
1225
'occur_group_id' => $group_id,
1226
);
1227
$result = $wpdb->insert( my_calendar_event_table(), $data, $format );
my-calendar-event-manager.php CHANGED
@@ -1303,7 +1303,7 @@ function mc_show_block( $field, $has_data, $data, $echo = true, $default = '' )
1303
default:
1304
return;
1305
}
1306
- $return = apply_filters( 'mc_show_block', $return, $data, $field );
1307
if ( true == $echo ) {
1308
echo $return;
1309
} else {
@@ -2751,58 +2751,61 @@ function mc_check_data( $action, $post, $i ) {
2751
die;
2752
}
2753
2754
if ( '' == $errors ) {
2755
- $current_user = wp_get_current_user();
2756
- $event_author = ( $event_author == $current_user->ID || current_user_can( 'mc_manage_events' ) ) ? $event_author : $current_user->ID;
2757
- $primary = ( ! $primary ) ? 1 : $primary;
2758
- $cats = ( isset( $cats ) && is_array( $cats ) ) ? $cats : array( 1 );
2759
- $ok = true;
2760
- $submit = array(
2761
- // Begin strings.
2762
- 'event_begin' => $begin,
2763
- 'event_end' => $end,
2764
- 'event_title' => $title,
2765
- 'event_desc' => force_balance_tags( $desc ),
2766
- 'event_short' => force_balance_tags( $short ),
2767
- 'event_time' => $time,
2768
- 'event_endtime' => $endtime,
2769
- 'event_link' => $event_link,
2770
- 'event_label' => $event_label,
2771
- 'event_street' => $event_street,
2772
- 'event_street2' => $event_street2,
2773
- 'event_city' => $event_city,
2774
- 'event_state' => $event_state,
2775
- 'event_postcode' => $event_postcode,
2776
- 'event_region' => $event_region,
2777
- 'event_country' => $event_country,
2778
- 'event_url' => $event_url,
2779
- 'event_recur' => $recur,
2780
- 'event_image' => $event_image,
2781
- 'event_phone' => $event_phone,
2782
- 'event_phone2' => $event_phone2,
2783
- 'event_access' => ( is_array( $event_access ) ) ? serialize( $event_access ) : '',
2784
- 'event_tickets' => $event_tickets,
2785
- 'event_registration' => $event_registration,
2786
- // Begin integers.
2787
- 'event_repeats' => $repeats,
2788
- 'event_author' => $event_author,
2789
- 'event_category' => $primary,
2790
- 'event_link_expires' => $expires,
2791
- 'event_zoom' => $event_zoom,
2792
- 'event_approved' => $approved,
2793
- 'event_host' => $host,
2794
- 'event_flagged' => $spam,
2795
- 'event_fifth_week' => $event_fifth_week,
2796
- 'event_holiday' => $event_holiday,
2797
- 'event_group_id' => $event_group_id,
2798
- 'event_span' => $event_span,
2799
- 'event_hide_end' => $event_hide_end,
2800
- // Begin floats.
2801
- 'event_longitude' => $event_longitude,
2802
- 'event_latitude' => $event_latitude,
2803
- // Array: removed before DB insertion.
2804
- 'event_categories' => $cats,
2805
- );
2806
2807
$submit = array_map( 'mc_kses_post', $submit );
2808
} else {
1303
default:
1304
return;
1305
}
1306
+ $return = apply_filters( 'mc_show_block', $return, $data, $field, $has_data );
1307
if ( true == $echo ) {
1308
echo $return;
1309
} else {
2751
die;
2752
}
2753
2754
+ $current_user = wp_get_current_user();
2755
+ $event_author = ( $event_author == $current_user->ID || current_user_can( 'mc_manage_events' ) ) ? $event_author : $current_user->ID;
2756
+ $primary = ( ! $primary ) ? 1 : $primary;
2757
+ $cats = ( isset( $cats ) && is_array( $cats ) ) ? $cats : array( 1 );
2758
+
2759
+ $submit = array(
2760
+ // Begin strings.
2761
+ 'event_begin' => $begin,
2762
+ 'event_end' => $end,
2763
+ 'event_title' => $title,
2764
+ 'event_desc' => force_balance_tags( $desc ),
2765
+ 'event_short' => force_balance_tags( $short ),
2766
+ 'event_time' => $time,
2767
+ 'event_endtime' => $endtime,
2768
+ 'event_link' => $event_link,
2769
+ 'event_label' => $event_label,
2770
+ 'event_street' => $event_street,
2771
+ 'event_street2' => $event_street2,
2772
+ 'event_city' => $event_city,
2773
+ 'event_state' => $event_state,
2774
+ 'event_postcode' => $event_postcode,
2775
+ 'event_region' => $event_region,
2776
+ 'event_country' => $event_country,
2777
+ 'event_url' => $event_url,
2778
+ 'event_recur' => $recur,
2779
+ 'event_image' => $event_image,
2780
+ 'event_phone' => $event_phone,
2781
+ 'event_phone2' => $event_phone2,
2782
+ 'event_access' => ( is_array( $event_access ) ) ? serialize( $event_access ) : '',
2783
+ 'event_tickets' => $event_tickets,
2784
+ 'event_registration' => $event_registration,
2785
+ // Begin integers.
2786
+ 'event_repeats' => $repeats,
2787
+ 'event_author' => $event_author,
2788
+ 'event_category' => $primary,
2789
+ 'event_link_expires' => $expires,
2790
+ 'event_zoom' => $event_zoom,
2791
+ 'event_approved' => $approved,
2792
+ 'event_host' => $host,
2793
+ 'event_flagged' => $spam,
2794
+ 'event_fifth_week' => $event_fifth_week,
2795
+ 'event_holiday' => $event_holiday,
2796
+ 'event_group_id' => $event_group_id,
2797
+ 'event_span' => $event_span,
2798
+ 'event_hide_end' => $event_hide_end,
2799
+ // Begin floats.
2800
+ 'event_longitude' => $event_longitude,
2801
+ 'event_latitude' => $event_latitude,
2802
+ // Array: removed before DB insertion.
2803
+ 'event_categories' => $cats,
2804
+ );
2805
+ $errors = apply_filters( 'mc_fields_required', '', $submit );
2806
+
2807
if ( '' == $errors ) {
2808
+ $ok = true;
2809
2810
$submit = array_map( 'mc_kses_post', $submit );
2811
} else {
my-calendar-install.php CHANGED
@@ -394,7 +394,7 @@ function mc_migrate_db() {
394
foreach ( $events as $event ) {
395
// assign endtimes to all events.
396
if ( '00:00:00' === $event->event_endtime && '00:00:00' !== $event->event_time ) {
397
- $event->event_endtime = date( 'H:i:s', strtotime( "$event->event_time +1 hour" ) );
398
mc_flag_event( $event->event_id, $event->event_endtime );
399
}
400
// Set up category relationships if missing.
394
foreach ( $events as $event ) {
395
// assign endtimes to all events.
396
if ( '00:00:00' === $event->event_endtime && '00:00:00' !== $event->event_time ) {
397
+ $event->event_endtime = date( 'H:i:s', strtotime( "$event->event_time +1 hour" ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
398
mc_flag_event( $event->event_id, $event->event_endtime );
399
}
400
// Set up category relationships if missing.
my-calendar-output.php CHANGED
@@ -295,6 +295,7 @@ function my_calendar_draw_event( $event, $type = 'calendar', $process_date, $tim
295
$img = '';
296
$has_image = ( '' !== $image ) ? ' has-image' : '';
297
$event_classes = mc_event_classes( $event, $day_id, $type );
298
$header .= "<div id='$uid-$type-$id' class='$event_classes'>\n";
299
300
switch ( $type ) {
@@ -322,7 +323,7 @@ function my_calendar_draw_event( $event, $type = 'calendar', $process_date, $tim
322
if ( ( ( strpos( $event_title, 'href' ) === false ) && 'mini' !== $type && 'list' !== $type ) && ! $no_link ) {
323
if ( 'true' === $open_uri ) {
324
$details_link = esc_url( mc_get_details_link( $event ) );
325
- $wrap = ( _mc_is_url( $details_link ) ) ? "<a href='$details_link' class='url summary$has_image'>" : '<span class="no-link">';
326
$balance = ( _mc_is_url( $details_link ) ) ? '</a>' : '</span>';
327
} else {
328
$wrap = "<a href='#$uid-$type-details' class='et_smooth_scroll_disabled url summary$has_image'>";
295
$img = '';
296
$has_image = ( '' !== $image ) ? ' has-image' : '';
297
$event_classes = mc_event_classes( $event, $day_id, $type );
298
+ $nofollow = ( stripos( $event_classes, 'past-event' ) !== false ) ? 'rel="nofollow"' : '';
299
$header .= "<div id='$uid-$type-$id' class='$event_classes'>\n";
300
301
switch ( $type ) {
323
if ( ( ( strpos( $event_title, 'href' ) === false ) && 'mini' !== $type && 'list' !== $type ) && ! $no_link ) {
324
if ( 'true' === $open_uri ) {
325
$details_link = esc_url( mc_get_details_link( $event ) );
326
+ $wrap = ( _mc_is_url( $details_link ) ) ? "<a href='$details_link' class='url summary$has_image' $nofollow>" : '<span class="no-link">';
327
$balance = ( _mc_is_url( $details_link ) ) ? '</a>' : '</span>';
328
} else {
329
$wrap = "<a href='#$uid-$type-details' class='et_smooth_scroll_disabled url summary$has_image'>";
my-calendar-settings.php CHANGED
@@ -124,7 +124,7 @@ function my_calendar_import() {
124
$event_ids = array();
125
$events_results = false;
126
foreach ( $events as $key ) {
127
- $endtime = ( '00:00:00' === $key['event_time'] ) ? '00:00:00' : date( 'H:i:s', strtotime( "$key[event_time] +1 hour" ) );
128
$data = array(
129
'event_title' => $key['event_title'],
130
'event_desc' => $key['event_desc'],
@@ -648,7 +648,7 @@ function mc_remote_db() {
648
$time_format = ( '' === get_option( 'mc_time_format', '' ) ) ? date_i18n( get_option( 'time_format' ) ) : date_i18n( get_option( 'mc_time_format' ) );
649
$week_format = ( '' === get_option( 'mc_week_format', '' ) ) ? date_i18n( 'M j, \'y' ) : date_i18n( get_option( 'mc_week_format' ) );
650
$date_format = ( '' === get_option( 'mc_date_format', '' ) ) ? date_i18n( get_option( 'date_format' ) ) : date_i18n( get_option( 'mc_date_format' ) );
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>
124
$event_ids = array();
125
$events_results = false;
126
foreach ( $events as $key ) {
127
+ $endtime = ( '00:00:00' === $key['event_time'] ) ? '00:00:00' : date( 'H:i:s', strtotime( "$key[event_time] +1 hour" ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
128
$data = array(
129
'event_title' => $key['event_title'],
130
'event_desc' => $key['event_desc'],
648
$time_format = ( '' === get_option( 'mc_time_format', '' ) ) ? date_i18n( get_option( 'time_format' ) ) : date_i18n( get_option( 'mc_time_format' ) );
649
$week_format = ( '' === get_option( 'mc_week_format', '' ) ) ? date_i18n( 'M j, \'y' ) : date_i18n( get_option( 'mc_week_format' ) );
650
$date_format = ( '' === get_option( 'mc_date_format', '' ) ) ? date_i18n( get_option( 'date_format' ) ) : date_i18n( get_option( 'mc_date_format' ) );
651
+ $tomorrow = date( 'j' ) + 1; // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
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>
my-calendar-templates.php CHANGED
@@ -245,9 +245,9 @@ function mc_google_cal( $dtstart, $dtend, $url, $title, $location, $description
245
$base = "&dates=$dtstart/$dtend";
246
$base .= '&sprop=website:' . $url;
247
$base .= '&text=' . urlencode( $title );
248
- $base .= '&location=' . urlencode( trim( $location ) );
249
$base .= '&sprop=name:' . urlencode( get_bloginfo( 'name' ) );
250
- $base .= '&details=' . urlencode( stripcslashes( trim( $description ) ) );
251
$base .= '&sf=true&output=xml';
252
253
return $source . $base;
@@ -432,21 +432,24 @@ function mc_create_tags( $event, $context = 'filters' ) {
432
$e['time'],
433
);
434
435
$e_label = str_replace( $tags, $replacements, $e_template );
436
$e_link = mc_get_details_link( $event );
437
$e['link'] = mc_event_link( $event );
438
if ( $e['link'] ) {
439
- $e['link_image'] = str_replace( "alt=''", "alt='" . esc_attr( $e['title'] ) . "'", "<a href='" . esc_url( $e['link'] ) . "'>" . $e['image'] . '</a>' );
440
- $e['link_title'] = "<a href='" . esc_url( $event->event_link ) . "'>" . $e['title'] . '</a>';
441
} else {
442
$e['link_image'] = $e['image'];
443
$e['link_title'] = $e['title'];
444
}
445
446
$e['details_link'] = $e_link;
447
- $e['details'] = "<a href='" . esc_url( $e_link ) . "' class='mc-details'>$e_label</a>";
448
$e['linking'] = ( '' != $e['link'] ) ? $event->event_link : $e_link;
449
- $e['linking_title'] = ( '' != $e['linking'] ) ? "<a href='" . esc_url( $e['linking'] ) . "'>" . $e['title'] . '</a>' : $e['title'];
450
451
if ( 'related' != $context && ( is_singular( 'mc-events' ) || isset( $_GET['mc_id'] ) ) ) {
452
$related_template = apply_filters( 'mc_related_template', '{date}, {time}', $event );
245
$base = "&dates=$dtstart/$dtend";
246
$base .= '&sprop=website:' . $url;
247
$base .= '&text=' . urlencode( $title );
248
+ $base .= apply_filters( 'mc_gcal_location', '&location=' . urlencode( trim( $location ) ), $location );
249
$base .= '&sprop=name:' . urlencode( get_bloginfo( 'name' ) );
250
+ $base .= apply_filters( 'mc_gcal_description', '&details=' . urlencode( stripcslashes( trim( $description ) ) ), $description );
251
$base .= '&sf=true&output=xml';
252
253
return $source . $base;
432
$e['time'],
433
);
434
435
+ $classes = mc_event_classes( $event, $event->occur_id, 'template' );
436
+ $nofollow = ( stripos( $classes, 'past-event' ) !== false ) ? 'rel="nofollow"' : '';
437
+
438
$e_label = str_replace( $tags, $replacements, $e_template );
439
$e_link = mc_get_details_link( $event );
440
$e['link'] = mc_event_link( $event );
441
if ( $e['link'] ) {
442
+ $e['link_image'] = str_replace( "alt=''", "alt='" . esc_attr( $e['title'] ) . "'", "<a href='" . esc_url( $e['link'] ) . "' $nofollow>" . $e['image'] . '</a>' );
443
+ $e['link_title'] = "<a href='" . esc_url( $event->event_link ) . "' $nofollow>" . $e['title'] . '</a>';
444
} else {
445
$e['link_image'] = $e['image'];
446
$e['link_title'] = $e['title'];
447
}
448
449
$e['details_link'] = $e_link;
450
+ $e['details'] = "<a href='" . esc_url( $e_link ) . "' class='mc-details' $nofollow>$e_label</a>";
451
$e['linking'] = ( '' != $e['link'] ) ? $event->event_link : $e_link;
452
+ $e['linking_title'] = ( '' != $e['linking'] ) ? "<a href='" . esc_url( $e['linking'] ) . "' $nofollow>" . $e['title'] . '</a>' : $e['title'];
453
454
if ( 'related' != $context && ( is_singular( 'mc-events' ) || isset( $_GET['mc_id'] ) ) ) {
455
$related_template = apply_filters( 'mc_related_template', '{date}, {time}', $event );
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.1.17
21
*/
22
23
/*
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
}
43
44
global $mc_version, $wpdb;
45
- $mc_version = '3.1.17';
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.1.18
21
*/
22
23
/*
42
}
43
44
global $mc_version, $wpdb;
45
+ $mc_version = '3.1.18';
46
47
define( 'MC_DEBUG', false );
48
readme.txt CHANGED
@@ -3,9 +3,9 @@ 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.2
7
Requires PHP: 5.3
8
- Stable tag: 3.1.17
9
Text domain: my-calendar
10
License: GPLv2 or later
11
@@ -83,6 +83,14 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
83
84
== Changelog ==
85
86
= 3.1.17 =
87
88
* Bug fix: comma misplaced in mc_list_title_title.
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.3
7
Requires PHP: 5.3
8
+ Stable tag: 3.1.18
9
Text domain: my-calendar
10
License: GPLv2 or later
11
83
84
== Changelog ==
85
86
+ = 3.1.18 =
87
+
88
+ * Add filters to 'Add to Google Calendar' link: mc_gcal_location & mc_gcal_description
89
+ * Add 'nofollow' to links to past events.
90
+ * Include recurrence info in post meta box.
91
+ * Change limit on adding occurrences from 20 to 40.
92
+ * Minor code refactoring.
93
+
94
= 3.1.17 =
95
96
* Bug fix: comma misplaced in mc_list_title_title.