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 | 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 +54 -36
- my-calendar-categories.php +20 -10
- my-calendar-core.php +138 -93
- my-calendar-event-manager.php +78 -53
- my-calendar-events.php +52 -33
- my-calendar-group-manager.php +12 -10
- my-calendar-install.php +122 -97
- my-calendar-location-manager.php +39 -25
- my-calendar-output.php +67 -40
- my-calendar-settings.php +124 -58
- my-calendar-shortcodes.php +129 -85
- my-calendar-styles.php +33 -26
- my-calendar-templates.php +46 -35
- my-calendar-templating.php +24 -21
- my-calendar.php +2 -2
- readme.txt +7 -1
includes/kses.php
CHANGED
@@ -64,49 +64,67 @@ function mc_allowed_tags( $tags, $context ) {
|
|
64 |
'class' => true,
|
65 |
);
|
66 |
|
67 |
-
$tags['span'] = array_merge(
|
68 |
-
'
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
72 |
|
73 |
-
$tags['button'] = array_merge(
|
74 |
-
'
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
79 |
|
80 |
-
$tags['form'] = array_merge(
|
81 |
-
'
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
87 |
|
88 |
-
$tags['div'] = array_merge(
|
89 |
-
'
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
93 |
|
94 |
$tags['fieldset'] = array_merge( $tags['fieldset'], array() );
|
95 |
$tags['legend'] = array_merge( $tags['legend'], array() );
|
96 |
-
$tags['p'] = array_merge(
|
97 |
-
'
|
98 |
-
|
|
|
|
|
|
|
99 |
|
100 |
-
$tags['img'] = array_merge(
|
101 |
-
'
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
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(
|
510 |
-
'
|
511 |
-
|
512 |
-
|
513 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
778 |
-
|
779 |
-
|
780 |
-
|
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(
|
711 |
-
'
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
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(
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1014 |
$sweek = absint( get_option( 'start_of_week' ) );
|
1015 |
-
wp_localize_script(
|
1016 |
-
'
|
1017 |
-
|
1018 |
-
|
1019 |
-
'
|
1020 |
-
|
1021 |
-
|
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(
|
1047 |
-
'
|
1048 |
-
'
|
1049 |
-
|
1050 |
-
|
|
|
|
|
|
|
|
|
1051 |
}
|
1052 |
}
|
1053 |
|
1054 |
if ( 'my-calendar_page_my-calendar-config' == $id ) {
|
1055 |
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
1056 |
-
wp_enqueue_script(
|
1057 |
-
'
|
1058 |
-
'jquery
|
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(
|
1078 |
-
|
1079 |
-
|
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(
|
1104 |
-
|
1105 |
-
|
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(
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
|
|
|
|
1120 |
} else {
|
1121 |
-
wp_send_json(
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
|
|
|
|
1125 |
}
|
1126 |
} else {
|
1127 |
-
wp_send_json(
|
1128 |
-
|
1129 |
-
|
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(
|
1141 |
-
|
1142 |
-
|
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(
|
1151 |
-
|
1152 |
-
|
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(
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
|
|
|
|
1184 |
} else {
|
1185 |
-
wp_send_json(
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
|
|
|
|
1189 |
}
|
1190 |
} else {
|
1191 |
-
wp_send_json(
|
1192 |
-
|
1193 |
-
|
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(
|
1252 |
-
|
1253 |
-
|
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(
|
201 |
-
|
202 |
-
|
203 |
-
|
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(
|
769 |
-
|
770 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
826 |
-
|
827 |
-
|
828 |
-
|
|
|
|
|
|
|
|
|
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(
|
850 |
-
|
851 |
-
|
852 |
-
|
|
|
|
|
|
|
|
|
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(
|
1776 |
-
'
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
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(
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
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(
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
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(
|
3996 |
-
|
3997 |
-
|
3998 |
-
|
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' => __( '« Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
|
2086 |
+
'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> »', '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' => __( '« Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
|
2397 |
+
'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> »', '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(
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
|
|
225 |
}
|
226 |
// Events happening today.
|
227 |
if ( 'yes' == $today ) {
|
228 |
-
$events3 = $mcdb->get_results(
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
238 |
}
|
239 |
// Upcoming Events.
|
240 |
if ( $after > 0 ) {
|
241 |
$after = $after + 15;
|
242 |
-
$events2 = $mcdb->get_results(
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
|
|
|
|
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( '
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
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(
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
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' => __( '« Previous<span class="screen-reader-text"> Events</span>', 'my-calendar' ),
|
1023 |
+
'next_text' => __( 'Next<span class="screen-reader-text"> Events</span> »', '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(
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
<
|
90 |
-
<
|
91 |
-
|
92 |
-
<
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
<
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
249 |
-
'
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
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(
|
274 |
-
'
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
285 |
add_option( 'mc_skip_holidays', 'false' );
|
286 |
add_option( 'mc_css_file', 'twentyeighteen.css' );
|
287 |
-
add_option(
|
288 |
-
'
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
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,
|
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(
|
342 |
-
|
343 |
-
|
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(
|
549 |
-
|
550 |
-
|
551 |
-
|
|
|
|
|
|
|
|
|
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} • {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(
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
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(
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
181 |
?>
|
182 |
'><?php _e( 'ID', 'my-calendar' ); ?></a></th>
|
183 |
<th scope="col"><a href='
|
184 |
<?php
|
185 |
-
echo add_query_arg(
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
189 |
?>
|
190 |
'><?php _e( 'Location', 'my-calendar' ); ?></a></th>
|
191 |
<th scope="col"><a href='
|
192 |
<?php
|
193 |
-
echo add_query_arg(
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
197 |
?>
|
198 |
'><?php _e( 'City', 'my-calendar' ); ?></a></th>
|
199 |
<th scope="col"><a href='
|
200 |
<?php
|
201 |
-
echo add_query_arg(
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
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' => __( '« Previous<span class="screen-reader-text"> Locations</span>', 'my-calendar' ),
|
146 |
+
'next_text' => __( 'Next<span class="screen-reader-text"> Locations</span> »', '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(
|
850 |
-
|
851 |
-
|
852 |
-
|
|
|
|
|
|
|
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(
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
|
|
|
|
|
|
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(
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
|
|
|
|
|
|
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(
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
|
|
|
|
|
|
|
|
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(
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
|
|
|
|
|
|
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(
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
|
|
|
|
|
|
|
|
|
|
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(
|
494 |
-
'
|
495 |
-
'
|
496 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
?>
|
498 |
</li>
|
499 |
<?php
|
@@ -501,10 +508,17 @@ function my_calendar_settings() {
|
|
501 |
?>
|
502 |
<li>
|
503 |
<?php
|
504 |
-
mc_settings_field(
|
505 |
-
'
|
506 |
-
'
|
507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
536 |
-
'
|
537 |
-
'
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
?>
|
549 |
</li>
|
550 |
<?php
|
551 |
if ( get_site_option( 'mc_multisite' ) == 2 && my_calendar_table() != my_calendar_table( 'global' ) ) {
|
552 |
-
mc_settings_field(
|
553 |
-
'
|
554 |
-
|
555 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
666 |
-
'
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
764 |
-
'
|
765 |
-
|
766 |
-
|
767 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
817 |
-
'
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
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(
|
977 |
-
'
|
978 |
-
'
|
979 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
986 |
-
'
|
987 |
-
'
|
988 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
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(
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
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(
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
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(
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
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(
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
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(
|
170 |
-
|
171 |
-
|
172 |
-
|
|
|
|
|
|
|
|
|
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(
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
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(
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
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(
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
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(
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
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(
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
|
|
|
|
|
|
|
|
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(
|
230 |
-
|
231 |
-
|
232 |
-
|
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(
|
469 |
-
|
470 |
-
|
471 |
-
|
|
|
|
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
|
477 |
-
|
478 |
-
|
479 |
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
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(
|
518 |
-
'
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
|
|
|
|
|
|
|
|
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(
|
577 |
-
'
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
|
|
|
|
|
|
|
|
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(
|
650 |
-
|
651 |
-
|
652 |
-
|
|
|
|
|
|
|
653 |
),
|
654 |
-
|
655 |
-
|
656 |
-
|
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(
|
455 |
-
|
456 |
-
|
457 |
-
|
|
|
|
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
|
463 |
-
|
464 |
-
|
465 |
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
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.
|
21 |
*/
|
22 |
|
23 |
/*
|
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
42 |
}
|
43 |
|
44 |
global $mc_version, $wpdb;
|
45 |
-
$mc_version = '3.0.
|
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.
|
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.
|