My Calendar - Version 3.0.18

Version Description

  • Bug fix: Invalid setting in bottom nav defaults.
  • Bug fix: Generate feeds by date added rather than fixed number. If empty, get most recent regardless.
  • Bug fix: Legitimate HTML escaped in visual editor in group event editor.
Download this release

Release Info

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

Code changes from version 3.0.17 to 3.0.18

includes/kses.php CHANGED
@@ -64,49 +64,67 @@ function mc_allowed_tags( $tags, $context ) {
64
  'class' => true,
65
  );
66
 
67
- $tags['span'] = array_merge( $tags['span'], array(
68
- 'itemprop' => true,
69
- 'itemscope' => true,
70
- 'itemtype' => true,
71
- ) );
 
 
 
72
 
73
- $tags['button'] = array_merge( $tags['button'], array(
74
- 'name' => true,
75
- 'type' => true,
76
- 'disabled' => true,
77
- 'class' => true,
78
- ) );
 
 
 
79
 
80
- $tags['form'] = array_merge( $tags['form'], array(
81
- 'action' => true,
82
- 'method' => true,
83
- 'class' => true,
84
- 'id' => true,
85
- 'tabindex' => true,
86
- ) );
 
 
 
87
 
88
- $tags['div'] = array_merge( $tags['div'], array(
89
- 'class' => true,
90
- 'id' => true,
91
- 'aria-live' => true,
92
- ) );
 
 
 
93
 
94
  $tags['fieldset'] = array_merge( $tags['fieldset'], array() );
95
  $tags['legend'] = array_merge( $tags['legend'], array() );
96
- $tags['p'] = array_merge( $tags['p'], array(
97
- 'class' => true,
98
- ) );
 
 
 
99
 
100
- $tags['img'] = array_merge( $tags['img'], array(
101
- 'class' => true,
102
- 'src' => true,
103
- 'alt' => true,
104
- 'width' => true,
105
- 'height' => true,
106
- 'id' => true,
107
- 'longdesc' => true,
108
- 'tabindex' => true,
109
- ) );
 
 
 
110
 
111
  $tags['iframe'] = array(
112
  'width' => true,
64
  'class' => true,
65
  );
66
 
67
+ $tags['span'] = array_merge(
68
+ $tags['span'],
69
+ array(
70
+ 'itemprop' => true,
71
+ 'itemscope' => true,
72
+ 'itemtype' => true,
73
+ )
74
+ );
75
 
76
+ $tags['button'] = array_merge(
77
+ $tags['button'],
78
+ array(
79
+ 'name' => true,
80
+ 'type' => true,
81
+ 'disabled' => true,
82
+ 'class' => true,
83
+ )
84
+ );
85
 
86
+ $tags['form'] = array_merge(
87
+ $tags['form'],
88
+ array(
89
+ 'action' => true,
90
+ 'method' => true,
91
+ 'class' => true,
92
+ 'id' => true,
93
+ 'tabindex' => true,
94
+ )
95
+ );
96
 
97
+ $tags['div'] = array_merge(
98
+ $tags['div'],
99
+ array(
100
+ 'class' => true,
101
+ 'id' => true,
102
+ 'aria-live' => true,
103
+ )
104
+ );
105
 
106
  $tags['fieldset'] = array_merge( $tags['fieldset'], array() );
107
  $tags['legend'] = array_merge( $tags['legend'], array() );
108
+ $tags['p'] = array_merge(
109
+ $tags['p'],
110
+ array(
111
+ 'class' => true,
112
+ )
113
+ );
114
 
115
+ $tags['img'] = array_merge(
116
+ $tags['img'],
117
+ array(
118
+ 'class' => true,
119
+ 'src' => true,
120
+ 'alt' => true,
121
+ 'width' => true,
122
+ 'height' => true,
123
+ 'id' => true,
124
+ 'longdesc' => true,
125
+ 'tabindex' => true,
126
+ )
127
+ );
128
 
129
  $tags['iframe'] = array(
130
  'width' => true,
my-calendar-categories.php CHANGED
@@ -506,11 +506,19 @@ function mc_category_settings() {
506
  <fieldset>
507
  <legend>' . __( 'Category Colors', 'my-calendar' ) . '</legend>
508
  <ul>' .
509
- mc_settings_field( 'mc_apply_color', array(
510
- 'default' => __( 'Ignore colors', 'my-calendar' ),
511
- 'font' => __( 'Titles are in colors.', 'my-calendar' ),
512
- 'background' => __( 'Titles use colors as background.', 'my-calendar' ),
513
- ), 'default', '', array(), 'radio', false ) . '
 
 
 
 
 
 
 
 
514
  </ul>
515
  </fieldset>
516
  <ul>
@@ -774,11 +782,13 @@ function mc_category_select( $data = false, $option = true, $multiple = false, $
774
  $cats = $mcdb->get_results( 'SELECT * FROM ' . my_calendar_categories_table() . ' ORDER BY category_name ASC' );
775
  if ( empty( $cats ) ) {
776
  // need to have categories. Try to create again.
777
- mc_create_category( array(
778
- 'category_name' => 'General',
779
- 'category_color' => '#ffffcc',
780
- 'category_icon' => 'event.png',
781
- ) );
 
 
782
 
783
  $cats = $mcdb->get_results( $sql );
784
  }
506
  <fieldset>
507
  <legend>' . __( 'Category Colors', 'my-calendar' ) . '</legend>
508
  <ul>' .
509
+ mc_settings_field(
510
+ 'mc_apply_color',
511
+ array(
512
+ 'default' => __( 'Ignore colors', 'my-calendar' ),
513
+ 'font' => __( 'Titles are in colors.', 'my-calendar' ),
514
+ 'background' => __( 'Titles use colors as background.', 'my-calendar' ),
515
+ ),
516
+ 'default',
517
+ '',
518
+ array(),
519
+ 'radio',
520
+ false
521
+ ) . '
522
  </ul>
523
  </fieldset>
524
  <ul>
782
  $cats = $mcdb->get_results( 'SELECT * FROM ' . my_calendar_categories_table() . ' ORDER BY category_name ASC' );
783
  if ( empty( $cats ) ) {
784
  // need to have categories. Try to create again.
785
+ mc_create_category(
786
+ array(
787
+ 'category_name' => 'General',
788
+ 'category_color' => '#ffffcc',
789
+ 'category_icon' => 'event.png',
790
+ )
791
+ );
792
 
793
  $cats = $mcdb->get_results( $sql );
794
  }
my-calendar-core.php CHANGED
@@ -707,14 +707,17 @@ function mc_do_upgrades( $upgrade_path ) {
707
  delete_option( 'mc_user_location_type' );
708
  delete_option( 'mc_event_approve_perms' );
709
  delete_option( 'mc_location_type' );
710
- add_option( 'mc_style_vars', array(
711
- '--primary-dark' => '#313233',
712
- '--primary-light' => '#fff',
713
- '--secondary-light' => '#fff',
714
- '--secondary-dark' => '#000',
715
- '--highlight-dark' => '#666',
716
- '--highlight-light' => '#efefef',
717
- ) );
 
 
 
718
  mc_upgrade_db();
719
  mc_transition_categories();
720
  break;
@@ -988,39 +991,51 @@ function mc_scripts() {
988
  wp_enqueue_script( 'pickadate', plugins_url( 'js/pickadate/picker.js', __FILE__ ), array( 'jquery' ) );
989
  wp_enqueue_script( 'pickadate.date', plugins_url( 'js/pickadate/picker.date.js', __FILE__ ), array( 'pickadate' ) );
990
  wp_enqueue_script( 'pickadate.time', plugins_url( 'js/pickadate/picker.time.js', __FILE__ ), array( 'pickadate' ) );
991
- wp_localize_script( 'pickadate.date', 'mc_months', array(
992
- date_i18n( 'F', strtotime( 'January 1' ) ),
993
- date_i18n( 'F', strtotime( 'February 1' ) ),
994
- date_i18n( 'F', strtotime( 'March 1' ) ),
995
- date_i18n( 'F', strtotime( 'April 1' ) ),
996
- date_i18n( 'F', strtotime( 'May 1' ) ),
997
- date_i18n( 'F', strtotime( 'June 1' ) ),
998
- date_i18n( 'F', strtotime( 'July 1' ) ),
999
- date_i18n( 'F', strtotime( 'August 1' ) ),
1000
- date_i18n( 'F', strtotime( 'September 1' ) ),
1001
- date_i18n( 'F', strtotime( 'October 1' ) ),
1002
- date_i18n( 'F', strtotime( 'November 1' ) ),
1003
- date_i18n( 'F', strtotime( 'December 1' ) ),
1004
- ) );
1005
- wp_localize_script( 'pickadate.date', 'mc_days', array(
1006
- date_i18n( 'D', strtotime( 'Sunday' ) ),
1007
- date_i18n( 'D', strtotime( 'Monday' ) ),
1008
- date_i18n( 'D', strtotime( 'Tuesday' ) ),
1009
- date_i18n( 'D', strtotime( 'Wednesday' ) ),
1010
- date_i18n( 'D', strtotime( 'Thursday' ) ),
1011
- date_i18n( 'D', strtotime( 'Friday' ) ),
1012
- date_i18n( 'D', strtotime( 'Saturday' ) ),
1013
- ) );
 
 
 
 
 
 
 
 
1014
  $sweek = absint( get_option( 'start_of_week' ) );
1015
- wp_localize_script( 'pickadate.date', 'mc_text', array(
1016
- 'vals' => array(
1017
- 'today' => addslashes( __( 'Today', 'my-calendar' ) ),
1018
- 'clear' => addslashes( __( 'Clear', 'my-calendar' ) ),
1019
- 'close' => addslashes( __( 'Close', 'my-calendar' ) ),
1020
- // False-y values = Sunday, truth-y = Monday.
1021
- 'start' => ( 1 == $sweek || 0 == $sweek ) ? $sweek : 0,
1022
- ),
1023
- ) );
 
 
 
 
1024
  wp_localize_script( 'pickadate.time', 'mc_time_format', apply_filters( 'mc_time_format', 'h:i A' ) );
1025
  wp_localize_script( 'pickadate.time', 'mc_interval', apply_filters( 'mc_interval', '15' ) );
1026
  wp_enqueue_script( 'mc.pickadate', plugins_url( 'js/mc-datepicker.js', __FILE__ ), array( 'jquery', 'pickadate.date', 'pickadate.time' ) );
@@ -1043,20 +1058,28 @@ function mc_scripts() {
1043
  if ( 'toplevel_page_my-calendar' == $id ) {
1044
  if ( current_user_can( 'mc_manage_events' ) ) {
1045
  wp_enqueue_script( 'mc.ajax', plugins_url( 'js/ajax.js', __FILE__ ), array( 'jquery' ) );
1046
- wp_localize_script( 'mc.ajax', 'mc_data', array(
1047
- 'action' => 'delete_occurrence',
1048
- 'recur' => 'add_date',
1049
- 'security' => wp_create_nonce( 'mc-delete-nonce' ),
1050
- ) );
 
 
 
 
1051
  }
1052
  }
1053
 
1054
  if ( 'my-calendar_page_my-calendar-config' == $id ) {
1055
  wp_enqueue_script( 'jquery-ui-autocomplete' );
1056
- wp_enqueue_script( 'mc.suggest', plugins_url( 'js/jquery.suggest.js', __FILE__ ), array(
1057
- 'jquery',
1058
- 'jquery-ui-autocomplete',
1059
- ) );
 
 
 
 
1060
  wp_localize_script( 'mc.suggest', 'mc_ajax_action', 'mc_post_lookup' );
1061
  }
1062
 
@@ -1074,10 +1097,12 @@ add_action( 'wp_ajax_mc_post_lookup', 'mc_post_lookup' );
1074
  */
1075
  function mc_post_lookup() {
1076
  if ( isset( $_REQUEST['term'] ) ) {
1077
- $posts = get_posts( array(
1078
- 's' => $_REQUEST['term'],
1079
- 'post_type' => array( 'post', 'page' ),
1080
- ) );
 
 
1081
  $suggestions = array();
1082
  global $post;
1083
  foreach ( $posts as $post ) {
@@ -1100,10 +1125,12 @@ add_action( 'wp_ajax_delete_occurrence', 'mc_ajax_delete_occurrence' );
1100
  */
1101
  function mc_ajax_delete_occurrence() {
1102
  if ( ! check_ajax_referer( 'mc-delete-nonce', 'security', false ) ) {
1103
- wp_send_json( array(
1104
- 'success' => 0,
1105
- 'response' => __( 'Invalid Security Check', 'my-calendar' ),
1106
- ) );
 
 
1107
  }
1108
 
1109
  if ( current_user_can( 'mc_manage_events' ) ) {
@@ -1113,21 +1140,27 @@ function mc_ajax_delete_occurrence() {
1113
  $result = $wpdb->query( $wpdb->prepare( $delete, $occur_id ) ); // WPCS: unprepared SQL OK.
1114
 
1115
  if ( $result ) {
1116
- wp_send_json( array(
1117
- 'success' => 1,
1118
- 'response' => __( 'Event instance has been deleted.', 'my-calendar' ),
1119
- ) );
 
 
1120
  } else {
1121
- wp_send_json( array(
1122
- 'success' => 0,
1123
- 'response' => __( 'Event instance was not deleted.', 'my-calendar' ),
1124
- ) );
 
 
1125
  }
1126
  } else {
1127
- wp_send_json( array(
1128
- 'success' => 0,
1129
- 'response' => __( 'You are not authorized to perform this action', 'my-calendar' ),
1130
- ) );
 
 
1131
  }
1132
  }
1133
 
@@ -1137,20 +1170,24 @@ add_action( 'wp_ajax_add_date', 'mc_ajax_add_date' );
1137
  */
1138
  function mc_ajax_add_date() {
1139
  if ( ! check_ajax_referer( 'mc-delete-nonce', 'security', false ) ) {
1140
- wp_send_json( array(
1141
- 'success' => 0,
1142
- 'response' => __( 'Invalid Security Check', 'my-calendar' ),
1143
- ) );
 
 
1144
  }
1145
  if ( current_user_can( 'mc_manage_events' ) ) {
1146
  global $wpdb;
1147
  $event_id = (int) $_REQUEST['event_id'];
1148
 
1149
  if ( 0 === $event_id ) {
1150
- wp_send_json( array(
1151
- 'success' => 0,
1152
- 'response' => __( 'No event ID in that request.', 'my-calendar' ),
1153
- ) );
 
 
1154
  }
1155
 
1156
  $event_date = $_REQUEST['event_date'];
@@ -1177,21 +1214,27 @@ function mc_ajax_add_date() {
1177
  $result = $wpdb->insert( my_calendar_event_table(), $data, $format );
1178
 
1179
  if ( $result ) {
1180
- wp_send_json( array(
1181
- 'success' => 1,
1182
- 'response' => __( 'Thanks! I added your new date.', 'my-calendar' ),
1183
- ) );
 
 
1184
  } else {
1185
- wp_send_json( array(
1186
- 'success' => 0,
1187
- 'response' => __( 'Sorry! I failed to add that date.', 'my-calendar' ),
1188
- ) );
 
 
1189
  }
1190
  } else {
1191
- wp_send_json( array(
1192
- 'success' => 0,
1193
- 'response' => __( 'You are not authorized to perform this action', 'my-calendar' ),
1194
- ) );
 
 
1195
  }
1196
  }
1197
 
@@ -1248,10 +1291,12 @@ function mc_guess_calendar() {
1248
  // if my-calendar exists but does not contain shortcode, add it.
1249
  if ( ! has_shortcode( $content, 'my_calendar' ) ) {
1250
  $content .= "\n\n[my_calendar]";
1251
- wp_update_post( array(
1252
- 'ID' => $post_ID,
1253
- 'post_content' => $content,
1254
- ) );
 
 
1255
  }
1256
  update_option( 'mc_uri', $link );
1257
  update_option( 'mc_uri_id', $post_ID );
707
  delete_option( 'mc_user_location_type' );
708
  delete_option( 'mc_event_approve_perms' );
709
  delete_option( 'mc_location_type' );
710
+ add_option(
711
+ 'mc_style_vars',
712
+ array(
713
+ '--primary-dark' => '#313233',
714
+ '--primary-light' => '#fff',
715
+ '--secondary-light' => '#fff',
716
+ '--secondary-dark' => '#000',
717
+ '--highlight-dark' => '#666',
718
+ '--highlight-light' => '#efefef',
719
+ )
720
+ );
721
  mc_upgrade_db();
722
  mc_transition_categories();
723
  break;
991
  wp_enqueue_script( 'pickadate', plugins_url( 'js/pickadate/picker.js', __FILE__ ), array( 'jquery' ) );
992
  wp_enqueue_script( 'pickadate.date', plugins_url( 'js/pickadate/picker.date.js', __FILE__ ), array( 'pickadate' ) );
993
  wp_enqueue_script( 'pickadate.time', plugins_url( 'js/pickadate/picker.time.js', __FILE__ ), array( 'pickadate' ) );
994
+ wp_localize_script(
995
+ 'pickadate.date',
996
+ 'mc_months',
997
+ array(
998
+ date_i18n( 'F', strtotime( 'January 1' ) ),
999
+ date_i18n( 'F', strtotime( 'February 1' ) ),
1000
+ date_i18n( 'F', strtotime( 'March 1' ) ),
1001
+ date_i18n( 'F', strtotime( 'April 1' ) ),
1002
+ date_i18n( 'F', strtotime( 'May 1' ) ),
1003
+ date_i18n( 'F', strtotime( 'June 1' ) ),
1004
+ date_i18n( 'F', strtotime( 'July 1' ) ),
1005
+ date_i18n( 'F', strtotime( 'August 1' ) ),
1006
+ date_i18n( 'F', strtotime( 'September 1' ) ),
1007
+ date_i18n( 'F', strtotime( 'October 1' ) ),
1008
+ date_i18n( 'F', strtotime( 'November 1' ) ),
1009
+ date_i18n( 'F', strtotime( 'December 1' ) ),
1010
+ )
1011
+ );
1012
+ wp_localize_script(
1013
+ 'pickadate.date',
1014
+ 'mc_days',
1015
+ array(
1016
+ date_i18n( 'D', strtotime( 'Sunday' ) ),
1017
+ date_i18n( 'D', strtotime( 'Monday' ) ),
1018
+ date_i18n( 'D', strtotime( 'Tuesday' ) ),
1019
+ date_i18n( 'D', strtotime( 'Wednesday' ) ),
1020
+ date_i18n( 'D', strtotime( 'Thursday' ) ),
1021
+ date_i18n( 'D', strtotime( 'Friday' ) ),
1022
+ date_i18n( 'D', strtotime( 'Saturday' ) ),
1023
+ )
1024
+ );
1025
  $sweek = absint( get_option( 'start_of_week' ) );
1026
+ wp_localize_script(
1027
+ 'pickadate.date',
1028
+ 'mc_text',
1029
+ array(
1030
+ 'vals' => array(
1031
+ 'today' => addslashes( __( 'Today', 'my-calendar' ) ),
1032
+ 'clear' => addslashes( __( 'Clear', 'my-calendar' ) ),
1033
+ 'close' => addslashes( __( 'Close', 'my-calendar' ) ),
1034
+ // False-y values = Sunday, truth-y = Monday.
1035
+ 'start' => ( 1 == $sweek || 0 == $sweek ) ? $sweek : 0,
1036
+ ),
1037
+ )
1038
+ );
1039
  wp_localize_script( 'pickadate.time', 'mc_time_format', apply_filters( 'mc_time_format', 'h:i A' ) );
1040
  wp_localize_script( 'pickadate.time', 'mc_interval', apply_filters( 'mc_interval', '15' ) );
1041
  wp_enqueue_script( 'mc.pickadate', plugins_url( 'js/mc-datepicker.js', __FILE__ ), array( 'jquery', 'pickadate.date', 'pickadate.time' ) );
1058
  if ( 'toplevel_page_my-calendar' == $id ) {
1059
  if ( current_user_can( 'mc_manage_events' ) ) {
1060
  wp_enqueue_script( 'mc.ajax', plugins_url( 'js/ajax.js', __FILE__ ), array( 'jquery' ) );
1061
+ wp_localize_script(
1062
+ 'mc.ajax',
1063
+ 'mc_data',
1064
+ array(
1065
+ 'action' => 'delete_occurrence',
1066
+ 'recur' => 'add_date',
1067
+ 'security' => wp_create_nonce( 'mc-delete-nonce' ),
1068
+ )
1069
+ );
1070
  }
1071
  }
1072
 
1073
  if ( 'my-calendar_page_my-calendar-config' == $id ) {
1074
  wp_enqueue_script( 'jquery-ui-autocomplete' );
1075
+ wp_enqueue_script(
1076
+ 'mc.suggest',
1077
+ plugins_url( 'js/jquery.suggest.js', __FILE__ ),
1078
+ array(
1079
+ 'jquery',
1080
+ 'jquery-ui-autocomplete',
1081
+ )
1082
+ );
1083
  wp_localize_script( 'mc.suggest', 'mc_ajax_action', 'mc_post_lookup' );
1084
  }
1085
 
1097
  */
1098
  function mc_post_lookup() {
1099
  if ( isset( $_REQUEST['term'] ) ) {
1100
+ $posts = get_posts(
1101
+ array(
1102
+ 's' => $_REQUEST['term'],
1103
+ 'post_type' => array( 'post', 'page' ),
1104
+ )
1105
+ );
1106
  $suggestions = array();
1107
  global $post;
1108
  foreach ( $posts as $post ) {
1125
  */
1126
  function mc_ajax_delete_occurrence() {
1127
  if ( ! check_ajax_referer( 'mc-delete-nonce', 'security', false ) ) {
1128
+ wp_send_json(
1129
+ array(
1130
+ 'success' => 0,
1131
+ 'response' => __( 'Invalid Security Check', 'my-calendar' ),
1132
+ )
1133
+ );
1134
  }
1135
 
1136
  if ( current_user_can( 'mc_manage_events' ) ) {
1140
  $result = $wpdb->query( $wpdb->prepare( $delete, $occur_id ) ); // WPCS: unprepared SQL OK.
1141
 
1142
  if ( $result ) {
1143
+ wp_send_json(
1144
+ array(
1145
+ 'success' => 1,
1146
+ 'response' => __( 'Event instance has been deleted.', 'my-calendar' ),
1147
+ )
1148
+ );
1149
  } else {
1150
+ wp_send_json(
1151
+ array(
1152
+ 'success' => 0,
1153
+ 'response' => __( 'Event instance was not deleted.', 'my-calendar' ),
1154
+ )
1155
+ );
1156
  }
1157
  } else {
1158
+ wp_send_json(
1159
+ array(
1160
+ 'success' => 0,
1161
+ 'response' => __( 'You are not authorized to perform this action', 'my-calendar' ),
1162
+ )
1163
+ );
1164
  }
1165
  }
1166
 
1170
  */
1171
  function mc_ajax_add_date() {
1172
  if ( ! check_ajax_referer( 'mc-delete-nonce', 'security', false ) ) {
1173
+ wp_send_json(
1174
+ array(
1175
+ 'success' => 0,
1176
+ 'response' => __( 'Invalid Security Check', 'my-calendar' ),
1177
+ )
1178
+ );
1179
  }
1180
  if ( current_user_can( 'mc_manage_events' ) ) {
1181
  global $wpdb;
1182
  $event_id = (int) $_REQUEST['event_id'];
1183
 
1184
  if ( 0 === $event_id ) {
1185
+ wp_send_json(
1186
+ array(
1187
+ 'success' => 0,
1188
+ 'response' => __( 'No event ID in that request.', 'my-calendar' ),
1189
+ )
1190
+ );
1191
  }
1192
 
1193
  $event_date = $_REQUEST['event_date'];
1214
  $result = $wpdb->insert( my_calendar_event_table(), $data, $format );
1215
 
1216
  if ( $result ) {
1217
+ wp_send_json(
1218
+ array(
1219
+ 'success' => 1,
1220
+ 'response' => __( 'Thanks! I added your new date.', 'my-calendar' ),
1221
+ )
1222
+ );
1223
  } else {
1224
+ wp_send_json(
1225
+ array(
1226
+ 'success' => 0,
1227
+ 'response' => __( 'Sorry! I failed to add that date.', 'my-calendar' ),
1228
+ )
1229
+ );
1230
  }
1231
  } else {
1232
+ wp_send_json(
1233
+ array(
1234
+ 'success' => 0,
1235
+ 'response' => __( 'You are not authorized to perform this action', 'my-calendar' ),
1236
+ )
1237
+ );
1238
  }
1239
  }
1240
 
1291
  // if my-calendar exists but does not contain shortcode, add it.
1292
  if ( ! has_shortcode( $content, 'my_calendar' ) ) {
1293
  $content .= "\n\n[my_calendar]";
1294
+ wp_update_post(
1295
+ array(
1296
+ 'ID' => $post_ID,
1297
+ 'post_content' => $content,
1298
+ )
1299
+ );
1300
  }
1301
  update_option( 'mc_uri', $link );
1302
  update_option( 'mc_uri_id', $post_ID );
my-calendar-event-manager.php CHANGED
@@ -197,11 +197,13 @@ function mc_create_event_post( $data, $event_id ) {
197
  */
198
  function mc_event_delete_posts( $deleted ) {
199
  foreach ( $deleted as $delete ) {
200
- $posts = get_posts( array(
201
- 'post_type' => 'mc-events',
202
- 'meta_key' => '_mc_event_id',
203
- 'meta_value' => $delete,
204
- ) );
 
 
205
  if ( isset( $posts[0] ) && is_object( $posts[0] ) ) {
206
  $post_id = $posts[0]->ID;
207
  wp_delete_post( $post_id, true );
@@ -765,9 +767,15 @@ function my_calendar_save( $action, $output, $event_id = false ) {
765
  }
766
  }
767
  } else {
768
- $result = $wpdb->update( my_calendar_table(), $update, array(
769
- 'event_id' => $event_id,
770
- ), $formats, '%d' );
 
 
 
 
 
 
771
  if ( isset( $_POST['prev_event_repeats'] ) && isset( $_POST['prev_event_recur'] ) ) {
772
  $recur_changed = ( $update['event_repeats'] != $_POST['prev_event_repeats'] || $update['event_recur'] != $_POST['prev_event_recur'] ) ? true : false;
773
  } else {
@@ -822,10 +830,14 @@ function mc_set_category_relationships( $cats, $event_id ) {
822
  global $wpdb;
823
  if ( is_array( $cats ) ) {
824
  foreach ( $cats as $cat ) {
825
- $wpdb->insert( my_calendar_category_relationships_table(), array(
826
- 'event_id' => $event_id,
827
- 'category_id' => $cat,
828
- ), array( '%d', '%d' ) );
 
 
 
 
829
  }
830
  }
831
  }
@@ -846,10 +858,14 @@ function mc_update_category_relationships( $cats, $event_id ) {
846
 
847
  if ( is_array( $cats ) && ! empty( $cats ) ) {
848
  foreach ( $cats as $cat ) {
849
- $wpdb->insert( my_calendar_category_relationships_table(), array(
850
- 'event_id' => $event_id,
851
- 'category_id' => $cat,
852
- ), array( '%d', '%d' ) );
 
 
 
 
853
  }
854
  }
855
  }
@@ -1772,20 +1788,23 @@ function mc_selected_users( $selected = '', $group = 'authors' ) {
1772
  * @return array
1773
  */
1774
  function mc_event_access() {
1775
- $event_access = apply_filters( 'mc_event_access_choices', array(
1776
- '1' => __( 'Audio Description', 'my-calendar' ),
1777
- '2' => __( 'ASL Interpretation', 'my-calendar' ),
1778
- '3' => __( 'ASL Interpretation with voicing', 'my-calendar' ),
1779
- '4' => __( 'Deaf-Blind ASL', 'my-calendar' ),
1780
- '5' => __( 'Real-time Captioning', 'my-calendar' ),
1781
- '6' => __( 'Scripted Captioning', 'my-calendar' ),
1782
- '7' => __( 'Assisted Listening Devices', 'my-calendar' ),
1783
- '8' => __( 'Tactile/Touch Tour', 'my-calendar' ),
1784
- '9' => __( 'Braille Playbill', 'my-calendar' ),
1785
- '10' => __( 'Large Print Playbill', 'my-calendar' ),
1786
- '11' => __( 'Sensory Friendly', 'my-calendar' ),
1787
- '12' => __( 'Other', 'my-calendar' ),
1788
- ) );
 
 
 
1789
 
1790
  return $event_access;
1791
  }
@@ -2059,15 +2078,17 @@ function mc_list_events() {
2059
  echo $filtered;
2060
  $num_pages = ceil( $items / $items_per_page );
2061
  if ( $num_pages > 1 ) {
2062
- $page_links = paginate_links( array(
2063
- 'base' => add_query_arg( 'paged', '%#%' ),
2064
- 'format' => '',
2065
- 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
2066
- 'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar' ),
2067
- 'total' => $num_pages,
2068
- 'current' => $current,
2069
- 'mid_size' => 1,
2070
- ) );
 
 
2071
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
2072
  }
2073
  if ( ! empty( $events ) ) {
@@ -2368,15 +2389,17 @@ function mc_list_events() {
2368
  echo $filtered;
2369
  $num_pages = ceil( $items / $items_per_page );
2370
  if ( $num_pages > 1 ) {
2371
- $page_links = paginate_links( array(
2372
- 'base' => add_query_arg( 'paged', '%#%' ),
2373
- 'format' => '',
2374
- 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
2375
- 'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar' ),
2376
- 'total' => $num_pages,
2377
- 'current' => $current,
2378
- 'mid_size' => 1,
2379
- ) );
 
 
2380
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
2381
  }
2382
  ?>
@@ -3992,11 +4015,13 @@ function mc_increment_event( $id, $post = array(), $test = false, $instances = a
3992
  * Check for events with known occurrence overlap problems.
3993
  */
3994
  function mc_list_problems() {
3995
- $events = get_posts( array(
3996
- 'post_type' => 'mc-events',
3997
- 'meta_key' => '_occurrence_overlap',
3998
- 'meta_value' => 'false',
3999
- ) );
 
 
4000
  $list = array();
4001
  $problems = array();
4002
 
197
  */
198
  function mc_event_delete_posts( $deleted ) {
199
  foreach ( $deleted as $delete ) {
200
+ $posts = get_posts(
201
+ array(
202
+ 'post_type' => 'mc-events',
203
+ 'meta_key' => '_mc_event_id',
204
+ 'meta_value' => $delete,
205
+ )
206
+ );
207
  if ( isset( $posts[0] ) && is_object( $posts[0] ) ) {
208
  $post_id = $posts[0]->ID;
209
  wp_delete_post( $post_id, true );
767
  }
768
  }
769
  } else {
770
+ $result = $wpdb->update(
771
+ my_calendar_table(),
772
+ $update,
773
+ array(
774
+ 'event_id' => $event_id,
775
+ ),
776
+ $formats,
777
+ '%d'
778
+ );
779
  if ( isset( $_POST['prev_event_repeats'] ) && isset( $_POST['prev_event_recur'] ) ) {
780
  $recur_changed = ( $update['event_repeats'] != $_POST['prev_event_repeats'] || $update['event_recur'] != $_POST['prev_event_recur'] ) ? true : false;
781
  } else {
830
  global $wpdb;
831
  if ( is_array( $cats ) ) {
832
  foreach ( $cats as $cat ) {
833
+ $wpdb->insert(
834
+ my_calendar_category_relationships_table(),
835
+ array(
836
+ 'event_id' => $event_id,
837
+ 'category_id' => $cat,
838
+ ),
839
+ array( '%d', '%d' )
840
+ );
841
  }
842
  }
843
  }
858
 
859
  if ( is_array( $cats ) && ! empty( $cats ) ) {
860
  foreach ( $cats as $cat ) {
861
+ $wpdb->insert(
862
+ my_calendar_category_relationships_table(),
863
+ array(
864
+ 'event_id' => $event_id,
865
+ 'category_id' => $cat,
866
+ ),
867
+ array( '%d', '%d' )
868
+ );
869
  }
870
  }
871
  }
1788
  * @return array
1789
  */
1790
  function mc_event_access() {
1791
+ $event_access = apply_filters(
1792
+ 'mc_event_access_choices',
1793
+ array(
1794
+ '1' => __( 'Audio Description', 'my-calendar' ),
1795
+ '2' => __( 'ASL Interpretation', 'my-calendar' ),
1796
+ '3' => __( 'ASL Interpretation with voicing', 'my-calendar' ),
1797
+ '4' => __( 'Deaf-Blind ASL', 'my-calendar' ),
1798
+ '5' => __( 'Real-time Captioning', 'my-calendar' ),
1799
+ '6' => __( 'Scripted Captioning', 'my-calendar' ),
1800
+ '7' => __( 'Assisted Listening Devices', 'my-calendar' ),
1801
+ '8' => __( 'Tactile/Touch Tour', 'my-calendar' ),
1802
+ '9' => __( 'Braille Playbill', 'my-calendar' ),
1803
+ '10' => __( 'Large Print Playbill', 'my-calendar' ),
1804
+ '11' => __( 'Sensory Friendly', 'my-calendar' ),
1805
+ '12' => __( 'Other', 'my-calendar' ),
1806
+ )
1807
+ );
1808
 
1809
  return $event_access;
1810
  }
2078
  echo $filtered;
2079
  $num_pages = ceil( $items / $items_per_page );
2080
  if ( $num_pages > 1 ) {
2081
+ $page_links = paginate_links(
2082
+ array(
2083
+ 'base' => add_query_arg( 'paged', '%#%' ),
2084
+ 'format' => '',
2085
+ 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
2086
+ 'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar' ),
2087
+ 'total' => $num_pages,
2088
+ 'current' => $current,
2089
+ 'mid_size' => 1,
2090
+ )
2091
+ );
2092
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
2093
  }
2094
  if ( ! empty( $events ) ) {
2389
  echo $filtered;
2390
  $num_pages = ceil( $items / $items_per_page );
2391
  if ( $num_pages > 1 ) {
2392
+ $page_links = paginate_links(
2393
+ array(
2394
+ 'base' => add_query_arg( 'paged', '%#%' ),
2395
+ 'format' => '',
2396
+ 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
2397
+ 'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar' ),
2398
+ 'total' => $num_pages,
2399
+ 'current' => $current,
2400
+ 'mid_size' => 1,
2401
+ )
2402
+ );
2403
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
2404
  }
2405
  ?>
4015
  * Check for events with known occurrence overlap problems.
4016
  */
4017
  function mc_list_problems() {
4018
+ $events = get_posts(
4019
+ array(
4020
+ 'post_type' => 'mc-events',
4021
+ 'meta_key' => '_occurrence_overlap',
4022
+ 'meta_value' => 'false',
4023
+ )
4024
+ );
4025
  $list = array();
4026
  $problems = array();
4027
 
my-calendar-events.php CHANGED
@@ -211,44 +211,50 @@ function mc_get_all_events( $args ) {
211
  // Events before today.
212
  if ( $before > 0 ) {
213
  $before = $before + 15;
214
- $events1 = $mcdb->get_results( 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
215
- FROM ' . my_calendar_event_table( $site ) . '
216
- JOIN ' . my_calendar_table( $site ) . " AS e
217
- ON (event_id=occur_event_id)
218
- $join
219
- JOIN " . my_calendar_categories_table( $site ) . " as c
220
- ON (e.event_category=c.category_id)
221
- WHERE $limit
222
- AND DATE(occur_begin) < '$date'
223
- $exclude_categories
224
- ORDER BY occur_begin DESC LIMIT 0,$before" );
 
 
225
  }
226
  // Events happening today.
227
  if ( 'yes' == $today ) {
228
- $events3 = $mcdb->get_results( 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
229
- FROM ' . my_calendar_event_table( $site ) . '
230
- JOIN ' . my_calendar_table( $site ) . " AS e
231
- ON (event_id=occur_event_id)
232
- $join
233
- JOIN " . my_calendar_categories_table( $site ) . " as c
234
- ON (e.event_category=c.category_id)
235
- WHERE $limit
236
- $exclude_categories
237
- AND ( ( DATE(occur_begin) < '$date' AND DATE(occur_end) > '$date' ) OR DATE(occur_begin) = '$date' )" );
 
 
238
  }
239
  // Upcoming Events.
240
  if ( $after > 0 ) {
241
  $after = $after + 15;
242
- $events2 = $mcdb->get_results( 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
243
- FROM ' . my_calendar_event_table( $site ) . '
244
- JOIN ' . my_calendar_table( $site ) . " AS e
245
- ON (event_id=occur_event_id)
246
- $join
247
- JOIN " . my_calendar_categories_table( $site ) . " as c
248
- ON (e.event_category=c.category_id)
249
- WHERE $limit
250
- $exclude_categories
251
- AND DATE(occur_begin) > '$date' ORDER BY occur_begin ASC LIMIT 0,$after" );
 
 
252
  }
253
 
254
  $arr_events = array();
@@ -318,15 +324,28 @@ function mc_get_rss_events( $cat_id = false ) {
318
  $cat = 'WHERE event_approved = 1 AND event_flagged <> 1';
319
  }
320
  $exclude_categories = mc_private_categories();
321
- $limit = apply_filters( 'mc_rss_feed_size', 30 );
322
 
323
  $events = $mcdb->get_results(
324
  'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
325
  FROM ' . my_calendar_event_table() . '
326
  JOIN ' . my_calendar_table() . ' ON (event_id=occur_event_id)
327
  JOIN ' . my_calendar_categories_table() . " AS c ON (event_category=category_id) $cat
 
328
  $exclude_categories
329
- ORDER BY event_added DESC LIMIT 0,$limit" );
 
 
 
 
 
 
 
 
 
 
 
 
330
  $groups = array();
331
  $output = array();
332
  foreach ( array_keys( $events ) as $key ) {
211
  // Events before today.
212
  if ( $before > 0 ) {
213
  $before = $before + 15;
214
+ $events1 = $mcdb->get_results(
215
+ 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
216
+ FROM ' . my_calendar_event_table( $site ) . '
217
+ JOIN ' . my_calendar_table( $site ) . " AS e
218
+ ON (event_id=occur_event_id)
219
+ $join
220
+ JOIN " . my_calendar_categories_table( $site ) . " as c
221
+ ON (e.event_category=c.category_id)
222
+ WHERE $limit
223
+ AND DATE(occur_begin) < '$date'
224
+ $exclude_categories
225
+ ORDER BY occur_begin DESC LIMIT 0,$before"
226
+ );
227
  }
228
  // Events happening today.
229
  if ( 'yes' == $today ) {
230
+ $events3 = $mcdb->get_results(
231
+ 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
232
+ FROM ' . my_calendar_event_table( $site ) . '
233
+ JOIN ' . my_calendar_table( $site ) . " AS e
234
+ ON (event_id=occur_event_id)
235
+ $join
236
+ JOIN " . my_calendar_categories_table( $site ) . " as c
237
+ ON (e.event_category=c.category_id)
238
+ WHERE $limit
239
+ $exclude_categories
240
+ AND ( ( DATE(occur_begin) < '$date' AND DATE(occur_end) > '$date' ) OR DATE(occur_begin) = '$date' )"
241
+ );
242
  }
243
  // Upcoming Events.
244
  if ( $after > 0 ) {
245
  $after = $after + 15;
246
+ $events2 = $mcdb->get_results(
247
+ 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
248
+ FROM ' . my_calendar_event_table( $site ) . '
249
+ JOIN ' . my_calendar_table( $site ) . " AS e
250
+ ON (event_id=occur_event_id)
251
+ $join
252
+ JOIN " . my_calendar_categories_table( $site ) . " as c
253
+ ON (e.event_category=c.category_id)
254
+ WHERE $limit
255
+ $exclude_categories
256
+ AND DATE(occur_begin) > '$date' ORDER BY occur_begin ASC LIMIT 0,$after"
257
+ );
258
  }
259
 
260
  $arr_events = array();
324
  $cat = 'WHERE event_approved = 1 AND event_flagged <> 1';
325
  }
326
  $exclude_categories = mc_private_categories();
327
+ $limit = apply_filters( 'mc_rss_feed_date_range', 2 );
328
 
329
  $events = $mcdb->get_results(
330
  'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
331
  FROM ' . my_calendar_event_table() . '
332
  JOIN ' . my_calendar_table() . ' ON (event_id=occur_event_id)
333
  JOIN ' . my_calendar_categories_table() . " AS c ON (event_category=category_id) $cat
334
+ AND event_added > NOW() - INTERVAL $limit DAY
335
  $exclude_categories
336
+ ORDER BY event_added DESC"
337
+ );
338
+
339
+ if ( empty( $events ) ) {
340
+ $events = $mcdb->get_results(
341
+ 'SELECT *, UNIX_TIMESTAMP(occur_begin) AS ts_occur_begin, UNIX_TIMESTAMP(occur_end) AS ts_occur_end
342
+ FROM ' . my_calendar_event_table() . '
343
+ JOIN ' . my_calendar_table() . ' ON (event_id=occur_event_id)
344
+ JOIN ' . my_calendar_categories_table() . " AS c ON (event_category=category_id) $cat
345
+ $exclude_categories
346
+ ORDER BY event_added DESC LIMIT 0,30"
347
+ );
348
+ }
349
  $groups = array();
350
  $output = array();
351
  foreach ( array_keys( $events ) as $key ) {
my-calendar-group-manager.php CHANGED
@@ -404,7 +404,7 @@ function my_calendar_print_group_fields( $data, $mode, $event_id, $group_id = ''
404
  }
405
  ?>
406
  </label><br/>
407
- <?php wp_editor( esc_attr( $description ), 'content', array( 'textarea_rows' => 10 ) ); ?>
408
  </div>
409
  <?php
410
  }
@@ -1015,15 +1015,17 @@ function mc_list_groups() {
1015
  <?php
1016
  $num_pages = ceil( $items / $items_per_page );
1017
  if ( $num_pages > 1 ) {
1018
- $page_links = paginate_links( array(
1019
- 'base' => add_query_arg( 'paged', '%#%' ),
1020
- 'format' => '',
1021
- 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
1022
- 'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar' ),
1023
- 'total' => $num_pages,
1024
- 'current' => $current,
1025
- 'mid_size' => 1,
1026
- ) );
 
 
1027
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
1028
  }
1029
  if ( ! empty( $events ) ) {
404
  }
405
  ?>
406
  </label><br/>
407
+ <?php wp_editor( $description, 'content', array( 'textarea_rows' => 10 ) ); ?>
408
  </div>
409
  <?php
410
  }
1015
  <?php
1016
  $num_pages = ceil( $items / $items_per_page );
1017
  if ( $num_pages > 1 ) {
1018
+ $page_links = paginate_links(
1019
+ array(
1020
+ 'base' => add_query_arg( 'paged', '%#%' ),
1021
+ 'format' => '',
1022
+ 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
1023
+ 'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> &raquo;', 'my-calendar' ),
1024
+ 'total' => $num_pages,
1025
+ 'current' => $current,
1026
+ 'mid_size' => 1,
1027
+ )
1028
+ );
1029
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
1030
  }
1031
  if ( ! empty( $events ) ) {
my-calendar-install.php CHANGED
@@ -50,60 +50,70 @@ function mc_widget_defaults() {
50
  function mc_globals() {
51
  global $wpdb;
52
 
53
- $grid_template = addslashes( '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span>{endtime before="<span class=\'end-time\' title=\'{dtend}\'>" after="</span>"}</span>
54
-
55
- <div class="sub-details">
56
- {hcard}
57
- {details before="<p class=\'mc_details\'>" after="</p>"}
58
- <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>' );
59
-
60
- $list_template = addslashes( '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span>{endtime before="<span class=\'end-time value-title\' title=\'{dtend}\'>" after="</span>"}</span>
61
-
62
- <h3 class="event-title">{title}</h3>
63
-
64
- <div class="sub-details">
65
- {hcard}
66
- {details before="<p class=\'mc_details\'>" after="</p>"}
67
- <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>' );
68
-
69
- $mini_template = addslashes( '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span>{endtime before="<span class=\'end-time value-title\' title=\'{dtend}\'>" after="</span>"}</span>
70
-
71
- <h3 class="event-title">{title}</h3>
72
-
73
- <div class="sub-details">
74
- {excerpt before="<div class=\'excerpt\'>" after="</div>"}
75
- {hcard}
76
- <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>' );
77
-
78
- $single_template = addslashes( '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span><span class="end-time value-title" title="{dtend}">{endtime}</span></span>
79
-
80
- <div class="sub-details">
81
- {hcard}
82
- <div class="mc-description">{image}{description}</div>
83
- <p>{ical_html} &bull; {gcal_link}</p>
84
- {map}
85
- <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>' );
86
-
87
- $rss_template = addslashes( "\n<item>
88
- <title>{rss_title}: {date}, {time}</title>
89
- <link>{link}</link>
90
- <pubDate>{rssdate}</pubDate>
91
- <dc:creator>{author}</dc:creator>
92
- <description><![CDATA[{rss_description}]]></description>
93
- <content:encoded><![CDATA[<div class='vevent'>
94
- <h1 class='summary'>{rss_title}</h1>
95
- <div class='description'>{rss_description}</div>
96
- <p class='dtstart' title='{ical_start}'>Begins: {time} on {date}</p>
97
- <p class='dtend' title='{ical_end}'>Ends: {endtime} on {enddate}</p>
98
- <p>Recurrence: {recurs}</p>
99
- <p>Repetition: {repeats} times</p>
100
- <div class='location'>{rss_hcard}</div>
101
- {link_title}
102
- </div>]]></content:encoded>
103
- <dc:format xmlns:dc='http://purl.org/dc/elements/1.1/'>text/html</dc:format>
104
- <dc:source xmlns:dc='http://purl.org/dc/elements/1.1/'>" . home_url() . '</dc:source>
105
- {guid}
106
- </item>' . PHP_EOL );
 
 
 
 
 
 
 
 
 
 
107
 
108
  $charset_collate = $wpdb->get_charset_collate();
109
  $event_fifth_week = ( get_option( 'mc_no_fifth_week' ) == 'true' ) ? 1 : 0;
@@ -245,20 +255,23 @@ function mc_default_settings() {
245
  add_option( 'mc_event_link_expires', 'false' );
246
  add_option( 'mc_apply_color', 'background' );
247
  add_option( 'mc_inverse_color', 'true' );
248
- add_option( 'mc_input_options', array(
249
- 'event_short' => 'off',
250
- 'event_desc' => 'on',
251
- 'event_category' => 'on',
252
- 'event_image' => 'on',
253
- 'event_link' => 'on',
254
- 'event_recurs' => 'on',
255
- 'event_open' => 'off',
256
- 'event_location' => 'off',
257
- 'event_location_dropdown' => 'on',
258
- 'event_specials' => 'off',
259
- 'event_access' => 'on',
260
- 'event_host' => 'off',
261
- ) );
 
 
 
262
  add_option( 'mc_input_options_administrators', 'false' );
263
  add_site_option( 'mc_multisite', '0' );
264
  add_option( 'mc_event_mail', 'false' );
@@ -270,28 +283,34 @@ function mc_default_settings() {
270
  add_option( 'mc_week_format', "M j, 'y" );
271
  add_option( 'mc_date_format', get_option( 'date_format' ) );
272
  // This option *must* be complete, if it's partial we get errors. So use update instead of add.
273
- update_option( 'mc_templates', array(
274
- 'title' => '{time}: {title}',
275
- 'title_list' => '{title}',
276
- 'title_solo' => '{title}',
277
- 'link' => __( 'More information', 'my-calendar' ),
278
- 'grid' => $grid_template,
279
- 'list' => $list_template,
280
- 'mini' => $mini_template,
281
- 'rss' => $rss_template,
282
- 'details' => $single_template,
283
- 'label' => __( 'Read more', 'my-calendar' ),
284
- ) );
 
 
 
285
  add_option( 'mc_skip_holidays', 'false' );
286
  add_option( 'mc_css_file', 'twentyeighteen.css' );
287
- add_option( 'mc_style_vars', array(
288
- '--primary-dark' => '#313233',
289
- '--primary-light' => '#fff',
290
- '--secondary-light' => '#fff',
291
- '--secondary-dark' => '#000',
292
- '--highlight-dark' => '#666',
293
- '--highlight-light' => '#efefef',
294
- ) );
 
 
 
295
  add_option( 'mc_time_format', get_option( 'time_format' ) );
296
  add_option( 'mc_show_weekends', 'true' );
297
  add_option( 'mc_convert', 'true' );
@@ -299,7 +318,7 @@ function mc_default_settings() {
299
  add_option( 'mc_multisite_show', 0 );
300
  add_option( 'mc_event_link', 'true' );
301
  add_option( 'mc_topnav', 'toggle,timeframe,jump,nav' );
302
- add_option( 'mc_bottomnav', 'key,category,feeds' );
303
  add_option( 'mc_default_direction', 'DESC' );
304
  update_option( 'mc_update_notice', 1 );
305
  mc_add_roles();
@@ -338,10 +357,12 @@ function mc_generate_calendar_page( $slug ) {
338
  );
339
  $post_ID = wp_insert_post( $page );
340
  $post_slug = wp_unique_post_slug( $slug, $post_ID, 'publish', 'page', 0 );
341
- wp_update_post( array(
342
- 'ID' => $post_ID,
343
- 'post_name' => $post_slug,
344
- ) );
 
 
345
  } else {
346
  $post = get_page_by_path( $slug );
347
  $post_ID = $post->ID;
@@ -545,10 +566,14 @@ function mc_transition_categories() {
545
  $event_id = $result->event_id;
546
  $category = $result->event_category;
547
 
548
- $insert = $wpdb->insert( my_calendar_category_relationships_table(), array(
549
- 'event_id' => $event_id,
550
- 'category_id' => $category,
551
- ), array( '%d', '%d' ) );
 
 
 
 
552
  }
553
  }
554
 
50
  function mc_globals() {
51
  global $wpdb;
52
 
53
+ $grid_template = addslashes(
54
+ '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span>{endtime before="<span class=\'end-time\' title=\'{dtend}\'>" after="</span>"}</span>
55
+
56
+ <div class="sub-details">
57
+ {hcard}
58
+ {details before="<p class=\'mc_details\'>" after="</p>"}
59
+ <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>'
60
+ );
61
+
62
+ $list_template = addslashes(
63
+ '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span>{endtime before="<span class=\'end-time value-title\' title=\'{dtend}\'>" after="</span>"}</span>
64
+
65
+ <h3 class="event-title">{title}</h3>
66
+
67
+ <div class="sub-details">
68
+ {hcard}
69
+ {details before="<p class=\'mc_details\'>" after="</p>"}
70
+ <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>'
71
+ );
72
+
73
+ $mini_template = addslashes(
74
+ '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span>{endtime before="<span class=\'end-time value-title\' title=\'{dtend}\'>" after="</span>"}</span>
75
+
76
+ <h3 class="event-title">{title}</h3>
77
+
78
+ <div class="sub-details">
79
+ {excerpt before="<div class=\'excerpt\'>" after="</div>"}
80
+ {hcard}
81
+ <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>'
82
+ );
83
+
84
+ $single_template = addslashes(
85
+ '<span class="event-time value-title" title="{dtstart}">{time}<span class="time-separator"> - </span><span class="end-time value-title" title="{dtend}">{endtime}</span></span>
86
+
87
+ <div class="sub-details">
88
+ {hcard}
89
+ <div class="mc-description">{image}{description}</div>
90
+ <p>{ical_html} &bull; {gcal_link}</p>
91
+ {map}
92
+ <p><a href="{linking}" class="event-link external"><span class="screen-reader-text">More information about </span>{title}</a></p></div>'
93
+ );
94
+
95
+ $rss_template = addslashes(
96
+ "\n<item>
97
+ <title>{rss_title}: {date}, {time}</title>
98
+ <link>{link}</link>
99
+ <pubDate>{rssdate}</pubDate>
100
+ <dc:creator>{author}</dc:creator>
101
+ <description><![CDATA[{rss_description}]]></description>
102
+ <content:encoded><![CDATA[<div class='vevent'>
103
+ <h1 class='summary'>{rss_title}</h1>
104
+ <div class='description'>{rss_description}</div>
105
+ <p class='dtstart' title='{ical_start}'>Begins: {time} on {date}</p>
106
+ <p class='dtend' title='{ical_end}'>Ends: {endtime} on {enddate}</p>
107
+ <p>Recurrence: {recurs}</p>
108
+ <p>Repetition: {repeats} times</p>
109
+ <div class='location'>{rss_hcard}</div>
110
+ {link_title}
111
+ </div>]]></content:encoded>
112
+ <dc:format xmlns:dc='http://purl.org/dc/elements/1.1/'>text/html</dc:format>
113
+ <dc:source xmlns:dc='http://purl.org/dc/elements/1.1/'>" . home_url() . '</dc:source>
114
+ {guid}
115
+ </item>' . PHP_EOL
116
+ );
117
 
118
  $charset_collate = $wpdb->get_charset_collate();
119
  $event_fifth_week = ( get_option( 'mc_no_fifth_week' ) == 'true' ) ? 1 : 0;
255
  add_option( 'mc_event_link_expires', 'false' );
256
  add_option( 'mc_apply_color', 'background' );
257
  add_option( 'mc_inverse_color', 'true' );
258
+ add_option(
259
+ 'mc_input_options',
260
+ array(
261
+ 'event_short' => 'off',
262
+ 'event_desc' => 'on',
263
+ 'event_category' => 'on',
264
+ 'event_image' => 'on',
265
+ 'event_link' => 'on',
266
+ 'event_recurs' => 'on',
267
+ 'event_open' => 'off',
268
+ 'event_location' => 'off',
269
+ 'event_location_dropdown' => 'on',
270
+ 'event_specials' => 'off',
271
+ 'event_access' => 'on',
272
+ 'event_host' => 'off',
273
+ )
274
+ );
275
  add_option( 'mc_input_options_administrators', 'false' );
276
  add_site_option( 'mc_multisite', '0' );
277
  add_option( 'mc_event_mail', 'false' );
283
  add_option( 'mc_week_format', "M j, 'y" );
284
  add_option( 'mc_date_format', get_option( 'date_format' ) );
285
  // This option *must* be complete, if it's partial we get errors. So use update instead of add.
286
+ update_option(
287
+ 'mc_templates',
288
+ array(
289
+ 'title' => '{time}: {title}',
290
+ 'title_list' => '{title}',
291
+ 'title_solo' => '{title}',
292
+ 'link' => __( 'More information', 'my-calendar' ),
293
+ 'grid' => $grid_template,
294
+ 'list' => $list_template,
295
+ 'mini' => $mini_template,
296
+ 'rss' => $rss_template,
297
+ 'details' => $single_template,
298
+ 'label' => __( 'Read more', 'my-calendar' ),
299
+ )
300
+ );
301
  add_option( 'mc_skip_holidays', 'false' );
302
  add_option( 'mc_css_file', 'twentyeighteen.css' );
303
+ add_option(
304
+ 'mc_style_vars',
305
+ array(
306
+ '--primary-dark' => '#313233',
307
+ '--primary-light' => '#fff',
308
+ '--secondary-light' => '#fff',
309
+ '--secondary-dark' => '#000',
310
+ '--highlight-dark' => '#666',
311
+ '--highlight-light' => '#efefef',
312
+ )
313
+ );
314
  add_option( 'mc_time_format', get_option( 'time_format' ) );
315
  add_option( 'mc_show_weekends', 'true' );
316
  add_option( 'mc_convert', 'true' );
318
  add_option( 'mc_multisite_show', 0 );
319
  add_option( 'mc_event_link', 'true' );
320
  add_option( 'mc_topnav', 'toggle,timeframe,jump,nav' );
321
+ add_option( 'mc_bottomnav', 'key,print' );
322
  add_option( 'mc_default_direction', 'DESC' );
323
  update_option( 'mc_update_notice', 1 );
324
  mc_add_roles();
357
  );
358
  $post_ID = wp_insert_post( $page );
359
  $post_slug = wp_unique_post_slug( $slug, $post_ID, 'publish', 'page', 0 );
360
+ wp_update_post(
361
+ array(
362
+ 'ID' => $post_ID,
363
+ 'post_name' => $post_slug,
364
+ )
365
+ );
366
  } else {
367
  $post = get_page_by_path( $slug );
368
  $post_ID = $post->ID;
566
  $event_id = $result->event_id;
567
  $category = $result->event_category;
568
 
569
+ $insert = $wpdb->insert(
570
+ my_calendar_category_relationships_table(),
571
+ array(
572
+ 'event_id' => $event_id,
573
+ 'category_id' => $category,
574
+ ),
575
+ array( '%d', '%d' )
576
+ );
577
  }
578
  }
579
 
my-calendar-location-manager.php CHANGED
@@ -138,15 +138,17 @@ function mc_manage_locations() {
138
 
139
  $num_pages = ceil( $items / $items_per_page );
140
  if ( $num_pages > 1 ) {
141
- $page_links = paginate_links( array(
142
- 'base' => add_query_arg( 'paged', '%#%' ),
143
- 'format' => '',
144
- 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Locations</span>', 'my-calendar' ),
145
- 'next_text' => __( 'Next<span class="screen-reader-text"> Locations</span> &raquo;', 'my-calendar' ),
146
- 'total' => $num_pages,
147
- 'current' => $current,
148
- 'mid_size' => 1,
149
- ) );
 
 
150
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
151
  }
152
 
@@ -174,34 +176,46 @@ function mc_manage_locations() {
174
  <tr>
175
  <th scope="col"><a href='
176
  <?php
177
- echo add_query_arg( array(
178
- 'paged' => $current,
179
- 'orderby' => 'id',
180
- ), admin_url( 'admin.php?page=my-calendar-location-manager' ) );
 
 
 
181
  ?>
182
  '><?php _e( 'ID', 'my-calendar' ); ?></a></th>
183
  <th scope="col"><a href='
184
  <?php
185
- echo add_query_arg( array(
186
- 'paged' => $current,
187
- 'orderby' => 'location',
188
- ), admin_url( 'admin.php?page=my-calendar-location-manager' ) );
 
 
 
189
  ?>
190
  '><?php _e( 'Location', 'my-calendar' ); ?></a></th>
191
  <th scope="col"><a href='
192
  <?php
193
- echo add_query_arg( array(
194
- 'paged' => $current,
195
- 'orderby' => 'city',
196
- ), admin_url( 'admin.php?page=my-calendar-location-manager' ) );
 
 
 
197
  ?>
198
  '><?php _e( 'City', 'my-calendar' ); ?></a></th>
199
  <th scope="col"><a href='
200
  <?php
201
- echo add_query_arg( array(
202
- 'paged' => $current,
203
- 'orderby' => 'state',
204
- ), admin_url( 'admin.php?page=my-calendar-location-manager' ) );
 
 
 
205
  ?>
206
  '><?php _e( 'State/Province', 'my-calendar' ); ?></a></th>
207
  <th scope="col"><?php _e( 'Edit', 'my-calendar' ); ?></th>
138
 
139
  $num_pages = ceil( $items / $items_per_page );
140
  if ( $num_pages > 1 ) {
141
+ $page_links = paginate_links(
142
+ array(
143
+ 'base' => add_query_arg( 'paged', '%#%' ),
144
+ 'format' => '',
145
+ 'prev_text' => __( '&laquo; Previous<span class="screen-reader-text"> Locations</span>', 'my-calendar' ),
146
+ 'next_text' => __( 'Next<span class="screen-reader-text"> Locations</span> &raquo;', 'my-calendar' ),
147
+ 'total' => $num_pages,
148
+ 'current' => $current,
149
+ 'mid_size' => 1,
150
+ )
151
+ );
152
  printf( "<div class='tablenav'><div class='tablenav-pages'>%s</div></div>", $page_links );
153
  }
154
 
176
  <tr>
177
  <th scope="col"><a href='
178
  <?php
179
+ echo add_query_arg(
180
+ array(
181
+ 'paged' => $current,
182
+ 'orderby' => 'id',
183
+ ),
184
+ admin_url( 'admin.php?page=my-calendar-location-manager' )
185
+ );
186
  ?>
187
  '><?php _e( 'ID', 'my-calendar' ); ?></a></th>
188
  <th scope="col"><a href='
189
  <?php
190
+ echo add_query_arg(
191
+ array(
192
+ 'paged' => $current,
193
+ 'orderby' => 'location',
194
+ ),
195
+ admin_url( 'admin.php?page=my-calendar-location-manager' )
196
+ );
197
  ?>
198
  '><?php _e( 'Location', 'my-calendar' ); ?></a></th>
199
  <th scope="col"><a href='
200
  <?php
201
+ echo add_query_arg(
202
+ array(
203
+ 'paged' => $current,
204
+ 'orderby' => 'city',
205
+ ),
206
+ admin_url( 'admin.php?page=my-calendar-location-manager' )
207
+ );
208
  ?>
209
  '><?php _e( 'City', 'my-calendar' ); ?></a></th>
210
  <th scope="col"><a href='
211
  <?php
212
+ echo add_query_arg(
213
+ array(
214
+ 'paged' => $current,
215
+ 'orderby' => 'state',
216
+ ),
217
+ admin_url( 'admin.php?page=my-calendar-location-manager' )
218
+ );
219
  ?>
220
  '><?php _e( 'State/Province', 'my-calendar' ); ?></a></th>
221
  <th scope="col"><?php _e( 'Edit', 'my-calendar' ); ?></th>
my-calendar-output.php CHANGED
@@ -846,31 +846,40 @@ function mc_time_toggle( $format, $time, $month, $year, $current, $start_of_week
846
  $url = mc_build_url( array( 'time' => 'month' ), array( 'mc_id' ) );
847
  $toggle .= "<a href='$url' class='month mcajax'>" . __( 'Month', 'my-calendar' ) . '</a>';
848
  $toggle .= "<span class='mc-active week'>" . __( 'Week', 'my-calendar' ) . '</span>';
849
- $url = mc_build_url( array(
850
- 'time' => 'day',
851
- 'dy' => $day,
852
- ), array( 'dy', 'mc_id' ) );
 
 
 
853
  $toggle .= "<a href='$url' class='day mcajax'>" . __( 'Day', 'my-calendar' ) . '</a>';
854
  break;
855
  case 'day':
856
  $url = mc_build_url( array( 'time' => 'month' ), array() );
857
  $toggle .= "<a href='$url' class='month mcajax'>" . __( 'Month', 'my-calendar' ) . '</a>';
858
- $url = mc_build_url( array(
859
- 'time' => 'week',
860
- 'dy' => $day,
861
- 'month' => $wmonth,
862
- 'yr' => $year,
863
- ), array( 'dy', 'month', 'mc_id' ) );
 
 
 
864
  $toggle .= "<a href='$url' class='week mcajax'>" . __( 'Week', 'my-calendar' ) . '</a>';
865
  $toggle .= "<span class='mc-active day'>" . __( 'Day', 'my-calendar' ) . '</span>';
866
  break;
867
  default:
868
  $toggle .= "<span class='mc-active month'>" . __( 'Month', 'my-calendar' ) . '</span>';
869
- $url = mc_build_url( array(
870
- 'time' => 'week',
871
- 'dy' => $day,
872
- 'month' => $wmonth,
873
- ), array( 'dy', 'month', 'mc_id' ) );
 
 
 
874
  $toggle .= "<a href='$url' class='week mcajax'>" . __( 'Week', 'my-calendar' ) . '</a>';
875
  $url = mc_build_url( array( 'time' => 'day' ), array() );
876
  $toggle .= "<a href='$url' class='day mcajax'>" . __( 'Day', 'my-calendar' ) . '</a>';
@@ -2059,11 +2068,15 @@ function mc_build_mini_url( $start, $category, $events, $args, $date ) {
2059
  $atype = str_replace( 'anchor', '', $open_day_uri ); // List or grid.
2060
  $ad = str_pad( date( 'j', $start ), 2, '0', STR_PAD_LEFT ); // Need to match format in ID.
2061
  $am = str_pad( $date['month'], 2, '0', STR_PAD_LEFT );
2062
- $date_url = mc_build_url( array(
2063
- 'yr' => $date['year'],
2064
- 'month' => $date['month'],
2065
- 'dy' => date( 'j', $start ),
2066
- ), array( 'month', 'dy', 'yr', 'ltype', 'loc', 'mcat', 'cid', 'mc_id' ), $mini_uri );
 
 
 
 
2067
  $link = esc_url( ( '' != $mini_uri ) ? $date_url . '#' . $atype . '-' . $date['year'] . '-' . $am . '-' . $ad : '#' );
2068
  }
2069
 
@@ -2103,18 +2116,24 @@ function mc_convert_format( $format, $params ) {
2103
  function mc_nav( $date, $format, $time, $show_months, $class ) {
2104
  $prev = my_calendar_prev_link( $date, $format, $time, $show_months );
2105
  $next = my_calendar_next_link( $date, $format, $time, $show_months );
2106
- $prev_link = mc_build_url( array(
2107
- 'yr' => $prev['yr'],
2108
- 'month' => $prev['month'],
2109
- 'dy' => $prev['day'],
2110
- 'cid' => $class,
2111
- ), array() );
2112
- $next_link = mc_build_url( array(
2113
- 'yr' => $next['yr'],
2114
- 'month' => $next['month'],
2115
- 'dy' => $next['day'],
2116
- 'cid' => $class,
2117
- ), array() );
 
 
 
 
 
 
2118
 
2119
  $prev_link = apply_filters( 'mc_previous_link', '<li class="my-calendar-prev"><a href="' . $prev_link . '" rel="nofollow" class="mcajax">' . $prev['label'] . '</a></li>', $prev );
2120
  $next_link = apply_filters( 'mc_next_link', '<li class="my-calendar-next"><a href="' . $next_link . '" rel="nofollow" class="mcajax">' . $next['label'] . '</a></li>', $next );
@@ -2964,10 +2983,13 @@ function my_calendar_locations_list( $show = 'list', $datatype = 'name', $group
2964
 
2965
  if ( count( $locations ) > 1 ) {
2966
  if ( 'list' == $show ) {
2967
- $url = mc_build_url( array(
2968
- 'loc' => 'all',
2969
- 'ltype' => 'all',
2970
- ), array() );
 
 
 
2971
  $output .= '<ul id="mc-locations-list">
2972
  <li class="mc-show-all"><a href="' . $url . '">' . __( 'Show all', 'my-calendar' ) . '</a></li>';
2973
  } else {
@@ -3006,10 +3028,15 @@ function my_calendar_locations_list( $show = 'list', $datatype = 'name', $group
3006
  $loc = ( empty( $_GET['loc'] ) ) ? '' : $_GET['loc'];
3007
  if ( 'list' == $show ) {
3008
  $selected = ( $vt == $loc ) ? ' class="selected"' : '';
3009
- $this_url = esc_url( mc_build_url( array(
3010
- 'loc' => $vt,
3011
- 'ltype' => $datatype,
3012
- ), array() ) );
 
 
 
 
 
3013
  $output .= " <li$selected><a rel='nofollow' href='$this_url'>$value</a></li>\n";
3014
  } else {
3015
  $selected = ( $vt == $loc ) ? ' class="selected"' : '';
846
  $url = mc_build_url( array( 'time' => 'month' ), array( 'mc_id' ) );
847
  $toggle .= "<a href='$url' class='month mcajax'>" . __( 'Month', 'my-calendar' ) . '</a>';
848
  $toggle .= "<span class='mc-active week'>" . __( 'Week', 'my-calendar' ) . '</span>';
849
+ $url = mc_build_url(
850
+ array(
851
+ 'time' => 'day',
852
+ 'dy' => $day,
853
+ ),
854
+ array( 'dy', 'mc_id' )
855
+ );
856
  $toggle .= "<a href='$url' class='day mcajax'>" . __( 'Day', 'my-calendar' ) . '</a>';
857
  break;
858
  case 'day':
859
  $url = mc_build_url( array( 'time' => 'month' ), array() );
860
  $toggle .= "<a href='$url' class='month mcajax'>" . __( 'Month', 'my-calendar' ) . '</a>';
861
+ $url = mc_build_url(
862
+ array(
863
+ 'time' => 'week',
864
+ 'dy' => $day,
865
+ 'month' => $wmonth,
866
+ 'yr' => $year,
867
+ ),
868
+ array( 'dy', 'month', 'mc_id' )
869
+ );
870
  $toggle .= "<a href='$url' class='week mcajax'>" . __( 'Week', 'my-calendar' ) . '</a>';
871
  $toggle .= "<span class='mc-active day'>" . __( 'Day', 'my-calendar' ) . '</span>';
872
  break;
873
  default:
874
  $toggle .= "<span class='mc-active month'>" . __( 'Month', 'my-calendar' ) . '</span>';
875
+ $url = mc_build_url(
876
+ array(
877
+ 'time' => 'week',
878
+ 'dy' => $day,
879
+ 'month' => $wmonth,
880
+ ),
881
+ array( 'dy', 'month', 'mc_id' )
882
+ );
883
  $toggle .= "<a href='$url' class='week mcajax'>" . __( 'Week', 'my-calendar' ) . '</a>';
884
  $url = mc_build_url( array( 'time' => 'day' ), array() );
885
  $toggle .= "<a href='$url' class='day mcajax'>" . __( 'Day', 'my-calendar' ) . '</a>';
2068
  $atype = str_replace( 'anchor', '', $open_day_uri ); // List or grid.
2069
  $ad = str_pad( date( 'j', $start ), 2, '0', STR_PAD_LEFT ); // Need to match format in ID.
2070
  $am = str_pad( $date['month'], 2, '0', STR_PAD_LEFT );
2071
+ $date_url = mc_build_url(
2072
+ array(
2073
+ 'yr' => $date['year'],
2074
+ 'month' => $date['month'],
2075
+ 'dy' => date( 'j', $start ),
2076
+ ),
2077
+ array( 'month', 'dy', 'yr', 'ltype', 'loc', 'mcat', 'cid', 'mc_id' ),
2078
+ $mini_uri
2079
+ );
2080
  $link = esc_url( ( '' != $mini_uri ) ? $date_url . '#' . $atype . '-' . $date['year'] . '-' . $am . '-' . $ad : '#' );
2081
  }
2082
 
2116
  function mc_nav( $date, $format, $time, $show_months, $class ) {
2117
  $prev = my_calendar_prev_link( $date, $format, $time, $show_months );
2118
  $next = my_calendar_next_link( $date, $format, $time, $show_months );
2119
+ $prev_link = mc_build_url(
2120
+ array(
2121
+ 'yr' => $prev['yr'],
2122
+ 'month' => $prev['month'],
2123
+ 'dy' => $prev['day'],
2124
+ 'cid' => $class,
2125
+ ),
2126
+ array()
2127
+ );
2128
+ $next_link = mc_build_url(
2129
+ array(
2130
+ 'yr' => $next['yr'],
2131
+ 'month' => $next['month'],
2132
+ 'dy' => $next['day'],
2133
+ 'cid' => $class,
2134
+ ),
2135
+ array()
2136
+ );
2137
 
2138
  $prev_link = apply_filters( 'mc_previous_link', '<li class="my-calendar-prev"><a href="' . $prev_link . '" rel="nofollow" class="mcajax">' . $prev['label'] . '</a></li>', $prev );
2139
  $next_link = apply_filters( 'mc_next_link', '<li class="my-calendar-next"><a href="' . $next_link . '" rel="nofollow" class="mcajax">' . $next['label'] . '</a></li>', $next );
2983
 
2984
  if ( count( $locations ) > 1 ) {
2985
  if ( 'list' == $show ) {
2986
+ $url = mc_build_url(
2987
+ array(
2988
+ 'loc' => 'all',
2989
+ 'ltype' => 'all',
2990
+ ),
2991
+ array()
2992
+ );
2993
  $output .= '<ul id="mc-locations-list">
2994
  <li class="mc-show-all"><a href="' . $url . '">' . __( 'Show all', 'my-calendar' ) . '</a></li>';
2995
  } else {
3028
  $loc = ( empty( $_GET['loc'] ) ) ? '' : $_GET['loc'];
3029
  if ( 'list' == $show ) {
3030
  $selected = ( $vt == $loc ) ? ' class="selected"' : '';
3031
+ $this_url = esc_url(
3032
+ mc_build_url(
3033
+ array(
3034
+ 'loc' => $vt,
3035
+ 'ltype' => $datatype,
3036
+ ),
3037
+ array()
3038
+ )
3039
+ );
3040
  $output .= " <li$selected><a rel='nofollow' href='$this_url'>$value</a></li>\n";
3041
  } else {
3042
  $selected = ( $vt == $loc ) ? ' class="selected"' : '';
my-calendar-settings.php CHANGED
@@ -490,10 +490,17 @@ function my_calendar_settings() {
490
  <li><?php mc_settings_field( 'mc_uri', __( 'Where is your main calendar page?', 'my-calendar' ), '', "$guess[message]", array( 'size' => '60' ), 'url' ); ?></li>
491
  <li>
492
  <?php
493
- mc_settings_field( 'mc_uri_id', __( 'Calendar Page ID?', 'my-calendar' ), '', "($page_title)", array(
494
- 'size' => '20',
495
- 'class' => 'suggest',
496
- ), 'text' );
 
 
 
 
 
 
 
497
  ?>
498
  </li>
499
  <?php
@@ -501,10 +508,17 @@ function my_calendar_settings() {
501
  ?>
502
  <li>
503
  <?php
504
- mc_settings_field( 'mc_uri_id', __( 'Where is your main calendar page?', 'my-calendar' ), '', "(<a href='$permalink'>$page_title</a>)", array(
505
- 'size' => '20',
506
- 'class' => 'suggest',
507
- ), 'text' );
 
 
 
 
 
 
 
508
  ?>
509
  </li>
510
  <?php
@@ -532,27 +546,48 @@ function mc_remote_db() {
532
  <li><?php mc_settings_field( 'mc_drop_tables', __( 'Drop MySQL tables on uninstall', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
533
  <li>
534
  <?php
535
- mc_settings_field( 'mc_default_sort', __( 'Default Sort order for Admin Events List', 'my-calendar' ), array(
536
- '1' => __( 'Event ID', 'my-calendar' ),
537
- '2' => __( 'Title', 'my-calendar' ),
538
- '3' => __( 'Description', 'my-calendar' ),
539
- '4' => __( 'Start Date', 'my-calendar' ),
540
- '5' => __( 'Author', 'my-calendar' ),
541
- '6' => __( 'Category', 'my-calendar' ),
542
- '7' => __( 'Location Name', 'my-calendar' ),
543
- ), '', array(), 'select' );
544
- mc_settings_field( 'mc_default_direction', __( 'Sort direction', 'my-calendar' ), array(
545
- 'ASC' => __( 'Ascending', 'my-calendar' ),
546
- 'DESC' => __( 'Descending', 'my-calendar' ),
547
- ), '', array(), 'select' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  ?>
549
  </li>
550
  <?php
551
  if ( get_site_option( 'mc_multisite' ) == 2 && my_calendar_table() != my_calendar_table( 'global' ) ) {
552
- mc_settings_field( 'mc_current_table', array(
553
- '0' => __( 'Currently editing my local calendar', 'my-calendar' ),
554
- '1' => __( 'Currently editing the network calendar', 'my-calendar' ),
555
- ), '0', '', array(), 'radio' );
 
 
 
 
 
 
 
556
  } else {
557
  if ( get_option( 'mc_remote' ) != 'true' && current_user_can( 'manage_network' ) && is_multisite() && is_main_site() ) {
558
  ?>
@@ -662,12 +697,19 @@ function mc_remote_db() {
662
  ?>
663
  <li>
664
  <?php
665
- mc_settings_field( 'mc_open_day_uri', __( 'Mini calendar widget date links to:', 'my-calendar' ), array(
666
- 'false' => __( 'jQuery pop-up view', 'my-calendar' ),
667
- 'true' => __( 'daily view page (above)', 'my-calendar' ),
668
- 'listanchor' => __( 'in-page anchor on main calendar page (list)', 'my-calendar' ),
669
- 'calendaranchor' => __( 'in-page anchor on main calendar page (grid)', 'my-calendar' ),
670
- ), '', $disabled, 'select' );
 
 
 
 
 
 
 
671
  ?>
672
  </li>
673
  </ul>
@@ -760,11 +802,18 @@ function mc_remote_db() {
760
  <li><?php mc_settings_field( 'mc_title', __( 'Include event title in details pop-up', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
761
  <li>
762
  <?php
763
- mc_settings_field( 'mc_convert', __( 'Mobile View', 'my-calendar' ), array(
764
- 'true' => __( 'Switch to list view', 'my-calendar' ),
765
- 'mini' => __( 'Switch to mini calendar', 'my-calendar' ),
766
- 'none' => __( 'No change', 'my-calendar' ),
767
- ), '', array(), 'select' );
 
 
 
 
 
 
 
768
  ?>
769
  </li>
770
  </ul>
@@ -813,20 +862,23 @@ function mc_remote_db() {
813
 
814
  // If input options isn't an array, assume that plugin wasn't upgraded, and reset to default.
815
  if ( ! is_array( $input_options ) ) {
816
- update_option( 'mc_input_options', array(
817
- 'event_location_dropdown' => 'on',
818
- 'event_short' => 'on',
819
- 'event_desc' => 'on',
820
- 'event_category' => 'on',
821
- 'event_image' => 'on',
822
- 'event_link' => 'on',
823
- 'event_recurs' => 'on',
824
- 'event_open' => 'on',
825
- 'event_location' => 'off',
826
- 'event_specials' => 'on',
827
- 'event_access' => 'on',
828
- 'event_host' => 'on',
829
- ) );
 
 
 
830
  $input_options = get_option( 'mc_input_options' );
831
  }
832
  foreach ( $input_options as $key => $value ) {
@@ -973,19 +1025,33 @@ function mc_remote_db() {
973
  <li><?php mc_settings_field( 'mc_event_mail_from', __( 'Notification messages are sent from:', 'my-calendar' ), get_bloginfo( 'admin_email' ) ); ?></li>
974
  <li>
975
  <?php
976
- mc_settings_field( 'mc_event_mail_bcc', __( 'BCC on notifications (one per line):', 'my-calendar' ), '', '', array(
977
- 'cols' => 60,
978
- 'rows' => 6,
979
- ), 'textarea' );
 
 
 
 
 
 
 
980
  ?>
981
  </li>
982
  <li><?php mc_settings_field( 'mc_event_mail_subject', __( 'Email subject', 'my-calendar' ), get_bloginfo( 'name' ) . ': ' . __( 'New event added', 'my-calendar' ), '', array( 'size' => 60 ) ); ?></li>
983
  <li>
984
  <?php
985
- mc_settings_field( 'mc_event_mail_message', __( 'Message Body', 'my-calendar' ), __( 'New Event:', 'my-calendar' ) . "\n{title}: {date}, {time} - {event_status}", "<br /><a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>', array(
986
- 'cols' => 60,
987
- 'rows' => 6,
988
- ), 'textarea' );
 
 
 
 
 
 
 
989
  ?>
990
  </li>
991
  </ul>
490
  <li><?php mc_settings_field( 'mc_uri', __( 'Where is your main calendar page?', 'my-calendar' ), '', "$guess[message]", array( 'size' => '60' ), 'url' ); ?></li>
491
  <li>
492
  <?php
493
+ mc_settings_field(
494
+ 'mc_uri_id',
495
+ __( 'Calendar Page ID?', 'my-calendar' ),
496
+ '',
497
+ "($page_title)",
498
+ array(
499
+ 'size' => '20',
500
+ 'class' => 'suggest',
501
+ ),
502
+ 'text'
503
+ );
504
  ?>
505
  </li>
506
  <?php
508
  ?>
509
  <li>
510
  <?php
511
+ mc_settings_field(
512
+ 'mc_uri_id',
513
+ __( 'Where is your main calendar page?', 'my-calendar' ),
514
+ '',
515
+ "(<a href='$permalink'>$page_title</a>)",
516
+ array(
517
+ 'size' => '20',
518
+ 'class' => 'suggest',
519
+ ),
520
+ 'text'
521
+ );
522
  ?>
523
  </li>
524
  <?php
546
  <li><?php mc_settings_field( 'mc_drop_tables', __( 'Drop MySQL tables on uninstall', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
547
  <li>
548
  <?php
549
+ mc_settings_field(
550
+ 'mc_default_sort',
551
+ __( 'Default Sort order for Admin Events List', 'my-calendar' ),
552
+ array(
553
+ '1' => __( 'Event ID', 'my-calendar' ),
554
+ '2' => __( 'Title', 'my-calendar' ),
555
+ '3' => __( 'Description', 'my-calendar' ),
556
+ '4' => __( 'Start Date', 'my-calendar' ),
557
+ '5' => __( 'Author', 'my-calendar' ),
558
+ '6' => __( 'Category', 'my-calendar' ),
559
+ '7' => __( 'Location Name', 'my-calendar' ),
560
+ ),
561
+ '',
562
+ array(),
563
+ 'select'
564
+ );
565
+ mc_settings_field(
566
+ 'mc_default_direction',
567
+ __( 'Sort direction', 'my-calendar' ),
568
+ array(
569
+ 'ASC' => __( 'Ascending', 'my-calendar' ),
570
+ 'DESC' => __( 'Descending', 'my-calendar' ),
571
+ ),
572
+ '',
573
+ array(),
574
+ 'select'
575
+ );
576
  ?>
577
  </li>
578
  <?php
579
  if ( get_site_option( 'mc_multisite' ) == 2 && my_calendar_table() != my_calendar_table( 'global' ) ) {
580
+ mc_settings_field(
581
+ 'mc_current_table',
582
+ array(
583
+ '0' => __( 'Currently editing my local calendar', 'my-calendar' ),
584
+ '1' => __( 'Currently editing the network calendar', 'my-calendar' ),
585
+ ),
586
+ '0',
587
+ '',
588
+ array(),
589
+ 'radio'
590
+ );
591
  } else {
592
  if ( get_option( 'mc_remote' ) != 'true' && current_user_can( 'manage_network' ) && is_multisite() && is_main_site() ) {
593
  ?>
697
  ?>
698
  <li>
699
  <?php
700
+ mc_settings_field(
701
+ 'mc_open_day_uri',
702
+ __( 'Mini calendar widget date links to:', 'my-calendar' ),
703
+ array(
704
+ 'false' => __( 'jQuery pop-up view', 'my-calendar' ),
705
+ 'true' => __( 'daily view page (above)', 'my-calendar' ),
706
+ 'listanchor' => __( 'in-page anchor on main calendar page (list)', 'my-calendar' ),
707
+ 'calendaranchor' => __( 'in-page anchor on main calendar page (grid)', 'my-calendar' ),
708
+ ),
709
+ '',
710
+ $disabled,
711
+ 'select'
712
+ );
713
  ?>
714
  </li>
715
  </ul>
802
  <li><?php mc_settings_field( 'mc_title', __( 'Include event title in details pop-up', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
803
  <li>
804
  <?php
805
+ mc_settings_field(
806
+ 'mc_convert',
807
+ __( 'Mobile View', 'my-calendar' ),
808
+ array(
809
+ 'true' => __( 'Switch to list view', 'my-calendar' ),
810
+ 'mini' => __( 'Switch to mini calendar', 'my-calendar' ),
811
+ 'none' => __( 'No change', 'my-calendar' ),
812
+ ),
813
+ '',
814
+ array(),
815
+ 'select'
816
+ );
817
  ?>
818
  </li>
819
  </ul>
862
 
863
  // If input options isn't an array, assume that plugin wasn't upgraded, and reset to default.
864
  if ( ! is_array( $input_options ) ) {
865
+ update_option(
866
+ 'mc_input_options',
867
+ array(
868
+ 'event_location_dropdown' => 'on',
869
+ 'event_short' => 'on',
870
+ 'event_desc' => 'on',
871
+ 'event_category' => 'on',
872
+ 'event_image' => 'on',
873
+ 'event_link' => 'on',
874
+ 'event_recurs' => 'on',
875
+ 'event_open' => 'on',
876
+ 'event_location' => 'off',
877
+ 'event_specials' => 'on',
878
+ 'event_access' => 'on',
879
+ 'event_host' => 'on',
880
+ )
881
+ );
882
  $input_options = get_option( 'mc_input_options' );
883
  }
884
  foreach ( $input_options as $key => $value ) {
1025
  <li><?php mc_settings_field( 'mc_event_mail_from', __( 'Notification messages are sent from:', 'my-calendar' ), get_bloginfo( 'admin_email' ) ); ?></li>
1026
  <li>
1027
  <?php
1028
+ mc_settings_field(
1029
+ 'mc_event_mail_bcc',
1030
+ __( 'BCC on notifications (one per line):', 'my-calendar' ),
1031
+ '',
1032
+ '',
1033
+ array(
1034
+ 'cols' => 60,
1035
+ 'rows' => 6,
1036
+ ),
1037
+ 'textarea'
1038
+ );
1039
  ?>
1040
  </li>
1041
  <li><?php mc_settings_field( 'mc_event_mail_subject', __( 'Email subject', 'my-calendar' ), get_bloginfo( 'name' ) . ': ' . __( 'New event added', 'my-calendar' ), '', array( 'size' => 60 ) ); ?></li>
1042
  <li>
1043
  <?php
1044
+ mc_settings_field(
1045
+ 'mc_event_mail_message',
1046
+ __( 'Message Body', 'my-calendar' ),
1047
+ __( 'New Event:', 'my-calendar' ) . "\n{title}: {date}, {time} - {event_status}",
1048
+ "<br /><a href='" . admin_url( 'admin.php?page=my-calendar-help#templates' ) . "'>" . __( 'Templating Help', 'my-calendar' ) . '</a>',
1049
+ array(
1050
+ 'cols' => 60,
1051
+ 'rows' => 6,
1052
+ ),
1053
+ 'textarea'
1054
+ );
1055
  ?>
1056
  </li>
1057
  </ul>
my-calendar-shortcodes.php CHANGED
@@ -22,25 +22,29 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  * @return string Calendar.
23
  */
24
  function my_calendar_insert( $atts, $content = null ) {
25
- $args = shortcode_atts( array(
26
- 'name' => 'all',
27
- 'format' => 'calendar',
28
- 'category' => 'all',
29
- 'time' => 'month',
30
- 'ltype' => '',
31
- 'lvalue' => '',
32
- 'author' => 'all',
33
- 'host' => 'all',
34
- 'id' => '',
35
- 'template' => '',
36
- 'above' => '',
37
- 'below' => '',
38
- 'year' => false,
39
- 'month' => false,
40
- 'day' => false,
41
- 'site' => false,
42
- 'months' => false,
43
- ), $atts, 'my_calendar' );
 
 
 
 
44
 
45
  if ( 'mini' != $args['format'] ) {
46
  if ( isset( $_GET['format'] ) ) {
@@ -66,24 +70,28 @@ function my_calendar_insert( $atts, $content = null ) {
66
  * @return string Calendar.
67
  */
68
  function my_calendar_insert_upcoming( $atts ) {
69
- $args = shortcode_atts( array(
70
- 'before' => 'default',
71
- 'after' => 'default',
72
- 'type' => 'default',
73
- 'category' => 'default',
74
- 'template' => 'default',
75
- 'fallback' => '',
76
- 'order' => 'asc',
77
- 'skip' => '0',
78
- 'show_today' => 'yes',
79
- 'author' => 'default',
80
- 'host' => 'default',
81
- 'ltype' => '',
82
- 'lvalue' => '',
83
- 'from' => false,
84
- 'to' => false,
85
- 'site' => false,
86
- ), $atts, 'my_calendar_upcoming' );
 
 
 
 
87
 
88
  global $user_ID;
89
  if ( 'current' == $args['author'] ) {
@@ -104,15 +112,19 @@ function my_calendar_insert_upcoming( $atts ) {
104
  * @return string Calendar.
105
  */
106
  function my_calendar_insert_today( $atts ) {
107
- $args = shortcode_atts( array(
108
- 'category' => 'default',
109
- 'author' => 'default',
110
- 'host' => 'default',
111
- 'template' => 'default',
112
- 'fallback' => '',
113
- 'date' => false,
114
- 'site' => false,
115
- ), $atts, 'my_calendar_today' );
 
 
 
 
116
 
117
  global $user_ID;
118
  if ( 'current' == $args['author'] ) {
@@ -133,10 +145,14 @@ function my_calendar_insert_today( $atts ) {
133
  * @return string locations.
134
  */
135
  function my_calendar_show_locations_list( $atts ) {
136
- $args = shortcode_atts( array(
137
- 'datatype' => 'name',
138
- 'template' => '',
139
- ), $atts, 'my_calendar_locations_list' );
 
 
 
 
140
 
141
  return my_calendar_show_locations( $args['datatype'], $args['template'] );
142
  }
@@ -149,11 +165,15 @@ function my_calendar_show_locations_list( $atts ) {
149
  * @return string location filter.
150
  */
151
  function my_calendar_locations( $atts ) {
152
- $args = shortcode_atts( array(
153
- 'show' => 'list',
154
- 'datatype' => 'name',
155
- 'target_url' => '',
156
- ), $atts, 'my_calendar_locations' );
 
 
 
 
157
 
158
  return my_calendar_locations_list( $args['show'], $args['datatype'], 'single', $args['target_url'] );
159
  }
@@ -166,10 +186,14 @@ function my_calendar_locations( $atts ) {
166
  * @return string category filter.
167
  */
168
  function my_calendar_categories( $atts ) {
169
- $args = shortcode_atts( array(
170
- 'show' => 'list',
171
- 'target_url' => '',
172
- ), $atts, 'my_calendar_categories' );
 
 
 
 
173
 
174
  return my_calendar_categories_list( $args['show'], 'public', 'single', $args['target_url'] );
175
  }
@@ -182,10 +206,14 @@ function my_calendar_categories( $atts ) {
182
  * @return string accessibility filters.
183
  */
184
  function my_calendar_access( $atts ) {
185
- $args = shortcode_atts( array(
186
- 'show' => 'list',
187
- 'target_url' => '',
188
- ), $atts, 'my_calendar_access' );
 
 
 
 
189
 
190
  return mc_access_list( $args['show'], 'single', $args['target_url'] );
191
  }
@@ -198,11 +226,15 @@ function my_calendar_access( $atts ) {
198
  * @return string filters.
199
  */
200
  function my_calendar_filters( $atts ) {
201
- $args = shortcode_atts( array(
202
- 'show' => 'categories,locations',
203
- 'target_url' => '',
204
- 'ltype' => 'name',
205
- ), $atts, 'my_calendar_filters' );
 
 
 
 
206
 
207
  return mc_filters( $args['show'], $args['target_url'], $args['ltype'] );
208
  }
@@ -215,14 +247,18 @@ function my_calendar_filters( $atts ) {
215
  * @return string event.
216
  */
217
  function my_calendar_show_event( $atts ) {
218
- $args = shortcode_atts( array(
219
- 'event' => '',
220
- 'template' => '<h3>{title}</h3>{description}',
221
- 'list' => '<li>{date}, {time}</li>',
222
- 'before' => '<ul>',
223
- 'after' => '</ul>',
224
- 'instance' => false,
225
- ), $atts, 'my_calendar_event' );
 
 
 
 
226
 
227
  return mc_instance_list( $args );
228
  }
@@ -235,10 +271,14 @@ function my_calendar_show_event( $atts ) {
235
  * @return string search form.
236
  */
237
  function my_calendar_search( $atts ) {
238
- $args = shortcode_atts( array(
239
- 'type' => 'simple',
240
- 'url' => '',
241
- ), $atts, 'my_calendar_search' );
 
 
 
 
242
 
243
  return my_calendar_searchform( $args['type'], $args['url'] );
244
  }
@@ -251,11 +291,15 @@ function my_calendar_search( $atts ) {
251
  * @return string event.
252
  */
253
  function my_calendar_now( $atts ) {
254
- $args = shortcode_atts( array(
255
- 'category' => '',
256
- 'template' => '<strong>{link_title}</strong> {timerange}',
257
- 'site' => false,
258
- ), $atts, 'my_calendar_now' );
 
 
 
 
259
 
260
  return my_calendar_events_now( $args['category'], $args['template'], $args['site'] );
261
  }
22
  * @return string Calendar.
23
  */
24
  function my_calendar_insert( $atts, $content = null ) {
25
+ $args = shortcode_atts(
26
+ array(
27
+ 'name' => 'all',
28
+ 'format' => 'calendar',
29
+ 'category' => 'all',
30
+ 'time' => 'month',
31
+ 'ltype' => '',
32
+ 'lvalue' => '',
33
+ 'author' => 'all',
34
+ 'host' => 'all',
35
+ 'id' => '',
36
+ 'template' => '',
37
+ 'above' => '',
38
+ 'below' => '',
39
+ 'year' => false,
40
+ 'month' => false,
41
+ 'day' => false,
42
+ 'site' => false,
43
+ 'months' => false,
44
+ ),
45
+ $atts,
46
+ 'my_calendar'
47
+ );
48
 
49
  if ( 'mini' != $args['format'] ) {
50
  if ( isset( $_GET['format'] ) ) {
70
  * @return string Calendar.
71
  */
72
  function my_calendar_insert_upcoming( $atts ) {
73
+ $args = shortcode_atts(
74
+ array(
75
+ 'before' => 'default',
76
+ 'after' => 'default',
77
+ 'type' => 'default',
78
+ 'category' => 'default',
79
+ 'template' => 'default',
80
+ 'fallback' => '',
81
+ 'order' => 'asc',
82
+ 'skip' => '0',
83
+ 'show_today' => 'yes',
84
+ 'author' => 'default',
85
+ 'host' => 'default',
86
+ 'ltype' => '',
87
+ 'lvalue' => '',
88
+ 'from' => false,
89
+ 'to' => false,
90
+ 'site' => false,
91
+ ),
92
+ $atts,
93
+ 'my_calendar_upcoming'
94
+ );
95
 
96
  global $user_ID;
97
  if ( 'current' == $args['author'] ) {
112
  * @return string Calendar.
113
  */
114
  function my_calendar_insert_today( $atts ) {
115
+ $args = shortcode_atts(
116
+ array(
117
+ 'category' => 'default',
118
+ 'author' => 'default',
119
+ 'host' => 'default',
120
+ 'template' => 'default',
121
+ 'fallback' => '',
122
+ 'date' => false,
123
+ 'site' => false,
124
+ ),
125
+ $atts,
126
+ 'my_calendar_today'
127
+ );
128
 
129
  global $user_ID;
130
  if ( 'current' == $args['author'] ) {
145
  * @return string locations.
146
  */
147
  function my_calendar_show_locations_list( $atts ) {
148
+ $args = shortcode_atts(
149
+ array(
150
+ 'datatype' => 'name',
151
+ 'template' => '',
152
+ ),
153
+ $atts,
154
+ 'my_calendar_locations_list'
155
+ );
156
 
157
  return my_calendar_show_locations( $args['datatype'], $args['template'] );
158
  }
165
  * @return string location filter.
166
  */
167
  function my_calendar_locations( $atts ) {
168
+ $args = shortcode_atts(
169
+ array(
170
+ 'show' => 'list',
171
+ 'datatype' => 'name',
172
+ 'target_url' => '',
173
+ ),
174
+ $atts,
175
+ 'my_calendar_locations'
176
+ );
177
 
178
  return my_calendar_locations_list( $args['show'], $args['datatype'], 'single', $args['target_url'] );
179
  }
186
  * @return string category filter.
187
  */
188
  function my_calendar_categories( $atts ) {
189
+ $args = shortcode_atts(
190
+ array(
191
+ 'show' => 'list',
192
+ 'target_url' => '',
193
+ ),
194
+ $atts,
195
+ 'my_calendar_categories'
196
+ );
197
 
198
  return my_calendar_categories_list( $args['show'], 'public', 'single', $args['target_url'] );
199
  }
206
  * @return string accessibility filters.
207
  */
208
  function my_calendar_access( $atts ) {
209
+ $args = shortcode_atts(
210
+ array(
211
+ 'show' => 'list',
212
+ 'target_url' => '',
213
+ ),
214
+ $atts,
215
+ 'my_calendar_access'
216
+ );
217
 
218
  return mc_access_list( $args['show'], 'single', $args['target_url'] );
219
  }
226
  * @return string filters.
227
  */
228
  function my_calendar_filters( $atts ) {
229
+ $args = shortcode_atts(
230
+ array(
231
+ 'show' => 'categories,locations',
232
+ 'target_url' => '',
233
+ 'ltype' => 'name',
234
+ ),
235
+ $atts,
236
+ 'my_calendar_filters'
237
+ );
238
 
239
  return mc_filters( $args['show'], $args['target_url'], $args['ltype'] );
240
  }
247
  * @return string event.
248
  */
249
  function my_calendar_show_event( $atts ) {
250
+ $args = shortcode_atts(
251
+ array(
252
+ 'event' => '',
253
+ 'template' => '<h3>{title}</h3>{description}',
254
+ 'list' => '<li>{date}, {time}</li>',
255
+ 'before' => '<ul>',
256
+ 'after' => '</ul>',
257
+ 'instance' => false,
258
+ ),
259
+ $atts,
260
+ 'my_calendar_event'
261
+ );
262
 
263
  return mc_instance_list( $args );
264
  }
271
  * @return string search form.
272
  */
273
  function my_calendar_search( $atts ) {
274
+ $args = shortcode_atts(
275
+ array(
276
+ 'type' => 'simple',
277
+ 'url' => '',
278
+ ),
279
+ $atts,
280
+ 'my_calendar_search'
281
+ );
282
 
283
  return my_calendar_searchform( $args['type'], $args['url'] );
284
  }
291
  * @return string event.
292
  */
293
  function my_calendar_now( $atts ) {
294
+ $args = shortcode_atts(
295
+ array(
296
+ 'category' => '',
297
+ 'template' => '<strong>{link_title}</strong> {timerange}',
298
+ 'site' => false,
299
+ ),
300
+ $atts,
301
+ 'my_calendar_now'
302
+ );
303
 
304
  return my_calendar_events_now( $args['category'], $args['template'], $args['site'] );
305
  }
my-calendar-styles.php CHANGED
@@ -226,11 +226,15 @@ function my_calendar_style_edit() {
226
  if ( $right_string ) { // If right string is blank, there is no default.
227
  if ( isset( $_GET['diff'] ) ) {
228
  echo '<div class="wrap my-calendar-admin" id="diff">';
229
- echo mc_text_diff( $left_string, $right_string, array(
230
- 'title' => __( 'Comparing Your Style with latest installed version of My Calendar', 'my-calendar' ),
231
- 'title_right' => __( 'Latest (from plugin)', 'my-calendar' ),
232
- 'title_left' => __( 'Current (in use)', 'my-calendar' ),
233
- ) );
 
 
 
 
234
  echo '</div>';
235
  } elseif ( trim( $left_string ) != trim( $right_string ) ) {
236
  echo '<div class="wrap my-calendar-admin">';
@@ -465,28 +469,31 @@ function mc_text_diff( $left_string, $right_string, $args = null ) {
465
  return $r;
466
  }
467
 
468
- add_action( 'admin_enqueue_scripts', function() {
469
- if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
470
- return;
471
- }
 
 
472
 
473
- if ( 'my-calendar_page_my-calendar-styles' !== get_current_screen()->id ) {
474
- return;
475
- }
476
 
477
- // Enqueue code editor and settings for manipulating HTML.
478
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
479
 
480
- // Bail if user disabled CodeMirror.
481
- if ( false === $settings ) {
482
- return;
483
- }
484
 
485
- wp_add_inline_script(
486
- 'code-editor',
487
- sprintf(
488
- 'jQuery( function() { wp.codeEditor.initialize( "style", %s ); } );',
489
- wp_json_encode( $settings )
490
- )
491
- );
492
- } );
 
226
  if ( $right_string ) { // If right string is blank, there is no default.
227
  if ( isset( $_GET['diff'] ) ) {
228
  echo '<div class="wrap my-calendar-admin" id="diff">';
229
+ echo mc_text_diff(
230
+ $left_string,
231
+ $right_string,
232
+ array(
233
+ 'title' => __( 'Comparing Your Style with latest installed version of My Calendar', 'my-calendar' ),
234
+ 'title_right' => __( 'Latest (from plugin)', 'my-calendar' ),
235
+ 'title_left' => __( 'Current (in use)', 'my-calendar' ),
236
+ )
237
+ );
238
  echo '</div>';
239
  } elseif ( trim( $left_string ) != trim( $right_string ) ) {
240
  echo '<div class="wrap my-calendar-admin">';
469
  return $r;
470
  }
471
 
472
+ add_action(
473
+ 'admin_enqueue_scripts',
474
+ function() {
475
+ if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
476
+ return;
477
+ }
478
 
479
+ if ( 'my-calendar_page_my-calendar-styles' !== get_current_screen()->id ) {
480
+ return;
481
+ }
482
 
483
+ // Enqueue code editor and settings for manipulating HTML.
484
+ $settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
485
 
486
+ // Bail if user disabled CodeMirror.
487
+ if ( false === $settings ) {
488
+ return;
489
+ }
490
 
491
+ wp_add_inline_script(
492
+ 'code-editor',
493
+ sprintf(
494
+ 'jQuery( function() { wp.codeEditor.initialize( "style", %s ); } );',
495
+ wp_json_encode( $settings )
496
+ )
497
+ );
498
+ }
499
+ );
my-calendar-templates.php CHANGED
@@ -514,16 +514,20 @@ function mc_create_tags( $event, $context = 'filters' ) {
514
  $e['ical_desc'] = $strip_desc;
515
  $e['ical_start'] = $dtstart;
516
  $e['ical_end'] = ( mc_is_all_day( $event ) ) ? date( 'Ymd\THi00', strtotime( $dtend ) + 60 ) : $dtend;
517
- $ical_link = mc_build_url( array( 'vcal' => $event->occur_id ), array(
518
- 'month',
519
- 'dy',
520
- 'yr',
521
- 'ltype',
522
- 'loc',
523
- 'mcat',
524
- 'format',
525
- 'time',
526
- ), mc_get_uri( $event ) );
 
 
 
 
527
  $e['ical'] = $ical_link;
528
  $e['ical_html'] = "<a class='ical' rel='nofollow' href='$ical_link' aria-describedby='mc_$event->occur_id-title'>" . __( 'iCal', 'my-calendar' ) . '</a>';
529
  $e = apply_filters( 'mc_filter_shortcodes', $e, $event );
@@ -573,23 +577,27 @@ function mc_get_details_link( $event ) {
573
  $details_link = add_query_arg( 'mc_id', $event->occur_id, get_permalink( $event->event_post ) );
574
  } else {
575
  if ( mc_get_uri( 'boolean' ) ) {
576
- $details_link = mc_build_url( array( 'mc_id' => $event->occur_id ), array(
577
- 'month',
578
- 'dy',
579
- 'yr',
580
- 'ltype',
581
- 'loc',
582
- 'mcat',
583
- 'format',
584
- 'feed',
585
- 'page_id',
586
- 'p',
587
- 'mcs',
588
- 'time',
589
- 'page',
590
- 'mode',
591
- 'event_id',
592
- ), $uri );
 
 
 
 
593
  }
594
  }
595
 
@@ -646,15 +654,18 @@ function mc_get_uri( $event = false, $args = array() ) {
646
  function mc_get_details_label( $event, $e ) {
647
  $templates = get_option( 'mc_templates' );
648
  $e_template = ( ! empty( $templates['label'] ) ) ? stripcslashes( $templates['label'] ) : __( 'Read more', 'my-calendar' );
649
- $e_label = wp_kses( mc_draw_template( $e, $e_template ), array(
650
- 'span' => array(
651
- 'class' => array(
652
- 'screen-reader-text',
 
 
 
653
  ),
654
- ),
655
- 'em',
656
- 'strong',
657
- ) );
658
 
659
  return $e_label;
660
  }
514
  $e['ical_desc'] = $strip_desc;
515
  $e['ical_start'] = $dtstart;
516
  $e['ical_end'] = ( mc_is_all_day( $event ) ) ? date( 'Ymd\THi00', strtotime( $dtend ) + 60 ) : $dtend;
517
+ $ical_link = mc_build_url(
518
+ array( 'vcal' => $event->occur_id ),
519
+ array(
520
+ 'month',
521
+ 'dy',
522
+ 'yr',
523
+ 'ltype',
524
+ 'loc',
525
+ 'mcat',
526
+ 'format',
527
+ 'time',
528
+ ),
529
+ mc_get_uri( $event )
530
+ );
531
  $e['ical'] = $ical_link;
532
  $e['ical_html'] = "<a class='ical' rel='nofollow' href='$ical_link' aria-describedby='mc_$event->occur_id-title'>" . __( 'iCal', 'my-calendar' ) . '</a>';
533
  $e = apply_filters( 'mc_filter_shortcodes', $e, $event );
577
  $details_link = add_query_arg( 'mc_id', $event->occur_id, get_permalink( $event->event_post ) );
578
  } else {
579
  if ( mc_get_uri( 'boolean' ) ) {
580
+ $details_link = mc_build_url(
581
+ array( 'mc_id' => $event->occur_id ),
582
+ array(
583
+ 'month',
584
+ 'dy',
585
+ 'yr',
586
+ 'ltype',
587
+ 'loc',
588
+ 'mcat',
589
+ 'format',
590
+ 'feed',
591
+ 'page_id',
592
+ 'p',
593
+ 'mcs',
594
+ 'time',
595
+ 'page',
596
+ 'mode',
597
+ 'event_id',
598
+ ),
599
+ $uri
600
+ );
601
  }
602
  }
603
 
654
  function mc_get_details_label( $event, $e ) {
655
  $templates = get_option( 'mc_templates' );
656
  $e_template = ( ! empty( $templates['label'] ) ) ? stripcslashes( $templates['label'] ) : __( 'Read more', 'my-calendar' );
657
+ $e_label = wp_kses(
658
+ mc_draw_template( $e, $e_template ),
659
+ array(
660
+ 'span' => array(
661
+ 'class' => array(
662
+ 'screen-reader-text',
663
+ ),
664
  ),
665
+ 'em',
666
+ 'strong',
667
+ )
668
+ );
669
 
670
  return $e_label;
671
  }
my-calendar-templating.php CHANGED
@@ -451,28 +451,31 @@ function mc_list_templates() {
451
  echo $list;
452
  }
453
 
454
- add_action( 'admin_enqueue_scripts', function() {
455
- if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
456
- return;
457
- }
 
 
458
 
459
- if ( 'my-calendar_page_my-calendar-templates' !== get_current_screen()->id ) {
460
- return;
461
- }
462
 
463
- // Enqueue code editor and settings for manipulating HTML.
464
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
465
 
466
- // Bail if user disabled CodeMirror.
467
- if ( false === $settings ) {
468
- return;
469
- }
470
 
471
- wp_add_inline_script(
472
- 'code-editor',
473
- sprintf(
474
- 'jQuery( function() { wp.codeEditor.initialize( "mc_template", %s ); } );',
475
- wp_json_encode( $settings )
476
- )
477
- );
478
- } );
 
451
  echo $list;
452
  }
453
 
454
+ add_action(
455
+ 'admin_enqueue_scripts',
456
+ function() {
457
+ if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
458
+ return;
459
+ }
460
 
461
+ if ( 'my-calendar_page_my-calendar-templates' !== get_current_screen()->id ) {
462
+ return;
463
+ }
464
 
465
+ // Enqueue code editor and settings for manipulating HTML.
466
+ $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
467
 
468
+ // Bail if user disabled CodeMirror.
469
+ if ( false === $settings ) {
470
+ return;
471
+ }
472
 
473
+ wp_add_inline_script(
474
+ 'code-editor',
475
+ sprintf(
476
+ 'jQuery( function() { wp.codeEditor.initialize( "mc_template", %s ); } );',
477
+ wp_json_encode( $settings )
478
+ )
479
+ );
480
+ }
481
+ );
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.0.17
21
  */
22
 
23
  /*
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  }
43
 
44
  global $mc_version, $wpdb;
45
- $mc_version = '3.0.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.0.18
21
  */
22
 
23
  /*
42
  }
43
 
44
  global $mc_version, $wpdb;
45
+ $mc_version = '3.0.18';
46
 
47
  define( 'MC_DEBUG', false );
48
 
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: 4.9
7
  Requires PHP: 5.3
8
- Stable tag: 3.0.17
9
  Text domain: my-calendar
10
  License: GPLv2 or later
11
 
@@ -85,6 +85,12 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
85
 
86
  TODO: Support limiting views to multiple locations
87
 
 
 
 
 
 
 
88
  = 3.0.17 =
89
 
90
  * Bug fix: Group event editing was broken.
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
  Requires PHP: 5.3
8
+ Stable tag: 3.0.18
9
  Text domain: my-calendar
10
  License: GPLv2 or later
11
 
85
 
86
  TODO: Support limiting views to multiple locations
87
 
88
+ = 3.0.18 =
89
+
90
+ * Bug fix: Invalid setting in bottom nav defaults.
91
+ * Bug fix: Generate feeds by date added rather than fixed number. If empty, get most recent regardless.
92
+ * Bug fix: Legitimate HTML escaped in visual editor in group event editor.
93
+
94
  = 3.0.17 =
95
 
96
  * Bug fix: Group event editing was broken.