Version Description
- Bug fixes: Misc. type casting issues.
- Add filters
mc_filter_events
to filter results of main event queries. - Add $args array to
mc_searched_events
filter parameters. - Avoid running My Calendar core functionality through My Calendar's own hooks.
- When using REST API, variables are not submitted in a POST query.
- [Performance] Move custom location query into object creation to reduce DB calls.
- Use try/catch in mc-ajax.js to handle case where href does not contain a full URL.
- Autocomplete support for locations in admin.
- Reset select elements in My Calendar nav to inline.
- Minor refactoring in settings pages.
Download this release
Release Info
Developer | joedolson |
Plugin | My Calendar |
Version | 3.2.14 |
Comparing to | |
See all releases |
Code changes from version 3.2.13 to 3.2.14
- css/mc-admin.css +1 -1
- css/mc-styles.css +7 -1
- css/reset.css +5 -0
- js/accessible-autocomplete.min.js +1 -0
- js/jquery.admin.js +6 -5
- js/locations-autocomplete.js +34 -0
- js/mc-ajax.js +12 -6
- js/mc-grid.js +4 -4
- js/mc-list.js +1 -1
- js/mc-mini.js +1 -1
- my-calendar-categories.php +3 -1
- my-calendar-core.php +16 -3
- my-calendar-event-manager.php +92 -50
- my-calendar-events.php +16 -6
- my-calendar-group-manager.php +1 -0
- my-calendar-locations.php +61 -15
- my-calendar-output.php +3 -4
- my-calendar-settings.php +254 -218
- my-calendar-templates.php +1 -1
- my-calendar-widgets.php +2 -2
- my-calendar.php +4 -4
- readme.txt +14 -1
css/mc-admin.css
CHANGED
@@ -15,4 +15,4 @@
|
|
15 |
|
16 |
.mc-main .mc_edit_links a {
|
17 |
display: inline !important;
|
18 |
-
}
|
15 |
|
16 |
.mc-main .mc_edit_links a {
|
17 |
display: inline !important;
|
18 |
+
}
|
css/mc-styles.css
CHANGED
@@ -435,7 +435,7 @@ strong.label {
|
|
435 |
padding: 12px;
|
436 |
}
|
437 |
|
438 |
-
.js .wptab
|
439 |
display: none;
|
440 |
}
|
441 |
|
@@ -830,6 +830,12 @@ tr.problem .error {
|
|
830 |
clear: both;
|
831 |
}
|
832 |
|
|
|
|
|
|
|
|
|
|
|
|
|
833 |
@media (max-width: 1140px) {
|
834 |
.mc-locations .locations-container input {
|
835 |
max-width: 70%;
|
435 |
padding: 12px;
|
436 |
}
|
437 |
|
438 |
+
.js .wptab[aria-hidden=true], .wptab.initial-hidden {
|
439 |
display: none;
|
440 |
}
|
441 |
|
830 |
clear: both;
|
831 |
}
|
832 |
|
833 |
+
|
834 |
+
/**
|
835 |
+
* Autocomplete CSS
|
836 |
+
*/
|
837 |
+
.autocomplete-input{position:relative;flex:1; width: 100%;font-size:1.1em}.autocomplete-input:focus,.autocomplete-input[aria-expanded=true]{border-color:rgba(0,0,0,.12);background-color:#fff;outline:none;box-shadow:0 2px 2px rgba(0,0,0,.16)}[data-position=below] .autocomplete-input[aria-expanded=true]{border-bottom-color:transparent;}[data-position=above] .autocomplete-input[aria-expanded=true]{border-top-color:transparent;z-index:2}.autocomplete[data-loading=true]:after{content:"";border:3px solid rgba(0,0,0,.12);border-right-color:rgba(0,0,0,.48);border-radius:100%;width:20px;height:20px;position:absolute;right:12px;top:50%;transform:translateY(-50%);animation:rotate 1s linear infinite}.autocomplete-result-list{margin:0;border:1px solid rgba(0,0,0,.12);padding:0;box-sizing:border-box;max-height:296px;overflow-y:auto;background:#fff;list-style:none;}[data-position=below] .autocomplete-result-list{margin-top:-1px;border-top-color:transparent}[data-position=above] .autocomplete-result-list{margin-bottom:-1px;border-bottom-color:transparent}.autocomplete-result-list li{margin:0}.autocomplete-result{cursor:default;padding:12px;background-repeat:no-repeat;background-position:12px}.autocomplete-result:hover,.autocomplete-result[aria-selected=true]{background-color:rgba(0,0,0,.06)}@keyframes rotate{0%{transform:translateY(-50%) rotate(0deg)}to{transform:translateY(-50%) rotate(359deg)}}
|
838 |
+
|
839 |
@media (max-width: 1140px) {
|
840 |
.mc-locations .locations-container input {
|
841 |
max-width: 70%;
|
css/reset.css
CHANGED
@@ -21,6 +21,11 @@ div.site-content, table {
|
|
21 |
display: block;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
.mc-main h2:before {
|
25 |
display: none;
|
26 |
}
|
21 |
display: block;
|
22 |
}
|
23 |
|
24 |
+
.mc-main .my-calendar-header select,
|
25 |
+
.mc-main .mc-footer select {
|
26 |
+
display: inline;
|
27 |
+
}
|
28 |
+
|
29 |
.mc-main h2:before {
|
30 |
display: none;
|
31 |
}
|
js/accessible-autocomplete.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var Autocomplete=function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var i=function(t,e){return t.matches?t.matches(e):t.msMatchesSelector?t.msMatchesSelector(e):t.webkitMatchesSelector?t.webkitMatchesSelector(e):null},s=function(t,e){return t.closest?t.closest(e):function(t,e){for(var n=t;n&&1===n.nodeType;){if(i(n,e))return n;n=n.parentNode}return null}(t,e)},o=function(t){return Boolean(t&&"function"==typeof t.then)},u=function e(){var i=this,u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=u.search,l=u.autoSelect,r=void 0!==l&&l,d=u.setValue,c=void 0===d?function(){}:d,h=u.setAttribute,p=void 0===h?function(){}:h,f=u.onUpdate,b=void 0===f?function(){}:f,v=u.onSubmit,g=void 0===v?function(){}:v,L=u.onShow,y=void 0===L?function(){}:L,w=u.onHide,m=void 0===w?function(){}:w,S=u.onLoading,x=void 0===S?function(){}:S,R=u.onLoaded,A=void 0===R?function(){}:R;t(this,e),n(this,"value",""),n(this,"searchCounter",0),n(this,"results",[]),n(this,"selectedIndex",-1),n(this,"handleInput",(function(t){var e=t.target.value;i.updateResults(e),i.value=e})),n(this,"handleKeyDown",(function(t){var e=t.key;switch(e){case"Up":case"Down":case"ArrowUp":case"ArrowDown":var n="ArrowUp"===e||"Up"===e?i.selectedIndex-1:i.selectedIndex+1;t.preventDefault(),i.handleArrows(n);break;case"Tab":i.selectResult();break;case"Enter":var s=i.results[i.selectedIndex];i.selectResult(),i.onSubmit(s);break;case"Esc":case"Escape":i.hideResults(),i.setValue();break;default:return}})),n(this,"handleFocus",(function(t){var e=t.target.value;i.updateResults(e),i.value=e})),n(this,"handleBlur",(function(){i.hideResults()})),n(this,"handleResultMouseDown",(function(t){t.preventDefault()})),n(this,"handleResultClick",(function(t){var e=t.target,n=s(e,"[data-result-index]");if(n){i.selectedIndex=parseInt(n.dataset.resultIndex,10);var o=i.results[i.selectedIndex];i.selectResult(),i.onSubmit(o)}})),n(this,"handleArrows",(function(t){var e=i.results.length;i.selectedIndex=(t%e+e)%e,i.onUpdate(i.results,i.selectedIndex)})),n(this,"selectResult",(function(){var t=i.results[i.selectedIndex];t&&i.setValue(t),i.hideResults()})),n(this,"updateResults",(function(t){var e=++i.searchCounter;i.onLoading(),i.search(t).then((function(t){e===i.searchCounter&&(i.results=t,i.onLoaded(),0!==i.results.length?(i.selectedIndex=i.autoSelect?0:-1,i.onUpdate(i.results,i.selectedIndex),i.showResults()):i.hideResults())}))})),n(this,"showResults",(function(){i.setAttribute("aria-expanded",!0),i.onShow()})),n(this,"hideResults",(function(){i.selectedIndex=-1,i.results=[],i.setAttribute("aria-expanded",!1),i.setAttribute("aria-activedescendant",""),i.onUpdate(i.results,i.selectedIndex),i.onHide()})),n(this,"checkSelectedResultVisible",(function(t){var e=t.querySelector('[data-result-index="'.concat(i.selectedIndex,'"]'));if(e){var n=t.getBoundingClientRect(),s=e.getBoundingClientRect();s.top<n.top?t.scrollTop-=n.top-s.top:s.bottom>n.bottom&&(t.scrollTop+=s.bottom-n.bottom)}})),this.search=o(a)?a:function(t){return Promise.resolve(a(t))},this.autoSelect=r,this.setValue=c,this.setAttribute=p,this.onUpdate=b,this.onSubmit=g,this.onShow=y,this.onHide=m,this.onLoading=x,this.onLoaded=A},a=0,l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(t).concat(++a)},r=function(t,e){var n=t.getBoundingClientRect(),i=e.getBoundingClientRect();return n.bottom+i.height>window.innerHeight&&window.innerHeight-n.bottom<n.top&&window.pageYOffset+n.top-i.height>0?"above":"below"},d=function(t,e,n){var i;return function(){var s=this,o=arguments,u=function(){i=null,n||t.apply(s,o)},a=n&&!i;clearTimeout(i),i=setTimeout(u,e),a&&t.apply(s,o)}},c=function(){function n(e,i,s){t(this,n),this.id="".concat(s,"-result-").concat(e),this.class="".concat(s,"-result"),this["data-result-index"]=e,this.role="option",e===i&&(this["aria-selected"]="true")}var i,s,o;return i=n,(s=[{key:"toString",value:function(){var t=this;return Object.keys(this).reduce((function(e,n){return"".concat(e," ").concat(n,'="').concat(t[n],'"')}),"")}}])&&e(i.prototype,s),o&&e(i,o),n}();return function e(i){var s=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.search,h=o.onSubmit,p=void 0===h?function(){}:h,f=o.onUpdate,b=void 0===f?function(){}:f,v=o.baseClass,g=void 0===v?"autocomplete":v,L=o.autoSelect,y=o.getResultValue,w=void 0===y?function(t){return t}:y,m=o.renderResult,S=o.debounceTime,x=void 0===S?0:S;t(this,e),n(this,"expanded",!1),n(this,"loading",!1),n(this,"position",{}),n(this,"resetPosition",!0),n(this,"initialize",(function(){s.root.style.position="relative",s.input.setAttribute("role","combobox"),s.input.setAttribute("autocomplete","off"),s.input.setAttribute("autocapitalize","off"),s.input.setAttribute("autocorrect","off"),s.input.setAttribute("spellcheck","false"),s.input.setAttribute("aria-autocomplete","list"),s.input.setAttribute("aria-haspopup","listbox"),s.input.setAttribute("aria-expanded","false"),s.resultList.setAttribute("role","listbox"),s.resultList.style.position="absolute",s.resultList.style.zIndex="1",s.resultList.style.width="100%",s.resultList.style.boxSizing="border-box",s.resultList.id||(s.resultList.id=l("".concat(s.baseClass,"-result-list-"))),s.input.setAttribute("aria-owns",s.resultList.id),document.body.addEventListener("click",s.handleDocumentClick),s.input.addEventListener("input",s.core.handleInput),s.input.addEventListener("keydown",s.core.handleKeyDown),s.input.addEventListener("focus",s.core.handleFocus),s.input.addEventListener("blur",s.core.handleBlur),s.resultList.addEventListener("mousedown",s.core.handleResultMouseDown),s.resultList.addEventListener("click",s.core.handleResultClick),s.updateStyle()})),n(this,"setAttribute",(function(t,e){s.input.setAttribute(t,e)})),n(this,"setValue",(function(t){s.input.value=t?s.getResultValue(t):""})),n(this,"renderResult",(function(t,e){return"<li ".concat(e,">").concat(s.getResultValue(t),"</li>")})),n(this,"handleUpdate",(function(t,e){s.resultList.innerHTML="",t.forEach((function(t,n){var i=new c(n,e,s.baseClass),o=s.renderResult(t,i);"string"==typeof o?s.resultList.insertAdjacentHTML("beforeend",o):s.resultList.insertAdjacentElement("beforeend",o)})),s.input.setAttribute("aria-activedescendant",e>-1?"".concat(s.baseClass,"-result-").concat(e):""),s.resetPosition&&(s.resetPosition=!1,s.position=r(s.input,s.resultList),s.updateStyle()),s.core.checkSelectedResultVisible(s.resultList),s.onUpdate(t,e)})),n(this,"handleShow",(function(){s.expanded=!0,s.updateStyle()})),n(this,"handleHide",(function(){s.expanded=!1,s.resetPosition=!0,s.updateStyle()})),n(this,"handleLoading",(function(){s.loading=!0,s.updateStyle()})),n(this,"handleLoaded",(function(){s.loading=!1,s.updateStyle()})),n(this,"handleDocumentClick",(function(t){s.root.contains(t.target)||s.core.hideResults()})),n(this,"updateStyle",(function(){s.root.dataset.expanded=s.expanded,s.root.dataset.loading=s.loading,s.root.dataset.position=s.position,s.resultList.style.visibility=s.expanded?"visible":"hidden",s.resultList.style.pointerEvents=s.expanded?"auto":"none","below"===s.position?(s.resultList.style.bottom=null,s.resultList.style.top="100%"):(s.resultList.style.top=null,s.resultList.style.bottom="100%")})),this.root="string"==typeof i?document.querySelector(i):i,this.input=this.root.querySelector("input"),this.resultList=this.root.querySelector("ul"),this.baseClass=g,this.getResultValue=w,this.onUpdate=b,"function"==typeof m&&(this.renderResult=m);var R=new u({search:a,autoSelect:L,setValue:this.setValue,setAttribute:this.setAttribute,onUpdate:this.handleUpdate,onSubmit:p,onShow:this.handleShow,onHide:this.handleHide,onLoading:this.handleLoading,onLoaded:this.handleLoaded});x>0&&(R.handleInput=d(R.handleInput,x)),this.core=R,this.initialize()}}();
|
js/jquery.admin.js
CHANGED
@@ -15,7 +15,7 @@ jQuery(document).ready(function ($) {
|
|
15 |
}
|
16 |
});
|
17 |
|
18 |
-
$('#del_field').on('click', function () {
|
19 |
var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have.
|
20 |
$('#event' + num).remove(); // remove the last element.
|
21 |
// enable the "add" button.
|
@@ -30,7 +30,7 @@ jQuery(document).ready(function ($) {
|
|
30 |
$( '#del_field' ).attr('disabled', 'disabled');
|
31 |
$( '#event_span' ).hide();
|
32 |
|
33 |
-
$(".selectall").click
|
34 |
var checked_status = $(this).prop('checked');
|
35 |
var checkbox_name = $(this).attr('id');
|
36 |
$('input[name="' + checkbox_name + '[]"]').each(function () {
|
@@ -69,7 +69,8 @@ jQuery(document).ready(function ($) {
|
|
69 |
}
|
70 |
$('.mc-tabs .tabs a[href="' + firstItem + '"]').addClass('active').attr( 'aria-selected', 'true' );
|
71 |
if ( tabs > 1 ) {
|
72 |
-
$( '.mc-tabs .wptab' ).not( firstItem ).
|
|
|
73 |
$( firstItem ).show();
|
74 |
$( '.mc-tabs .tabs a' ).on( 'click', function (e) {
|
75 |
e.preventDefault();
|
@@ -77,8 +78,8 @@ jQuery(document).ready(function ($) {
|
|
77 |
$(this).addClass('active').attr( 'aria-selected', 'true' );
|
78 |
var target = $(this).attr('href');
|
79 |
window.location.hash = target;
|
80 |
-
$('.mc-tabs .wptab').not(target).
|
81 |
-
$(target).
|
82 |
});
|
83 |
}
|
84 |
});
|
15 |
}
|
16 |
});
|
17 |
|
18 |
+
$('#del_field').on( 'click', function () {
|
19 |
var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have.
|
20 |
$('#event' + num).remove(); // remove the last element.
|
21 |
// enable the "add" button.
|
30 |
$( '#del_field' ).attr('disabled', 'disabled');
|
31 |
$( '#event_span' ).hide();
|
32 |
|
33 |
+
$(".selectall").on( 'click', function () {
|
34 |
var checked_status = $(this).prop('checked');
|
35 |
var checkbox_name = $(this).attr('id');
|
36 |
$('input[name="' + checkbox_name + '[]"]').each(function () {
|
69 |
}
|
70 |
$('.mc-tabs .tabs a[href="' + firstItem + '"]').addClass('active').attr( 'aria-selected', 'true' );
|
71 |
if ( tabs > 1 ) {
|
72 |
+
$( '.mc-tabs .wptab' ).not( firstItem ).attr( 'aria-hidden', 'true' );
|
73 |
+
$( '.mc-tabs .wptab' ).removeClass( 'initial-hidden' );
|
74 |
$( firstItem ).show();
|
75 |
$( '.mc-tabs .tabs a' ).on( 'click', function (e) {
|
76 |
e.preventDefault();
|
78 |
$(this).addClass('active').attr( 'aria-selected', 'true' );
|
79 |
var target = $(this).attr('href');
|
80 |
window.location.hash = target;
|
81 |
+
$('.mc-tabs .wptab').not(target).attr( 'aria-hidden', 'true' );
|
82 |
+
$(target).removeAttr( 'aria-hidden' ).trigger( 'focus' );
|
83 |
});
|
84 |
}
|
85 |
});
|
js/locations-autocomplete.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) { 'use strict';
|
2 |
+
/* https://autocomplete.trevoreyre.com/#/javascript-component?id=getresultvalue */
|
3 |
+
new Autocomplete( '#mc-locations-autocomplete', {
|
4 |
+
search: input => {
|
5 |
+
const url = mclocations.ajaxurl;
|
6 |
+
return new Promise( resolve => {
|
7 |
+
if (input.length < 3) {
|
8 |
+
return resolve([])
|
9 |
+
}
|
10 |
+
|
11 |
+
var data = new FormData();
|
12 |
+
data.append( 'action', mclocations.action );
|
13 |
+
data.append( 'security', mclocations.security );
|
14 |
+
data.append( 'data', input );
|
15 |
+
const response = fetch(url, {
|
16 |
+
method: 'POST',
|
17 |
+
credentials: 'same-origin',
|
18 |
+
body: data
|
19 |
+
}).then(response => response.json())
|
20 |
+
.then(data => {
|
21 |
+
resolve(data.response)
|
22 |
+
})
|
23 |
+
})
|
24 |
+
},
|
25 |
+
onSubmit: result => {
|
26 |
+
var location_field = document.getElementById( 'mc_event_location_value' );
|
27 |
+
|
28 |
+
location_field.value = result.location_id;
|
29 |
+
$( location_field ).trigger( 'change' );
|
30 |
+
},
|
31 |
+
getResultValue: result => result.location_label
|
32 |
+
});
|
33 |
+
|
34 |
+
}(jQuery));
|
js/mc-ajax.js
CHANGED
@@ -7,16 +7,22 @@
|
|
7 |
var calendar = $( this ).closest( '.mc-main' );
|
8 |
var ref = calendar.attr('id');
|
9 |
var link = $(this).attr('href');
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
window.history.pushState({}, '', url );
|
14 |
var height = calendar.height();
|
15 |
$('#' + ref).html('<div class=\"mc-loading\"></div><div class=\"loading\" style=\"height:' + height + 'px\"><span class="screen-reader-text">Loading...</span></div>');
|
16 |
-
$('#' + ref).load(link + ' #' + ref + ' > *', function ( response, status, xhr ) {
|
17 |
|
18 |
if ( status == 'error' ) {
|
19 |
-
$( '#' + ref ).html(
|
20 |
}
|
21 |
// functions to execute when new view loads.
|
22 |
// List view.
|
@@ -33,7 +39,7 @@
|
|
33 |
$('.mini .has-events').children().not('.trigger, .mc-date, .event-date').hide();
|
34 |
}
|
35 |
// All views.
|
36 |
-
$( '#' + ref ).attr('tabindex', '-1').focus
|
37 |
mc_display_usertime();
|
38 |
// Your Custom ajax load changes if needed.
|
39 |
});
|
7 |
var calendar = $( this ).closest( '.mc-main' );
|
8 |
var ref = calendar.attr('id');
|
9 |
var link = $(this).attr('href');
|
10 |
+
let url;
|
11 |
+
try {
|
12 |
+
url = new URL(link);
|
13 |
+
url.searchParams.delete('embed');
|
14 |
+
|
15 |
+
window.history.pushState({}, '', url );
|
16 |
+
} catch(_) {
|
17 |
+
url = false;
|
18 |
+
}
|
19 |
|
|
|
20 |
var height = calendar.height();
|
21 |
$('#' + ref).html('<div class=\"mc-loading\"></div><div class=\"loading\" style=\"height:' + height + 'px\"><span class="screen-reader-text">Loading...</span></div>');
|
22 |
+
$( '#' + ref ).load(link + ' #' + ref + ' > *', function ( response, status, xhr ) {
|
23 |
|
24 |
if ( status == 'error' ) {
|
25 |
+
$( '#' + ref ).html( xhr.status + " " + xhr.statusText );
|
26 |
}
|
27 |
// functions to execute when new view loads.
|
28 |
// List view.
|
39 |
$('.mini .has-events').children().not('.trigger, .mc-date, .event-date').hide();
|
40 |
}
|
41 |
// All views.
|
42 |
+
$( '#' + ref ).attr('tabindex', '-1').trigger( 'focus' );
|
43 |
mc_display_usertime();
|
44 |
// Your Custom ajax load changes if needed.
|
45 |
});
|
js/mc-grid.js
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
|
11 |
$(this).closest( '.mc-main' ).toggleClass( 'grid-open' );
|
12 |
$(this).parents( '.vevent' ).children().not('.event-title').toggle().attr('tabindex', '-1');
|
13 |
-
$(this).parents( '.vevent' ).focus
|
14 |
|
15 |
var focusable = current_date.find( 'a, object, :input, iframe, [tabindex]' );
|
16 |
var lastFocus = focusable.last();
|
@@ -24,7 +24,7 @@
|
|
24 |
function (e) {
|
25 |
e.preventDefault();
|
26 |
$(this).closest( '.mc-main' ).removeClass( 'grid-open' );
|
27 |
-
$(this).closest('.vevent').find('.event-title a').focus
|
28 |
$(this).closest('div.details').toggle();
|
29 |
});
|
30 |
|
@@ -42,11 +42,11 @@
|
|
42 |
var action = $( ':focus' ).attr( 'data-action' );
|
43 |
if ( ( !e.shiftKey && keycode == 9 ) && action == 'shiftback' ) {
|
44 |
e.preventDefault();
|
45 |
-
$( '.mc-toggle.close' ).focus
|
46 |
}
|
47 |
if ( ( e.shiftKey && keycode == 9 ) && action == 'shiftforward' ) {
|
48 |
e.preventDefault();
|
49 |
-
$( '[data-action=shiftback]' ).focus
|
50 |
}
|
51 |
});
|
52 |
});
|
10 |
|
11 |
$(this).closest( '.mc-main' ).toggleClass( 'grid-open' );
|
12 |
$(this).parents( '.vevent' ).children().not('.event-title').toggle().attr('tabindex', '-1');
|
13 |
+
$(this).parents( '.vevent' ).trigger( 'focus' );
|
14 |
|
15 |
var focusable = current_date.find( 'a, object, :input, iframe, [tabindex]' );
|
16 |
var lastFocus = focusable.last();
|
24 |
function (e) {
|
25 |
e.preventDefault();
|
26 |
$(this).closest( '.mc-main' ).removeClass( 'grid-open' );
|
27 |
+
$(this).closest('.vevent').find('.event-title a').trigger( 'focus' );
|
28 |
$(this).closest('div.details').toggle();
|
29 |
});
|
30 |
|
42 |
var action = $( ':focus' ).attr( 'data-action' );
|
43 |
if ( ( !e.shiftKey && keycode == 9 ) && action == 'shiftback' ) {
|
44 |
e.preventDefault();
|
45 |
+
$( '.mc-toggle.close' ).trigger( 'focus' );
|
46 |
}
|
47 |
if ( ( e.shiftKey && keycode == 9 ) && action == 'shiftforward' ) {
|
48 |
e.preventDefault();
|
49 |
+
$( '[data-action=shiftback]' ).trigger( 'focus' );
|
50 |
}
|
51 |
});
|
52 |
});
|
js/mc-list.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
e.preventDefault();
|
9 |
var vevent = $( this ).closest( '.mc-events' ).find( '.vevent:first' );
|
10 |
$( this ).closest( '.mc-events' ).find( '.vevent' ).toggle();
|
11 |
-
vevent.attr('tabindex', '-1').focus
|
12 |
var visible = $(this).closest( '.mc-events' ).find('.vevent').is(':visible');
|
13 |
if ( visible ) {
|
14 |
$(this).attr('aria-expanded', 'true');
|
8 |
e.preventDefault();
|
9 |
var vevent = $( this ).closest( '.mc-events' ).find( '.vevent:first' );
|
10 |
$( this ).closest( '.mc-events' ).find( '.vevent' ).toggle();
|
11 |
+
vevent.attr('tabindex', '-1').trigger( 'focus' );
|
12 |
var visible = $(this).closest( '.mc-events' ).find('.vevent').is(':visible');
|
13 |
if ( visible ) {
|
14 |
$(this).attr('aria-expanded', 'true');
|
js/mc-mini.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
$( document ).on( "click", ".mini .has-events .trigger", function (e) {
|
6 |
e.preventDefault();
|
7 |
var current_date = $(this).parent().children();
|
8 |
-
current_date.not(".trigger").toggle().attr( "tabindex", "-1" ).focus
|
9 |
$( '.mini .has-events' ).children( '.trigger' ).removeClass( 'active-toggle' );
|
10 |
$( '.mini .has-events' ).children().not( '.trigger, .mc-date, .event-date' ).not( current_date ).hide();
|
11 |
$( this ).addClass( 'active-toggle' );
|
5 |
$( document ).on( "click", ".mini .has-events .trigger", function (e) {
|
6 |
e.preventDefault();
|
7 |
var current_date = $(this).parent().children();
|
8 |
+
current_date.not(".trigger").toggle().attr( "tabindex", "-1" ).trigger( 'focus' );
|
9 |
$( '.mini .has-events' ).children( '.trigger' ).removeClass( 'active-toggle' );
|
10 |
$( '.mini .has-events' ).children().not( '.trigger, .mc-date, .event-date' ).not( current_date ).hide();
|
11 |
$( this ).addClass( 'active-toggle' );
|
my-calendar-categories.php
CHANGED
@@ -860,6 +860,8 @@ function mc_category_select( $data = false, $option = true, $multiple = false, $
|
|
860 |
$selected = ' checked="checked"';
|
861 |
} elseif ( is_numeric( $category ) && ( (int) $category === (int) $cat->category_id ) ) {
|
862 |
$selected = ' checked="checked"';
|
|
|
|
|
863 |
}
|
864 |
} else {
|
865 |
if ( (int) $category === (int) $cat->category_id ) {
|
@@ -874,7 +876,7 @@ function mc_category_select( $data = false, $option = true, $multiple = false, $
|
|
874 |
$category_name = strip_tags( stripslashes( trim( $cat->category_name ) ) );
|
875 |
$category_name = ( '' === $category_name ) ? '(' . __( 'Untitled category', 'my-calendar' ) . ')' : $category_name;
|
876 |
if ( $multiple ) {
|
877 |
-
$c = '<li class="mc_cat_' . $cat->category_id . '"><input type="checkbox" name="' . esc_attr( $name ) . '" id="mc_cat_' . $cat->category_id . '" value="' . $cat->category_id . '" ' . $selected . ' /> <label for="mc_cat_' . $cat->category_id . '">' . $category_name . '</label></li>';
|
878 |
} else {
|
879 |
$c = '<option value="' . $cat->category_id . '" ' . $selected . '>' . $category_name . '</option>';
|
880 |
}
|
860 |
$selected = ' checked="checked"';
|
861 |
} elseif ( is_numeric( $category ) && ( (int) $category === (int) $cat->category_id ) ) {
|
862 |
$selected = ' checked="checked"';
|
863 |
+
} elseif ( ! $category ) {
|
864 |
+
$selected = ( get_option( 'mc_default_category' ) === (string) $cat->category_id ) ? ' checked="checked"' : '';
|
865 |
}
|
866 |
} else {
|
867 |
if ( (int) $category === (int) $cat->category_id ) {
|
876 |
$category_name = strip_tags( stripslashes( trim( $cat->category_name ) ) );
|
877 |
$category_name = ( '' === $category_name ) ? '(' . __( 'Untitled category', 'my-calendar' ) . ')' : $category_name;
|
878 |
if ( $multiple ) {
|
879 |
+
$c = '<li class="mc_cat_' . $cat->category_id . '"><input type="checkbox"' . $selected . ' name="' . esc_attr( $name ) . '" id="mc_cat_' . $cat->category_id . '" value="' . $cat->category_id . '" ' . $selected . ' /> <label for="mc_cat_' . $cat->category_id . '">' . $category_name . '</label></li>';
|
880 |
} else {
|
881 |
$c = '<option value="' . $cat->category_id . '" ' . $selected . '>' . $category_name . '</option>';
|
882 |
}
|
my-calendar-core.php
CHANGED
@@ -1092,6 +1092,20 @@ function mc_scripts() {
|
|
1092 |
)
|
1093 |
);
|
1094 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1095 |
}
|
1096 |
|
1097 |
if ( $slug . '_page_my-calendar-config' === $id ) {
|
@@ -1541,7 +1555,6 @@ function mc_register_actions() {
|
|
1541 |
add_filter( 'mc_event_registration', 'mc_standard_event_registration', 10, 4 );
|
1542 |
add_filter( 'mc_datetime_inputs', 'mc_standard_datetime_input', 10, 4 );
|
1543 |
add_action( 'mc_transition_event', 'mc_tweet_approval', 10, 2 );
|
1544 |
-
add_action( 'mc_save_event', 'mc_event_post', 10, 3 );
|
1545 |
add_action( 'mc_delete_event', 'mc_event_delete_post', 10, 2 );
|
1546 |
add_action( 'mc_mass_delete_events', 'mc_event_delete_posts', 10, 1 );
|
1547 |
add_action( 'parse_request', 'my_calendar_api' );
|
@@ -1620,7 +1633,7 @@ function mc_next_post_link( $output, $format ) {
|
|
1620 |
}
|
1621 |
|
1622 |
/**
|
1623 |
-
*
|
1624 |
*
|
1625 |
* @param string $title Original title.
|
1626 |
* @param int $post_id Post ID.
|
@@ -1636,7 +1649,7 @@ function mc_the_title( $title, $post_id = null ) {
|
|
1636 |
if ( ! is_object( $event ) ) {
|
1637 |
$event = mc_get_first_event( $event_id );
|
1638 |
} else {
|
1639 |
-
$event_title = $event->event_title;
|
1640 |
if ( $event_title !== $title ) {
|
1641 |
$title = $event_title;
|
1642 |
}
|
1092 |
)
|
1093 |
);
|
1094 |
}
|
1095 |
+
$count = mc_count_locations();
|
1096 |
+
if ( $count > apply_filters( 'mc_convert_locations_select_to_autocomplete', 25 ) ) {
|
1097 |
+
wp_enqueue_script( 'accessible-autocomplete', plugins_url( '/js/accessible-autocomplete.min.js', __FILE__ ) );
|
1098 |
+
wp_enqueue_script( 'mc-autocomplete', plugins_url( '/js/locations-autocomplete.js', __FILE__ ), array( 'jquery', 'accessible-autocomplete' ), '1.0.0', true );
|
1099 |
+
wp_localize_script(
|
1100 |
+
'mc-autocomplete',
|
1101 |
+
'mclocations',
|
1102 |
+
array(
|
1103 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
1104 |
+
'security' => wp_create_nonce( 'mc-search-locations' ),
|
1105 |
+
'action' => 'mc_core_autocomplete_search_locations',
|
1106 |
+
)
|
1107 |
+
);
|
1108 |
+
}
|
1109 |
}
|
1110 |
|
1111 |
if ( $slug . '_page_my-calendar-config' === $id ) {
|
1555 |
add_filter( 'mc_event_registration', 'mc_standard_event_registration', 10, 4 );
|
1556 |
add_filter( 'mc_datetime_inputs', 'mc_standard_datetime_input', 10, 4 );
|
1557 |
add_action( 'mc_transition_event', 'mc_tweet_approval', 10, 2 );
|
|
|
1558 |
add_action( 'mc_delete_event', 'mc_event_delete_post', 10, 2 );
|
1559 |
add_action( 'mc_mass_delete_events', 'mc_event_delete_posts', 10, 1 );
|
1560 |
add_action( 'parse_request', 'my_calendar_api' );
|
1633 |
}
|
1634 |
|
1635 |
/**
|
1636 |
+
* Replace title on individual event pages with viewed event value & config.
|
1637 |
*
|
1638 |
* @param string $title Original title.
|
1639 |
* @param int $post_id Post ID.
|
1649 |
if ( ! is_object( $event ) ) {
|
1650 |
$event = mc_get_first_event( $event_id );
|
1651 |
} else {
|
1652 |
+
$event_title = stripslashes( $event->event_title );
|
1653 |
if ( $event_title !== $title ) {
|
1654 |
$title = $event_title;
|
1655 |
}
|
my-calendar-event-manager.php
CHANGED
@@ -16,13 +16,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
16 |
/**
|
17 |
* Handle post generation, updating, and processing after event is saved
|
18 |
*
|
19 |
-
* @param string
|
20 |
-
* @param array
|
21 |
-
* @param int
|
|
|
22 |
*
|
23 |
* @return int post ID
|
24 |
*/
|
25 |
-
function mc_event_post( $action, $data, $event_id ) {
|
26 |
// if the event save was successful.
|
27 |
if ( 'add' === $action || 'copy' === $action ) {
|
28 |
$post_id = mc_create_event_post( $data, $event_id );
|
@@ -91,6 +92,7 @@ function mc_event_post( $action, $data, $event_id ) {
|
|
91 |
$access = ( isset( $_POST['events_access'] ) ) ? $_POST['events_access'] : array();
|
92 |
$access_terms = implode( ',', array_values( $access ) );
|
93 |
mc_update_event( 'event_access', $access_terms, $event_id, '%s' );
|
|
|
94 |
do_action( 'mc_update_event_post', $post_id, $_POST, $data, $event_id );
|
95 |
if ( mc_switch_sites() ) {
|
96 |
restore_current_blog();
|
@@ -100,7 +102,6 @@ function mc_event_post( $action, $data, $event_id ) {
|
|
100 |
return $post_id;
|
101 |
}
|
102 |
|
103 |
-
add_action( 'mc_update_event_post', 'mc_add_post_meta_data', 10, 4 );
|
104 |
/**
|
105 |
* Add post meta data to an event post.
|
106 |
*
|
@@ -119,7 +120,27 @@ function mc_add_post_meta_data( $post_id, $post, $data, $event_id ) {
|
|
119 |
update_post_meta( $post_id, '_mc_guid', $guid );
|
120 |
}
|
121 |
update_post_meta( $post_id, '_mc_event_shortcode', $data['shortcode'] );
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
$mc_event_id = get_post_meta( $post_id, '_mc_event_id', true );
|
124 |
if ( ! $mc_event_id ) {
|
125 |
update_post_meta( $post_id, '_mc_event_id', $event_id );
|
@@ -129,7 +150,6 @@ function mc_add_post_meta_data( $post_id, $post, $data, $event_id ) {
|
|
129 |
// This is only used by My Tickets, so only the first date occurrence is required.
|
130 |
$event_date = ( is_array( $data['event_begin'] ) ) ? $data['event_begin'][0] : $data['event_begin'];
|
131 |
update_post_meta( $post_id, '_mc_event_date', strtotime( $event_date ) );
|
132 |
-
update_post_meta( $post_id, '_event_time_label', ( isset( $_POST['event_time_label'] ) ) ? $_POST['event_time_label'] : '' );
|
133 |
$location_id = ( isset( $post['location_preset'] ) ) ? (int) $post['location_preset'] : false;
|
134 |
if ( $location_id ) { // only change location ID if dropdown set.
|
135 |
update_post_meta( $post_id, '_mc_event_location', $location_id );
|
@@ -189,6 +209,7 @@ function mc_create_event_post( $data, $event_id ) {
|
|
189 |
}
|
190 |
mc_update_event( 'event_post', $post_id, $event_id );
|
191 |
mc_update_event( 'event_location', $location_id, $event_id );
|
|
|
192 |
do_action( 'mc_update_event_post', $post_id, $_POST, $data, $event_id );
|
193 |
wp_publish_post( $post_id );
|
194 |
}
|
@@ -667,7 +688,7 @@ function my_calendar_edit() {
|
|
667 |
*/
|
668 |
function my_calendar_save( $action, $output, $event_id = false ) {
|
669 |
global $wpdb;
|
670 |
-
$proceed = $output[0];
|
671 |
$message = '';
|
672 |
$formats = array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%f', '%f' );
|
673 |
|
@@ -687,6 +708,7 @@ function my_calendar_save( $action, $output, $event_id = false ) {
|
|
687 |
// do an action using the $action and processed event data.
|
688 |
$data = $add;
|
689 |
$event_error = '';
|
|
|
690 |
do_action( 'mc_save_event', $action, $data, $event_id, $result );
|
691 |
|
692 |
if ( 'true' === get_option( 'mc_event_mail' ) ) {
|
@@ -799,6 +821,7 @@ function my_calendar_save( $action, $output, $event_id = false ) {
|
|
799 |
}
|
800 |
}
|
801 |
$data = $update;
|
|
|
802 |
do_action( 'mc_save_event', $action, $data, $event_id, $result );
|
803 |
if ( false === $result ) {
|
804 |
$message = mc_show_error( __( 'Your event was not updated.', 'my-calendar' ) . " $url", false );
|
@@ -1657,48 +1680,7 @@ function mc_form_fields( $data, $mode, $event_id ) {
|
|
1657 |
<?php
|
1658 |
}
|
1659 |
if ( mc_show_edit_block( 'event_location_dropdown' ) ) {
|
1660 |
-
$
|
1661 |
-
$locs = mc_get_locations( 'select-locations' );
|
1662 |
-
if ( ! empty( $locs ) ) {
|
1663 |
-
?>
|
1664 |
-
<p>
|
1665 |
-
<label for="l_preset"><?php _e( 'Choose location:', 'my-calendar' ); ?></label> <select
|
1666 |
-
name="location_preset" id="l_preset" aria-describedby='mc-current-location'>
|
1667 |
-
<option value="none">--</option>
|
1668 |
-
<?php
|
1669 |
-
foreach ( $locs as $loc ) {
|
1670 |
-
if ( is_object( $loc ) ) {
|
1671 |
-
$loc_name = strip_tags( stripslashes( $loc->location_label ), mc_strip_tags() );
|
1672 |
-
$selected = ( is_numeric( get_option( 'mc_default_location' ) ) && (int) get_option( 'mc_default_location' ) === (int) $loc->location_id ) ? ' selected="selected"' : '';
|
1673 |
-
if ( is_object( $data ) ) {
|
1674 |
-
$selected = '';
|
1675 |
-
if ( property_exists( $data, 'event_location' ) ) {
|
1676 |
-
$event_location = $data->event_location;
|
1677 |
-
} else {
|
1678 |
-
$event_location = false;
|
1679 |
-
}
|
1680 |
-
if ( (int) $loc->location_id === (int) $event_location ) {
|
1681 |
-
// Translators: label for current location.
|
1682 |
-
$current_location = "<span id='mc-current-location'>" . sprintf( __( 'Current location: %s', 'my-calendar' ), $loc_name ) . '</span>';
|
1683 |
-
$current_location .= "<input type='hidden' name='preset_location' value='$event_location' />";
|
1684 |
-
}
|
1685 |
-
}
|
1686 |
-
echo "<option value='" . $loc->location_id . "'$selected />" . $loc_name . '</option>';
|
1687 |
-
}
|
1688 |
-
}
|
1689 |
-
?>
|
1690 |
-
</select>
|
1691 |
-
<?php echo $current_location; ?>
|
1692 |
-
</p>
|
1693 |
-
<?php
|
1694 |
-
} else {
|
1695 |
-
?>
|
1696 |
-
<input type="hidden" name="location_preset" value="none" />
|
1697 |
-
<p>
|
1698 |
-
<a href="<?php echo admin_url( 'admin.php?page=my-calendar-locations' ); ?>"><?php _e( 'Add recurring locations for later use.', 'my-calendar' ); ?></a>
|
1699 |
-
</p>
|
1700 |
-
<?php
|
1701 |
-
}
|
1702 |
} else {
|
1703 |
?>
|
1704 |
<input type="hidden" name="location_preset" value="none" />
|
@@ -1772,6 +1754,66 @@ function mc_form_fields( $data, $mode, $event_id ) {
|
|
1772 |
<?php
|
1773 |
}
|
1774 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1775 |
|
1776 |
/**
|
1777 |
* Get users.
|
16 |
/**
|
17 |
* Handle post generation, updating, and processing after event is saved
|
18 |
*
|
19 |
+
* @param string $action edit, copy, add.
|
20 |
+
* @param array $data saved event data.
|
21 |
+
* @param int $event_id My Calendar event ID.
|
22 |
+
* @param bool|int $result Results of DB query.
|
23 |
*
|
24 |
* @return int post ID
|
25 |
*/
|
26 |
+
function mc_event_post( $action, $data, $event_id, $result = false ) {
|
27 |
// if the event save was successful.
|
28 |
if ( 'add' === $action || 'copy' === $action ) {
|
29 |
$post_id = mc_create_event_post( $data, $event_id );
|
92 |
$access = ( isset( $_POST['events_access'] ) ) ? $_POST['events_access'] : array();
|
93 |
$access_terms = implode( ',', array_values( $access ) );
|
94 |
mc_update_event( 'event_access', $access_terms, $event_id, '%s' );
|
95 |
+
mc_add_post_meta_data( $post_id, $_POST, $data, $event_id );
|
96 |
do_action( 'mc_update_event_post', $post_id, $_POST, $data, $event_id );
|
97 |
if ( mc_switch_sites() ) {
|
98 |
restore_current_blog();
|
102 |
return $post_id;
|
103 |
}
|
104 |
|
|
|
105 |
/**
|
106 |
* Add post meta data to an event post.
|
107 |
*
|
120 |
update_post_meta( $post_id, '_mc_guid', $guid );
|
121 |
}
|
122 |
update_post_meta( $post_id, '_mc_event_shortcode', $data['shortcode'] );
|
123 |
+
$events_access = '';
|
124 |
+
if ( isset( $_POST['events_access'] ) ) {
|
125 |
+
$events_access = $_POST['events_access'];
|
126 |
+
} else {
|
127 |
+
// My Calendar Rest API.
|
128 |
+
if ( isset( $post['data'] ) && isset( $post['data']['events_access'] ) ) {
|
129 |
+
$events_access = $post['data']['events_access'];
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$time_label = '';
|
133 |
+
if ( isset( $_POST['event_time_label'] ) ) {
|
134 |
+
$time_label = $_POST['event_time_label'];
|
135 |
+
} else {
|
136 |
+
// My Calendar Rest API.
|
137 |
+
if ( isset( $post['data'] ) && isset( $post['data']['event_time_label'] ) ) {
|
138 |
+
$time_label = $post['data']['event_time_label'];
|
139 |
+
}
|
140 |
+
}
|
141 |
+
update_post_meta( $post_id, '_mc_event_access', $events_access );
|
142 |
+
update_post_meta( $post_id, '_event_time_label', $time_label );
|
143 |
+
|
144 |
$mc_event_id = get_post_meta( $post_id, '_mc_event_id', true );
|
145 |
if ( ! $mc_event_id ) {
|
146 |
update_post_meta( $post_id, '_mc_event_id', $event_id );
|
150 |
// This is only used by My Tickets, so only the first date occurrence is required.
|
151 |
$event_date = ( is_array( $data['event_begin'] ) ) ? $data['event_begin'][0] : $data['event_begin'];
|
152 |
update_post_meta( $post_id, '_mc_event_date', strtotime( $event_date ) );
|
|
|
153 |
$location_id = ( isset( $post['location_preset'] ) ) ? (int) $post['location_preset'] : false;
|
154 |
if ( $location_id ) { // only change location ID if dropdown set.
|
155 |
update_post_meta( $post_id, '_mc_event_location', $location_id );
|
209 |
}
|
210 |
mc_update_event( 'event_post', $post_id, $event_id );
|
211 |
mc_update_event( 'event_location', $location_id, $event_id );
|
212 |
+
mc_add_post_meta_data( $post_id, $_POST, $data, $event_id );
|
213 |
do_action( 'mc_update_event_post', $post_id, $_POST, $data, $event_id );
|
214 |
wp_publish_post( $post_id );
|
215 |
}
|
688 |
*/
|
689 |
function my_calendar_save( $action, $output, $event_id = false ) {
|
690 |
global $wpdb;
|
691 |
+
$proceed = (bool) $output[0];
|
692 |
$message = '';
|
693 |
$formats = array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%f', '%f' );
|
694 |
|
708 |
// do an action using the $action and processed event data.
|
709 |
$data = $add;
|
710 |
$event_error = '';
|
711 |
+
mc_event_post( $action, $data, $event_id, $result );
|
712 |
do_action( 'mc_save_event', $action, $data, $event_id, $result );
|
713 |
|
714 |
if ( 'true' === get_option( 'mc_event_mail' ) ) {
|
821 |
}
|
822 |
}
|
823 |
$data = $update;
|
824 |
+
mc_event_post( $action, $data, $event_id, $result );
|
825 |
do_action( 'mc_save_event', $action, $data, $event_id, $result );
|
826 |
if ( false === $result ) {
|
827 |
$message = mc_show_error( __( 'Your event was not updated.', 'my-calendar' ) . " $url", false );
|
1680 |
<?php
|
1681 |
}
|
1682 |
if ( mc_show_edit_block( 'event_location_dropdown' ) ) {
|
1683 |
+
echo mc_event_location_dropdown_block( $data );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1684 |
} else {
|
1685 |
?>
|
1686 |
<input type="hidden" name="location_preset" value="none" />
|
1754 |
<?php
|
1755 |
}
|
1756 |
|
1757 |
+
/**
|
1758 |
+
* Produce Event location dropdown.
|
1759 |
+
*
|
1760 |
+
* @param object $data Current event data.
|
1761 |
+
*
|
1762 |
+
* @return string
|
1763 |
+
*/
|
1764 |
+
function mc_event_location_dropdown_block( $data ) {
|
1765 |
+
$current_location = '';
|
1766 |
+
$event_location = false;
|
1767 |
+
$output = '<div class="mc-event-location-dropdown">';
|
1768 |
+
$autocomplete = false;
|
1769 |
+
$count = mc_count_locations();
|
1770 |
+
if ( $count > apply_filters( 'mc_convert_locations_select_to_autocomplete', 25 ) ) {
|
1771 |
+
$autocomplete = true;
|
1772 |
+
}
|
1773 |
+
if ( 0 !== $count ) {
|
1774 |
+
$output .= '<label for="l_preset">' . __( 'Choose location:', 'my-calendar' ) . '</label>';
|
1775 |
+
if ( is_object( $data ) ) {
|
1776 |
+
$selected = '';
|
1777 |
+
if ( property_exists( $data, 'event_location' ) ) {
|
1778 |
+
$event_location = $data->event_location;
|
1779 |
+
}
|
1780 |
+
}
|
1781 |
+
if ( ! $autocomplete ) {
|
1782 |
+
$locs = mc_get_locations( 'select-locations' );
|
1783 |
+
$output .= '
|
1784 |
+
<select name="location_preset" id="l_preset" aria-describedby="mc-current-location">
|
1785 |
+
<option value="none">--</option>';
|
1786 |
+
foreach ( $locs as $loc ) {
|
1787 |
+
if ( is_object( $loc ) ) {
|
1788 |
+
$loc_name = strip_tags( stripslashes( $loc->location_label ), mc_strip_tags() );
|
1789 |
+
$selected = ( is_numeric( get_option( 'mc_default_location' ) ) && (int) get_option( 'mc_default_location' ) === (int) $loc->location_id ) ? ' selected="selected"' : '';
|
1790 |
+
if ( (int) $loc->location_id === (int) $event_location ) {
|
1791 |
+
// Translators: label for current location.
|
1792 |
+
$current_location = "<span id='mc-current-location'>" . sprintf( __( 'Current location: %s', 'my-calendar' ), $loc_name ) . '</span>';
|
1793 |
+
$current_location .= "<input type='hidden' name='preset_location' value='$event_location' />";
|
1794 |
+
}
|
1795 |
+
$output .= "<option value='" . $loc->location_id . "'$selected />" . $loc_name . '</option>';
|
1796 |
+
}
|
1797 |
+
}
|
1798 |
+
$output .= '</select>' . $current_location . '</p>';
|
1799 |
+
} else {
|
1800 |
+
$location_label = ( $event_location && is_numeric( $event_location ) ) ? mc_get_location( $event_location )->location_label : '';
|
1801 |
+
$output .= '<div id="mc-locations-autocomplete" class="autocomplete">
|
1802 |
+
<input class="autocomplete-input" type="text" id="l_preset" value="' . esc_attr( $location_label ) . '" />
|
1803 |
+
<ul class="autocomplete-result-list"></ul>
|
1804 |
+
<input type="hidden" name="location_preset" id="mc_event_location_value" value="' . esc_attr( $event_location ) . '" />
|
1805 |
+
</div>';
|
1806 |
+
}
|
1807 |
+
} else {
|
1808 |
+
$output .= '<input type="hidden" name="location_preset" value="none" />
|
1809 |
+
<p>
|
1810 |
+
<a href="' . admin_url( 'admin.php?page=my-calendar-locations' ) . '>">' . __( 'Add recurring locations for later use.', 'my-calendar' ) . '</a>
|
1811 |
+
</p>';
|
1812 |
+
}
|
1813 |
+
$output .= '</div>';
|
1814 |
+
|
1815 |
+
return $output;
|
1816 |
+
}
|
1817 |
|
1818 |
/**
|
1819 |
* Get users.
|
my-calendar-events.php
CHANGED
@@ -35,6 +35,7 @@ function mc_event_object( $object ) {
|
|
35 |
}
|
36 |
$object->uid = $guid;
|
37 |
}
|
|
|
38 |
}
|
39 |
|
40 |
return $object;
|
@@ -183,7 +184,10 @@ function my_calendar_get_events( $args ) {
|
|
183 |
$event->location = $locs[ $object_id ];
|
184 |
}
|
185 |
}
|
186 |
-
$
|
|
|
|
|
|
|
187 |
}
|
188 |
}
|
189 |
}
|
@@ -230,12 +234,15 @@ function my_calendar_get_events( $args ) {
|
|
230 |
$event->location = $locs[ $object_id ];
|
231 |
}
|
232 |
}
|
233 |
-
$
|
|
|
|
|
|
|
234 |
}
|
235 |
}
|
236 |
}
|
237 |
|
238 |
-
return $arr_events;
|
239 |
}
|
240 |
|
241 |
/**
|
@@ -346,10 +353,13 @@ function mc_get_all_events( $args ) {
|
|
346 |
} else {
|
347 |
$event->categories = $fetched[ $object_id ];
|
348 |
}
|
349 |
-
$
|
|
|
|
|
|
|
350 |
}
|
351 |
|
352 |
-
return $arr_events;
|
353 |
}
|
354 |
|
355 |
/**
|
@@ -494,7 +504,7 @@ function mc_get_search_results( $search ) {
|
|
494 |
}
|
495 |
}
|
496 |
|
497 |
-
return apply_filters( 'mc_searched_events', $event_array );
|
498 |
}
|
499 |
|
500 |
/**
|
35 |
}
|
36 |
$object->uid = $guid;
|
37 |
}
|
38 |
+
$object = apply_filters( 'mc_event_object', $object );
|
39 |
}
|
40 |
|
41 |
return $object;
|
184 |
$event->location = $locs[ $object_id ];
|
185 |
}
|
186 |
}
|
187 |
+
$object = mc_event_object( $event );
|
188 |
+
if ( false !== $object ) {
|
189 |
+
$arr_events[] = $object;
|
190 |
+
}
|
191 |
}
|
192 |
}
|
193 |
}
|
234 |
$event->location = $locs[ $object_id ];
|
235 |
}
|
236 |
}
|
237 |
+
$object = mc_event_object( $event );
|
238 |
+
if ( false !== $object ) {
|
239 |
+
$arr_events[] = $object;
|
240 |
+
}
|
241 |
}
|
242 |
}
|
243 |
}
|
244 |
|
245 |
+
return apply_filters( 'mc_filter_events', $arr_events, $args, 'my_calendar_get_events' );
|
246 |
}
|
247 |
|
248 |
/**
|
353 |
} else {
|
354 |
$event->categories = $fetched[ $object_id ];
|
355 |
}
|
356 |
+
$object = mc_event_object( $event );
|
357 |
+
if ( false !== $object ) {
|
358 |
+
$arr_events[ $key ] = $object;
|
359 |
+
}
|
360 |
}
|
361 |
|
362 |
+
return apply_filters( 'mc_filter_events', $arr_events, $args, 'mc_get_all_events' );
|
363 |
}
|
364 |
|
365 |
/**
|
504 |
}
|
505 |
}
|
506 |
|
507 |
+
return apply_filters( 'mc_searched_events', $event_array, $args );
|
508 |
}
|
509 |
|
510 |
/**
|
my-calendar-group-manager.php
CHANGED
@@ -161,6 +161,7 @@ function my_calendar_save_group( $action, $output, $event_id = false ) {
|
|
161 |
// Translators: Calendar URL.
|
162 |
$url = sprintf( __( 'View <a href="%s">your calendar</a>.', 'my-calendar' ), mc_get_uri() );
|
163 |
// Same as action on basic save.
|
|
|
164 |
do_action( 'mc_save_event', 'edit', $update, $event_id, $result );
|
165 |
do_action( 'mc_save_grouped_events', $result, $event_id, $update );
|
166 |
if ( false === $result ) {
|
161 |
// Translators: Calendar URL.
|
162 |
$url = sprintf( __( 'View <a href="%s">your calendar</a>.', 'my-calendar' ), mc_get_uri() );
|
163 |
// Same as action on basic save.
|
164 |
+
mc_event_post( 'edit', $update, $event_id, $result );
|
165 |
do_action( 'mc_save_event', 'edit', $update, $event_id, $result );
|
166 |
do_action( 'mc_save_grouped_events', $result, $event_id, $update );
|
167 |
if ( false === $result ) {
|
my-calendar-locations.php
CHANGED
@@ -158,21 +158,21 @@ add_action( 'mc_delete_location', 'mc_location_delete_post', 10, 2 );
|
|
158 |
* @return object $post
|
159 |
*/
|
160 |
function mc_get_location_post( $location_id, $type = true ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
$post_ID = false;
|
162 |
$post = false;
|
163 |
-
$
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
'meta_value' => $location_id,
|
168 |
-
)
|
169 |
-
);
|
170 |
-
if ( isset( $posts[0] ) && is_object( $posts[0] ) ) {
|
171 |
-
$post = $posts[0];
|
172 |
-
$post_ID = $post->ID;
|
173 |
}
|
174 |
|
175 |
-
return ( $type ) ? $
|
176 |
}
|
177 |
|
178 |
/**
|
@@ -466,7 +466,8 @@ function mc_get_location( $location_id ) {
|
|
466 |
$mcdb = mc_remote_db();
|
467 |
}
|
468 |
|
469 |
-
$location
|
|
|
470 |
|
471 |
return $location;
|
472 |
}
|
@@ -769,13 +770,18 @@ function mc_location_fields() {
|
|
769 |
* Get custom data for a location.
|
770 |
*
|
771 |
* @param int $location_id Location ID.
|
|
|
772 |
* @param string $field Custom field name.
|
773 |
*
|
774 |
* @return mixed
|
775 |
*/
|
776 |
-
function mc_location_custom_data( $location_id = false, $field ) {
|
777 |
$location_id = ( isset( $_GET['location_id'] ) ) ? (int) $_GET['location_id'] : $location_id;
|
778 |
$value = '';
|
|
|
|
|
|
|
|
|
779 |
if ( ! $location_id ) {
|
780 |
$location_id = ( isset( $_POST['location_id'] ) ) ? (int) $_POST['location_id'] : false;
|
781 |
}
|
@@ -798,7 +804,11 @@ function mc_location_custom_data( $location_id = false, $field ) {
|
|
798 |
function mc_template_location_fields( $e, $event ) {
|
799 |
$fields = mc_location_fields();
|
800 |
foreach ( $fields as $name => $field ) {
|
801 |
-
$
|
|
|
|
|
|
|
|
|
802 |
if ( ! isset( $field['display_callback'] ) || ( isset( $field['display_callback'] ) && ! function_exists( $field['display_callback'] ) ) ) {
|
803 |
// if no display callback is provided.
|
804 |
$display = stripslashes( $value );
|
@@ -831,7 +841,7 @@ function mc_display_location_fields( $fields, $data, $context ) {
|
|
831 |
|
832 |
$custom_fields = apply_filters( 'mc_order_location_fields', $fields, $context );
|
833 |
foreach ( $custom_fields as $name => $field ) {
|
834 |
-
$user_value = mc_location_custom_data( $data, $name );
|
835 |
$required = isset( $field['required'] ) ? ' required' : '';
|
836 |
$req_label = isset( $field['required'] ) ? ' <span class="required">' . __( 'Required', 'my-calendar' ) . '</span>' : '';
|
837 |
switch ( $field['input_type'] ) {
|
@@ -1008,3 +1018,39 @@ function mc_get_locations( $args ) {
|
|
1008 |
|
1009 |
return apply_filters( 'mc_filter_results', $results, $args );
|
1010 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
* @return object $post
|
159 |
*/
|
160 |
function mc_get_location_post( $location_id, $type = true ) {
|
161 |
+
global $wpdb;
|
162 |
+
$mcdb = $wpdb;
|
163 |
+
if ( 'true' === get_option( 'mc_remote' ) && function_exists( 'mc_remote_db' ) ) {
|
164 |
+
$mcdb = mc_remote_db();
|
165 |
+
}
|
166 |
+
|
167 |
$post_ID = false;
|
168 |
$post = false;
|
169 |
+
$query = $mcdb->prepare( "SELECT post_id FROM $wpdb->postmeta where meta_key ='_mc_location_id' and meta_value = %d", $location_id );
|
170 |
+
$posts = $mcdb->get_col( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
171 |
+
if ( isset( $posts[0] ) ) {
|
172 |
+
$post_ID = $posts[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
|
175 |
+
return ( $type ) ? get_post( $post_ID ) : $post_ID;
|
176 |
}
|
177 |
|
178 |
/**
|
466 |
$mcdb = mc_remote_db();
|
467 |
}
|
468 |
|
469 |
+
$location = $mcdb->get_row( $mcdb->prepare( 'SELECT * FROM ' . my_calendar_locations_table() . ' WHERE location_id = %d', $location_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
470 |
+
$location->location_post = mc_get_location_post( $location_id, false );
|
471 |
|
472 |
return $location;
|
473 |
}
|
770 |
* Get custom data for a location.
|
771 |
*
|
772 |
* @param int $location_id Location ID.
|
773 |
+
* @param int $location_post Location Post ID.
|
774 |
* @param string $field Custom field name.
|
775 |
*
|
776 |
* @return mixed
|
777 |
*/
|
778 |
+
function mc_location_custom_data( $location_id = false, $location_post = false, $field ) {
|
779 |
$location_id = ( isset( $_GET['location_id'] ) ) ? (int) $_GET['location_id'] : $location_id;
|
780 |
$value = '';
|
781 |
+
// Quick exit when location post is known.
|
782 |
+
if ( $location_post ) {
|
783 |
+
return get_post_meta( $location_post, $field, true );
|
784 |
+
}
|
785 |
if ( ! $location_id ) {
|
786 |
$location_id = ( isset( $_POST['location_id'] ) ) ? (int) $_POST['location_id'] : false;
|
787 |
}
|
804 |
function mc_template_location_fields( $e, $event ) {
|
805 |
$fields = mc_location_fields();
|
806 |
foreach ( $fields as $name => $field ) {
|
807 |
+
$location_post = false;
|
808 |
+
if ( is_object( $event ) && property_exists( $event, 'location' ) ) {
|
809 |
+
$location_post = $event->location->location_post;
|
810 |
+
}
|
811 |
+
$value = mc_location_custom_data( $event->event_location, $location_post, $name );
|
812 |
if ( ! isset( $field['display_callback'] ) || ( isset( $field['display_callback'] ) && ! function_exists( $field['display_callback'] ) ) ) {
|
813 |
// if no display callback is provided.
|
814 |
$display = stripslashes( $value );
|
841 |
|
842 |
$custom_fields = apply_filters( 'mc_order_location_fields', $fields, $context );
|
843 |
foreach ( $custom_fields as $name => $field ) {
|
844 |
+
$user_value = mc_location_custom_data( $data, false, $name );
|
845 |
$required = isset( $field['required'] ) ? ' required' : '';
|
846 |
$req_label = isset( $field['required'] ) ? ' <span class="required">' . __( 'Required', 'my-calendar' ) . '</span>' : '';
|
847 |
switch ( $field['input_type'] ) {
|
1018 |
|
1019 |
return apply_filters( 'mc_filter_results', $results, $args );
|
1020 |
}
|
1021 |
+
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* Get information about locations.
|
1025 |
+
*/
|
1026 |
+
function mc_core_autocomplete_search_locations() {
|
1027 |
+
if ( isset( $_REQUEST['action'] ) && 'mc_core_autocomplete_search_locations' === $_REQUEST['action'] ) {
|
1028 |
+
$security = $_REQUEST['security'];
|
1029 |
+
if ( ! wp_verify_nonce( $security, 'mc-search-locations' ) ) {
|
1030 |
+
wp_send_json(
|
1031 |
+
array(
|
1032 |
+
'success' => 0,
|
1033 |
+
'response' => array( 'error' => 'Invalid security value.' ),
|
1034 |
+
)
|
1035 |
+
);
|
1036 |
+
}
|
1037 |
+
$query = $_REQUEST['data'];
|
1038 |
+
|
1039 |
+
$locations = mc_search_locations( $query, array( 'location_id', 'location_label' ) );
|
1040 |
+
$response = array();
|
1041 |
+
foreach ( $locations as $location ) {
|
1042 |
+
$response[] = array(
|
1043 |
+
'location_id' => $location->location_id,
|
1044 |
+
'location_label' => html_entity_decode( strip_tags( $location->location_label ) ),
|
1045 |
+
);
|
1046 |
+
}
|
1047 |
+
wp_send_json(
|
1048 |
+
array(
|
1049 |
+
'success' => 1,
|
1050 |
+
'response' => $response,
|
1051 |
+
)
|
1052 |
+
);
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
add_action( 'wp_ajax_mc_core_autocomplete_search_locations', 'mc_core_autocomplete_search_locations' );
|
1056 |
+
add_action( 'wp_ajax_nopriv_mc_core_autocomplete_search_locations', 'mc_core_autocomplete_search_locations' );
|
my-calendar-output.php
CHANGED
@@ -268,7 +268,7 @@ function my_calendar_draw_event( $event, $type = 'calendar', $process_date, $tim
|
|
268 |
$image = mc_category_icon( $event );
|
269 |
$img = '';
|
270 |
$has_image = ( '' !== $image ) ? ' has-image' : '';
|
271 |
-
$event_classes = mc_event_classes( $event, $
|
272 |
$nofollow = ( stripos( $event_classes, 'past-event' ) !== false ) ? 'rel="nofollow"' : '';
|
273 |
$header .= "\n\n <div id='$uid-$type-$id' class='$event_classes'>\n";
|
274 |
|
@@ -602,12 +602,11 @@ add_filter( 'mc_disable_link', 'mc_disable_link', 10, 2 );
|
|
602 |
* Generate classes for a given event
|
603 |
*
|
604 |
* @param object $event Event Object.
|
605 |
-
* @param string $uid Unique ID for event.
|
606 |
* @param string $type Type of view being shown.
|
607 |
*
|
608 |
* @return string classes
|
609 |
*/
|
610 |
-
function mc_event_classes( $event, $
|
611 |
$uid = 'mc_' . $type . '_' . $event->occur_id;
|
612 |
$ts = $event->ts_occur_begin;
|
613 |
$end = $event->ts_occur_end;
|
@@ -1510,7 +1509,7 @@ function mc_list_related( $id, $this_id, $template = '{date}, {time}' ) {
|
|
1510 |
$template = mc_get_custom_template( $template );
|
1511 |
}
|
1512 |
$html = mc_draw_template( $array, $template );
|
1513 |
-
$classes = mc_event_classes( $event, '
|
1514 |
$classes .= ( (int) $event_id === (int) $this_id ) ? ' current-event' : '';
|
1515 |
$output .= "<li class='$classes'>$html</li>";
|
1516 |
}
|
268 |
$image = mc_category_icon( $event );
|
269 |
$img = '';
|
270 |
$has_image = ( '' !== $image ) ? ' has-image' : '';
|
271 |
+
$event_classes = mc_event_classes( $event, $type );
|
272 |
$nofollow = ( stripos( $event_classes, 'past-event' ) !== false ) ? 'rel="nofollow"' : '';
|
273 |
$header .= "\n\n <div id='$uid-$type-$id' class='$event_classes'>\n";
|
274 |
|
602 |
* Generate classes for a given event
|
603 |
*
|
604 |
* @param object $event Event Object.
|
|
|
605 |
* @param string $type Type of view being shown.
|
606 |
*
|
607 |
* @return string classes
|
608 |
*/
|
609 |
+
function mc_event_classes( $event, $type ) {
|
610 |
$uid = 'mc_' . $type . '_' . $event->occur_id;
|
611 |
$ts = $event->ts_occur_begin;
|
612 |
$end = $event->ts_occur_end;
|
1509 |
$template = mc_get_custom_template( $template );
|
1510 |
}
|
1511 |
$html = mc_draw_template( $array, $template );
|
1512 |
+
$classes = mc_event_classes( $event, 'related' );
|
1513 |
$classes .= ( (int) $event_id === (int) $this_id ) ? ' current-event' : '';
|
1514 |
$output .= "<li class='$classes'>$html</li>";
|
1515 |
}
|
my-calendar-settings.php
CHANGED
@@ -175,6 +175,198 @@ function my_calendar_import() {
|
|
175 |
}
|
176 |
}
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
/**
|
179 |
* Build settings form.
|
180 |
*/
|
@@ -196,217 +388,66 @@ function my_calendar_settings() {
|
|
196 |
echo '<li>' . __( 'Event generation completed.', 'my-calendar' ) . '</li>';
|
197 |
echo '</ol></div>';
|
198 |
}
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
$mc_uri = get_option( 'mc_uri' );
|
208 |
-
if ( isset( $_POST['mc_uri'] ) && ! isset( $_POST['mc_uri_id'] ) ) {
|
209 |
-
$mc_uri = $_POST['mc_uri'];
|
210 |
-
} elseif ( isset( $_POST['mc_uri_id'] ) && is_numeric( $_POST['mc_uri_id'] ) ) {
|
211 |
-
if ( get_post( absint( $_POST['mc_uri_id'] ) ) ) {
|
212 |
-
$mc_uri = get_permalink( absint( $_POST['mc_uri_id'] ) );
|
213 |
-
} else {
|
214 |
-
$mc_uri = isset( $_POST['mc_uri'] ) ? $_POST['mc_uri'] : get_option( 'mc_uri' );
|
215 |
}
|
|
|
216 |
}
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
update_option( 'mc_uri_id', absint( $_POST['mc_uri_id'] ) );
|
221 |
-
// End handling of primary URL.
|
222 |
-
update_option( 'mc_api_enabled', $mc_api_enabled );
|
223 |
-
update_option( 'mc_remote', $mc_remote );
|
224 |
-
update_option( 'mc_drop_tables', $mc_drop_tables );
|
225 |
-
update_option( 'mc_default_sort', $_POST['mc_default_sort'] );
|
226 |
-
update_option( 'mc_default_direction', $_POST['mc_default_direction'] );
|
227 |
-
if ( 2 === (int) get_site_option( 'mc_multisite' ) ) {
|
228 |
-
$mc_current_table = ( isset( $_POST['mc_current_table'] ) ) ? (int) $_POST['mc_current_table'] : 0;
|
229 |
-
update_option( 'mc_current_table', $mc_current_table );
|
230 |
}
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
} else {
|
236 |
-
$note = '';
|
237 |
}
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
$caps = array(
|
243 |
-
'mc_add_events' => __( 'Add Events', 'my-calendar' ),
|
244 |
-
'mc_publish_events' => __( 'Publish Events', 'my-calendar' ),
|
245 |
-
'mc_approve_events' => __( 'Approve Events', 'my-calendar' ),
|
246 |
-
'mc_manage_events' => __( 'Manage Events', 'my-calendar' ),
|
247 |
-
'mc_edit_cats' => __( 'Edit Categories', 'my-calendar' ),
|
248 |
-
'mc_edit_locations' => __( 'Edit Locations', 'my-calendar' ),
|
249 |
-
'mc_edit_styles' => __( 'Edit Styles', 'my-calendar' ),
|
250 |
-
'mc_edit_behaviors' => __( 'Edit Behaviors', 'my-calendar' ),
|
251 |
-
'mc_edit_templates' => __( 'Edit Templates', 'my-calendar' ),
|
252 |
-
'mc_edit_settings' => __( 'Edit Settings', 'my-calendar' ),
|
253 |
-
'mc_view_help' => __( 'View Help', 'my-calendar' ),
|
254 |
-
);
|
255 |
-
foreach ( $perms as $key => $value ) {
|
256 |
-
$role = get_role( $key );
|
257 |
-
if ( is_object( $role ) ) {
|
258 |
-
foreach ( $caps as $k => $v ) {
|
259 |
-
if ( isset( $value[ $k ] ) ) {
|
260 |
-
$role->add_cap( $k );
|
261 |
-
} else {
|
262 |
-
$role->remove_cap( $k );
|
263 |
-
}
|
264 |
-
}
|
265 |
-
}
|
266 |
}
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
update_option( 'mc_mini_uri', $_POST['mc_mini_uri'] );
|
275 |
-
update_option( 'mc_open_day_uri', $mc_open_day_uri );
|
276 |
-
update_option( 'mc_display_author', ( ! empty( $_POST['mc_display_author'] ) && 'on' === $_POST['mc_display_author'] ) ? 'true' : 'false' );
|
277 |
-
update_option( 'mc_show_event_vcal', ( ! empty( $_POST['mc_show_event_vcal'] ) && 'on' === $_POST['mc_show_event_vcal'] ) ? 'true' : 'false' );
|
278 |
-
update_option( 'mc_show_gcal', ( ! empty( $_POST['mc_show_gcal'] ) && 'on' === $_POST['mc_show_gcal'] ) ? 'true' : 'false' );
|
279 |
-
update_option( 'mc_show_list_info', ( ! empty( $_POST['mc_show_list_info'] ) && 'on' === $_POST['mc_show_list_info'] ) ? 'true' : 'false' );
|
280 |
-
update_option( 'mc_show_list_events', ( ! empty( $_POST['mc_show_list_events'] ) && 'on' === $_POST['mc_show_list_events'] ) ? 'true' : 'false' );
|
281 |
-
update_option( 'mc_show_months', (int) $_POST['mc_show_months'] );
|
282 |
-
// Calculate sequence for navigation elements.
|
283 |
-
$top = array();
|
284 |
-
$bottom = array();
|
285 |
-
$nav = $_POST['mc_nav'];
|
286 |
-
$set = 'top';
|
287 |
-
foreach ( $nav as $n ) {
|
288 |
-
if ( 'calendar' === $n ) {
|
289 |
-
$set = 'bottom';
|
290 |
-
} else {
|
291 |
-
if ( 'top' === $set ) {
|
292 |
-
$top[] = $n;
|
293 |
-
} else {
|
294 |
-
$bottom[] = $n;
|
295 |
-
}
|
296 |
-
}
|
297 |
-
if ( 'stop' === $n ) {
|
298 |
-
break;
|
299 |
}
|
300 |
}
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
if ( isset( $_POST['mc_input'] ) ) {
|
324 |
-
$mc_input_options_administrators = ( ! empty( $_POST['mc_input_options_administrators'] ) && 'on' === $_POST['mc_input_options_administrators'] ) ? 'true' : 'false';
|
325 |
-
$mc_input_options = array(
|
326 |
-
'event_short' => ( ! empty( $_POST['mci_event_short'] ) && $_POST['mci_event_short'] ) ? 'on' : 'off',
|
327 |
-
'event_desc' => ( ! empty( $_POST['mci_event_desc'] ) && $_POST['mci_event_desc'] ) ? 'on' : 'off',
|
328 |
-
'event_category' => ( ! empty( $_POST['mci_event_category'] ) && $_POST['mci_event_category'] ) ? 'on' : 'off',
|
329 |
-
'event_image' => ( ! empty( $_POST['mci_event_image'] ) && $_POST['mci_event_image'] ) ? 'on' : 'off',
|
330 |
-
'event_link' => ( ! empty( $_POST['mci_event_link'] ) && $_POST['mci_event_link'] ) ? 'on' : 'off',
|
331 |
-
'event_recurs' => ( ! empty( $_POST['mci_event_recurs'] ) && $_POST['mci_event_recurs'] ) ? 'on' : 'off',
|
332 |
-
'event_open' => ( ! empty( $_POST['mci_event_open'] ) && $_POST['mci_event_open'] ) ? 'on' : 'off',
|
333 |
-
'event_location' => ( ! empty( $_POST['mci_event_location'] ) && $_POST['mci_event_location'] ) ? 'on' : 'off',
|
334 |
-
'event_location_dropdown' => ( ! empty( $_POST['mci_event_location_dropdown'] ) && $_POST['mci_event_location_dropdown'] ) ? 'on' : 'off',
|
335 |
-
'event_specials' => ( ! empty( $_POST['mci_event_specials'] ) && $_POST['mci_event_specials'] ) ? 'on' : 'off',
|
336 |
-
'event_access' => ( ! empty( $_POST['mci_event_access'] ) && $_POST['mci_event_access'] ) ? 'on' : 'off',
|
337 |
-
'event_host' => ( ! empty( $_POST['mci_event_host'] ) && $_POST['mci_event_host'] ) ? 'on' : 'off',
|
338 |
-
);
|
339 |
-
update_option( 'mc_input_options', $mc_input_options );
|
340 |
-
update_option( 'mc_input_options_administrators', $mc_input_options_administrators );
|
341 |
-
update_option( 'mc_skip_holidays', ( ! empty( $_POST['mc_skip_holidays'] ) && 'on' === $_POST['mc_skip_holidays'] ) ? 'true' : 'false' );
|
342 |
-
update_option( 'mc_no_fifth_week', ( ! empty( $_POST['mc_no_fifth_week'] ) && 'on' === $_POST['mc_no_fifth_week'] ) ? 'true' : 'false' );
|
343 |
-
update_option( 'mc_event_link_expires', ( ! empty( $_POST['mc_event_link_expires'] ) && 'on' === $_POST['mc_event_link_expires'] ) ? 'true' : 'false' );
|
344 |
-
mc_show_notice( __( 'Input Settings saved', 'my-calendar' ) );
|
345 |
-
}
|
346 |
-
if ( current_user_can( 'manage_network' ) && is_multisite() ) {
|
347 |
-
if ( isset( $_POST['mc_network'] ) ) {
|
348 |
-
$mc_multisite = (int) $_POST['mc_multisite'];
|
349 |
-
update_site_option( 'mc_multisite', $mc_multisite );
|
350 |
-
$mc_multisite_show = (int) $_POST['mc_multisite_show'];
|
351 |
-
update_site_option( 'mc_multisite_show', $mc_multisite_show );
|
352 |
-
mc_show_notice( __( 'Multisite settings saved', 'my-calendar' ) );
|
353 |
}
|
354 |
-
}
|
355 |
-
// custom text.
|
356 |
-
if ( isset( $_POST['mc_previous_events'] ) ) {
|
357 |
-
$mc_title_template = $_POST['mc_title_template'];
|
358 |
-
$mc_title_template_solo = $_POST['mc_title_template_solo'];
|
359 |
-
$mc_title_template_list = $_POST['mc_title_template_list'];
|
360 |
-
$mc_details_label = $_POST['mc_details_label'];
|
361 |
-
$mc_link_label = $_POST['mc_link_label'];
|
362 |
-
$mc_event_title_template = $_POST['mc_event_title_template'];
|
363 |
-
$mc_notime_text = $_POST['mc_notime_text'];
|
364 |
-
$mc_previous_events = $_POST['mc_previous_events'];
|
365 |
-
$mc_next_events = $_POST['mc_next_events'];
|
366 |
-
$mc_week_caption = $_POST['mc_week_caption'];
|
367 |
-
$mc_caption = $_POST['mc_caption'];
|
368 |
-
$templates = get_option( 'mc_templates' );
|
369 |
-
$templates['title'] = $mc_title_template;
|
370 |
-
$templates['title_solo'] = $mc_title_template_solo;
|
371 |
-
$templates['title_list'] = $mc_title_template_list;
|
372 |
-
$templates['label'] = $mc_details_label;
|
373 |
-
$templates['link'] = $mc_link_label;
|
374 |
-
update_option( 'mc_templates', $templates );
|
375 |
-
update_option( 'mc_event_title_template', $mc_event_title_template );
|
376 |
-
update_option( 'mc_notime_text', $mc_notime_text );
|
377 |
-
update_option( 'mc_week_caption', $mc_week_caption );
|
378 |
-
update_option( 'mc_next_events', $mc_next_events );
|
379 |
-
update_option( 'mc_previous_events', $mc_previous_events );
|
380 |
-
update_option( 'mc_caption', $mc_caption );
|
381 |
-
// Date/time.
|
382 |
-
update_option( 'mc_date_format', stripslashes( $_POST['mc_date_format'] ) );
|
383 |
-
update_option( 'mc_multidate_format', stripslashes( $_POST['mc_multidate_format'] ) );
|
384 |
-
update_option( 'mc_week_format', stripslashes( $_POST['mc_week_format'] ) );
|
385 |
-
update_option( 'mc_time_format', stripslashes( $_POST['mc_time_format'] ) );
|
386 |
-
update_option( 'mc_month_format', stripslashes( $_POST['mc_month_format'] ) );
|
387 |
-
mc_show_notice( __( 'Custom text settings saved', 'my-calendar' ) );
|
388 |
-
}
|
389 |
-
// Mail function by Roland.
|
390 |
-
if ( isset( $_POST['mc_email'] ) ) {
|
391 |
-
$mc_event_mail = ( ! empty( $_POST['mc_event_mail'] ) && 'on' === $_POST['mc_event_mail'] ) ? 'true' : 'false';
|
392 |
-
$mc_html_email = ( ! empty( $_POST['mc_html_email'] ) && 'on' === $_POST['mc_html_email'] ) ? 'true' : 'false';
|
393 |
-
$mc_event_mail_to = $_POST['mc_event_mail_to'];
|
394 |
-
$mc_event_mail_from = $_POST['mc_event_mail_from'];
|
395 |
-
$mc_event_mail_subject = $_POST['mc_event_mail_subject'];
|
396 |
-
$mc_event_mail_message = $_POST['mc_event_mail_message'];
|
397 |
-
$mc_event_mail_bcc = $_POST['mc_event_mail_bcc'];
|
398 |
-
update_option( 'mc_event_mail_to', $mc_event_mail_to );
|
399 |
-
update_option( 'mc_event_mail_from', $mc_event_mail_from );
|
400 |
-
update_option( 'mc_event_mail_subject', $mc_event_mail_subject );
|
401 |
-
update_option( 'mc_event_mail_message', $mc_event_mail_message );
|
402 |
-
update_option( 'mc_event_mail_bcc', $mc_event_mail_bcc );
|
403 |
-
update_option( 'mc_event_mail', $mc_event_mail );
|
404 |
-
update_option( 'mc_html_email', $mc_html_email );
|
405 |
-
mc_show_notice( __( 'Email notice settings saved', 'my-calendar' ) );
|
406 |
-
}
|
407 |
-
|
408 |
-
apply_filters( 'mc_save_settings', '', $_POST );
|
409 |
|
|
|
|
|
410 |
// Pull templates for passing into functions.
|
411 |
$templates = get_option( 'mc_templates' );
|
412 |
$mc_title_template = ( isset( $templates['title'] ) ) ? esc_attr( stripslashes( $templates['title'] ) ) : '';
|
@@ -421,7 +462,7 @@ function my_calendar_settings() {
|
|
421 |
<h1><?php _e( 'My Calendar Settings', 'my-calendar' ); ?></h1>
|
422 |
|
423 |
<div class="mc-tabs settings postbox-container jcd-wide">
|
424 |
-
|
425 |
<?php
|
426 |
if ( isset( $_POST['import'] ) && 'true' === $_POST['import'] ) {
|
427 |
$nonce = $_REQUEST['_wpnonce'];
|
@@ -468,7 +509,7 @@ function my_calendar_settings() {
|
|
468 |
</ul>
|
469 |
|
470 |
<div class="ui-sortable meta-box-sortables">
|
471 |
-
<div class="wptab postbox" aria-labelledby="tab_manage" role="tabpanel"
|
472 |
<h2><?php _e( 'My Calendar Management', 'my-calendar' ); ?></h2>
|
473 |
|
474 |
<div class="inside">
|
@@ -585,12 +626,9 @@ function mc_remote_db() {
|
|
585 |
<?php
|
586 |
}
|
587 |
?>
|
588 |
-
<li><?php mc_settings_field( 'mc_api_enabled', __( 'Enable external API.', 'my-calendar' ), '', '', array(), 'checkbox-single' );
|
589 |
<?php
|
590 |
if ( 'true' === get_option( 'mc_api_enabled' ) ) {
|
591 |
-
?>
|
592 |
-
<li>
|
593 |
-
<?php
|
594 |
$url = add_query_arg(
|
595 |
array(
|
596 |
'to' => current_time( 'Y-m-d' ),
|
@@ -600,12 +638,10 @@ function mc_remote_db() {
|
|
600 |
home_url()
|
601 |
);
|
602 |
// Translators: Linked URL to API endpoint.
|
603 |
-
printf( __( 'API URL: %s', 'my-calendar' ), '<a href="' . $url . '">' . $url . '</a>' );
|
604 |
-
?>
|
605 |
-
</li>
|
606 |
-
<?php
|
607 |
}
|
608 |
?>
|
|
|
609 |
<li><?php mc_settings_field( 'remigrate', __( 'Re-generate event occurrences table.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
|
610 |
<li><?php mc_settings_field( 'mc_drop_tables', __( 'Drop MySQL tables on uninstall', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
|
611 |
<?php
|
@@ -643,7 +679,7 @@ function mc_remote_db() {
|
|
643 |
</div>
|
644 |
</div>
|
645 |
|
646 |
-
<div class="wptab postbox" aria-labelledby="tab_text" role="tabpanel"
|
647 |
<h2><?php _e( 'Text Settings', 'my-calendar' ); ?></h2>
|
648 |
|
649 |
<div class="inside">
|
@@ -699,7 +735,7 @@ function mc_remote_db() {
|
|
699 |
</div>
|
700 |
</div>
|
701 |
|
702 |
-
<div class="wptab postbox" aria-labelledby="tab_output" role="tabpanel"
|
703 |
<h2><?php _e( 'Output Settings', 'my-calendar' ); ?></h2>
|
704 |
|
705 |
<div class="inside">
|
@@ -864,7 +900,7 @@ function mc_remote_db() {
|
|
864 |
</div>
|
865 |
</div>
|
866 |
|
867 |
-
<div class="wptab postbox" aria-labelledby="tab_input" role="tabpanel"
|
868 |
<h2><?php _e( 'Calendar Input Fields', 'my-calendar' ); ?></h2>
|
869 |
|
870 |
<div class="inside">
|
@@ -946,7 +982,7 @@ function mc_remote_db() {
|
|
946 |
<?php
|
947 |
if ( current_user_can( 'manage_network' ) && is_multisite() ) {
|
948 |
?>
|
949 |
-
<div class="wptab postbox" aria-labelledby="tab_multi" role="tabpanel"
|
950 |
<h2><?php _e( 'Multisite Settings (Network Administrators only)', 'my-calendar' ); ?></h2>
|
951 |
|
952 |
<div class="inside">
|
@@ -994,7 +1030,7 @@ function mc_remote_db() {
|
|
994 |
}
|
995 |
?>
|
996 |
|
997 |
-
<div class="wptab postbox" aria-labelledby="tab_permissions" role="tabpanel"
|
998 |
<h2><?php _e( 'My Calendar Permissions', 'my-calendar' ); ?></h2>
|
999 |
|
1000 |
<div class="inside">
|
@@ -1046,7 +1082,7 @@ function mc_remote_db() {
|
|
1046 |
</div>
|
1047 |
</div>
|
1048 |
|
1049 |
-
<div class="wptab postbox" aria-labelledby="tab_email" role="tabpanel"
|
1050 |
<h2><?php _e( 'Calendar Email Settings', 'my-calendar' ); ?></h2>
|
1051 |
|
1052 |
<div class="inside">
|
175 |
}
|
176 |
}
|
177 |
|
178 |
+
/**
|
179 |
+
* Update Management Settings.
|
180 |
+
*
|
181 |
+
* @param array $post POST data.
|
182 |
+
*/
|
183 |
+
function mc_update_management_settings( $post ) {
|
184 |
+
// Management settings.
|
185 |
+
$mc_api_enabled = ( ! empty( $post['mc_api_enabled'] ) && 'on' === $post['mc_api_enabled'] ) ? 'true' : 'false';
|
186 |
+
$mc_remote = ( ! empty( $post['mc_remote'] ) && 'on' === $post['mc_remote'] ) ? 'true' : 'false';
|
187 |
+
$mc_drop_tables = ( ! empty( $post['mc_drop_tables'] ) && 'on' === $post['mc_drop_tables'] ) ? 'true' : 'false';
|
188 |
+
// Handle My Calendar primary URL.
|
189 |
+
$mc_uri = get_option( 'mc_uri' );
|
190 |
+
if ( isset( $post['mc_uri'] ) && ! isset( $post['mc_uri_id'] ) ) {
|
191 |
+
$mc_uri = $post['mc_uri'];
|
192 |
+
} elseif ( isset( $post['mc_uri_id'] ) && is_numeric( $post['mc_uri_id'] ) ) {
|
193 |
+
if ( get_post( absint( $post['mc_uri_id'] ) ) ) {
|
194 |
+
$mc_uri = get_permalink( absint( $post['mc_uri_id'] ) );
|
195 |
+
} else {
|
196 |
+
$mc_uri = isset( $post['mc_uri'] ) ? $post['mc_uri'] : get_option( 'mc_uri' );
|
197 |
+
}
|
198 |
+
}
|
199 |
+
update_option( 'mc_use_permalinks', ( ! empty( $post['mc_use_permalinks'] ) ) ? 'true' : 'false' );
|
200 |
+
update_option( 'mc_uri', $mc_uri );
|
201 |
+
update_option( 'mc_uri_id', absint( $post['mc_uri_id'] ) );
|
202 |
+
// End handling of primary URL.
|
203 |
+
update_option( 'mc_api_enabled', $mc_api_enabled );
|
204 |
+
update_option( 'mc_remote', $mc_remote );
|
205 |
+
update_option( 'mc_drop_tables', $mc_drop_tables );
|
206 |
+
update_option( 'mc_default_sort', $post['mc_default_sort'] );
|
207 |
+
update_option( 'mc_default_direction', $post['mc_default_direction'] );
|
208 |
+
if ( 2 === (int) get_site_option( 'mc_multisite' ) ) {
|
209 |
+
$mc_current_table = ( isset( $post['mc_current_table'] ) ) ? (int) $post['mc_current_table'] : 0;
|
210 |
+
update_option( 'mc_current_table', $mc_current_table );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Update Permissions settings.
|
216 |
+
*
|
217 |
+
* @param array $post POST data.
|
218 |
+
*/
|
219 |
+
function mc_update_permissions_settings( $post ) {
|
220 |
+
$perms = $post['mc_caps'];
|
221 |
+
$caps = array(
|
222 |
+
'mc_add_events' => __( 'Add Events', 'my-calendar' ),
|
223 |
+
'mc_publish_events' => __( 'Publish Events', 'my-calendar' ),
|
224 |
+
'mc_approve_events' => __( 'Approve Events', 'my-calendar' ),
|
225 |
+
'mc_manage_events' => __( 'Manage Events', 'my-calendar' ),
|
226 |
+
'mc_edit_cats' => __( 'Edit Categories', 'my-calendar' ),
|
227 |
+
'mc_edit_locations' => __( 'Edit Locations', 'my-calendar' ),
|
228 |
+
'mc_edit_styles' => __( 'Edit Styles', 'my-calendar' ),
|
229 |
+
'mc_edit_behaviors' => __( 'Edit Behaviors', 'my-calendar' ),
|
230 |
+
'mc_edit_templates' => __( 'Edit Templates', 'my-calendar' ),
|
231 |
+
'mc_edit_settings' => __( 'Edit Settings', 'my-calendar' ),
|
232 |
+
'mc_view_help' => __( 'View Help', 'my-calendar' ),
|
233 |
+
);
|
234 |
+
foreach ( $perms as $key => $value ) {
|
235 |
+
$role = get_role( $key );
|
236 |
+
if ( is_object( $role ) ) {
|
237 |
+
foreach ( $caps as $k => $v ) {
|
238 |
+
if ( isset( $value[ $k ] ) ) {
|
239 |
+
$role->add_cap( $k );
|
240 |
+
} else {
|
241 |
+
$role->remove_cap( $k );
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Update output settings.
|
250 |
+
*
|
251 |
+
* @param array $post POST data.
|
252 |
+
*/
|
253 |
+
function mc_update_output_settings( $post ) {
|
254 |
+
$mc_open_day_uri = ( ! empty( $post['mc_open_day_uri'] ) ) ? $post['mc_open_day_uri'] : '';
|
255 |
+
update_option( 'mc_open_uri', ( ! empty( $post['mc_open_uri'] ) && 'on' === $post['mc_open_uri'] && '' !== get_option( 'mc_uri', '' ) ) ? 'true' : 'false' );
|
256 |
+
update_option( 'mc_no_link', ( ! empty( $post['mc_no_link'] ) && 'on' === $post['mc_no_link'] ) ? 'true' : 'false' );
|
257 |
+
update_option( 'mc_mini_uri', $post['mc_mini_uri'] );
|
258 |
+
update_option( 'mc_open_day_uri', $mc_open_day_uri );
|
259 |
+
update_option( 'mc_display_author', ( ! empty( $post['mc_display_author'] ) && 'on' === $post['mc_display_author'] ) ? 'true' : 'false' );
|
260 |
+
update_option( 'mc_show_event_vcal', ( ! empty( $post['mc_show_event_vcal'] ) && 'on' === $post['mc_show_event_vcal'] ) ? 'true' : 'false' );
|
261 |
+
update_option( 'mc_show_gcal', ( ! empty( $post['mc_show_gcal'] ) && 'on' === $post['mc_show_gcal'] ) ? 'true' : 'false' );
|
262 |
+
update_option( 'mc_show_list_info', ( ! empty( $post['mc_show_list_info'] ) && 'on' === $post['mc_show_list_info'] ) ? 'true' : 'false' );
|
263 |
+
update_option( 'mc_show_list_events', ( ! empty( $post['mc_show_list_events'] ) && 'on' === $post['mc_show_list_events'] ) ? 'true' : 'false' );
|
264 |
+
update_option( 'mc_show_months', (int) $post['mc_show_months'] );
|
265 |
+
// Calculate sequence for navigation elements.
|
266 |
+
$top = array();
|
267 |
+
$bottom = array();
|
268 |
+
$nav = $post['mc_nav'];
|
269 |
+
$set = 'top';
|
270 |
+
foreach ( $nav as $n ) {
|
271 |
+
if ( 'calendar' === $n ) {
|
272 |
+
$set = 'bottom';
|
273 |
+
} else {
|
274 |
+
if ( 'top' === $set ) {
|
275 |
+
$top[] = $n;
|
276 |
+
} else {
|
277 |
+
$bottom[] = $n;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
if ( 'stop' === $n ) {
|
281 |
+
break;
|
282 |
+
}
|
283 |
+
}
|
284 |
+
$top = ( empty( $top ) ) ? 'none' : implode( ',', $top );
|
285 |
+
$bottom = ( empty( $bottom ) ) ? 'none' : implode( ',', $bottom );
|
286 |
+
update_option( 'mc_bottomnav', $bottom );
|
287 |
+
update_option( 'mc_topnav', $top );
|
288 |
+
update_option( 'mc_show_map', ( ! empty( $post['mc_show_map'] ) && 'on' === $post['mc_show_map'] ) ? 'true' : 'false' );
|
289 |
+
update_option( 'mc_gmap', ( ! empty( $post['mc_gmap'] ) && 'on' === $post['mc_gmap'] ) ? 'true' : 'false' );
|
290 |
+
update_option( 'mc_gmap_api_key', ( ! empty( $post['mc_gmap_api_key'] ) ) ? strip_tags( $post['mc_gmap_api_key'] ) : '' );
|
291 |
+
update_option( 'mc_show_address', ( ! empty( $post['mc_show_address'] ) && 'on' === $post['mc_show_address'] ) ? 'true' : 'false' );
|
292 |
+
update_option( 'mc_display_more', ( ! empty( $post['mc_display_more'] ) && 'on' === $post['mc_display_more'] ) ? 'true' : 'false' );
|
293 |
+
update_option( 'mc_event_registration', ( ! empty( $post['mc_event_registration'] ) && 'on' === $post['mc_event_registration'] ) ? 'true' : 'false' );
|
294 |
+
update_option( 'mc_short', ( ! empty( $post['mc_short'] ) && 'on' === $post['mc_short'] ) ? 'true' : 'false' );
|
295 |
+
update_option( 'mc_desc', ( ! empty( $post['mc_desc'] ) && 'on' === $post['mc_desc'] ) ? 'true' : 'false' );
|
296 |
+
update_option( 'mc_process_shortcodes', ( ! empty( $post['mc_process_shortcodes'] ) && 'on' === $post['mc_process_shortcodes'] ) ? 'true' : 'false' );
|
297 |
+
update_option( 'mc_event_link', ( ! empty( $post['mc_event_link'] ) && 'on' === $post['mc_event_link'] ) ? 'true' : 'false' );
|
298 |
+
update_option( 'mc_image', ( ! empty( $post['mc_image'] ) && 'on' === $post['mc_image'] ) ? 'true' : 'false' );
|
299 |
+
update_option( 'mc_show_weekends', ( ! empty( $post['mc_show_weekends'] ) && 'on' === $post['mc_show_weekends'] ) ? 'true' : 'false' );
|
300 |
+
update_option( 'mc_title', ( ! empty( $post['mc_title'] ) && 'on' === $post['mc_title'] ) ? 'true' : 'false' );
|
301 |
+
update_option( 'mc_convert', ( ! empty( $post['mc_convert'] ) ) ? $post['mc_convert'] : 'false' );
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Update input settings.
|
306 |
+
*
|
307 |
+
* @param array $post POST data.
|
308 |
+
*/
|
309 |
+
function mc_update_input_settings( $post ) {
|
310 |
+
$mc_input_options_administrators = ( ! empty( $post['mc_input_options_administrators'] ) && 'on' === $post['mc_input_options_administrators'] ) ? 'true' : 'false';
|
311 |
+
$mc_input_options = array(
|
312 |
+
'event_short' => ( ! empty( $post['mci_event_short'] ) && $post['mci_event_short'] ) ? 'on' : 'off',
|
313 |
+
'event_desc' => ( ! empty( $post['mci_event_desc'] ) && $post['mci_event_desc'] ) ? 'on' : 'off',
|
314 |
+
'event_category' => ( ! empty( $post['mci_event_category'] ) && $post['mci_event_category'] ) ? 'on' : 'off',
|
315 |
+
'event_image' => ( ! empty( $post['mci_event_image'] ) && $post['mci_event_image'] ) ? 'on' : 'off',
|
316 |
+
'event_link' => ( ! empty( $post['mci_event_link'] ) && $post['mci_event_link'] ) ? 'on' : 'off',
|
317 |
+
'event_recurs' => ( ! empty( $post['mci_event_recurs'] ) && $post['mci_event_recurs'] ) ? 'on' : 'off',
|
318 |
+
'event_open' => ( ! empty( $post['mci_event_open'] ) && $post['mci_event_open'] ) ? 'on' : 'off',
|
319 |
+
'event_location' => ( ! empty( $post['mci_event_location'] ) && $post['mci_event_location'] ) ? 'on' : 'off',
|
320 |
+
'event_location_dropdown' => ( ! empty( $post['mci_event_location_dropdown'] ) && $post['mci_event_location_dropdown'] ) ? 'on' : 'off',
|
321 |
+
'event_specials' => ( ! empty( $post['mci_event_specials'] ) && $post['mci_event_specials'] ) ? 'on' : 'off',
|
322 |
+
'event_access' => ( ! empty( $post['mci_event_access'] ) && $post['mci_event_access'] ) ? 'on' : 'off',
|
323 |
+
'event_host' => ( ! empty( $post['mci_event_host'] ) && $post['mci_event_host'] ) ? 'on' : 'off',
|
324 |
+
);
|
325 |
+
update_option( 'mc_input_options', $mc_input_options );
|
326 |
+
update_option( 'mc_input_options_administrators', $mc_input_options_administrators );
|
327 |
+
update_option( 'mc_skip_holidays', ( ! empty( $post['mc_skip_holidays'] ) && 'on' === $post['mc_skip_holidays'] ) ? 'true' : 'false' );
|
328 |
+
update_option( 'mc_no_fifth_week', ( ! empty( $post['mc_no_fifth_week'] ) && 'on' === $post['mc_no_fifth_week'] ) ? 'true' : 'false' );
|
329 |
+
update_option( 'mc_event_link_expires', ( ! empty( $post['mc_event_link_expires'] ) && 'on' === $post['mc_event_link_expires'] ) ? 'true' : 'false' );
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Update text settings.
|
334 |
+
*
|
335 |
+
* @param array $post POST data.
|
336 |
+
*/
|
337 |
+
function mc_update_text_settings( $post ) {
|
338 |
+
$mc_title_template = $post['mc_title_template'];
|
339 |
+
$mc_title_template_solo = $post['mc_title_template_solo'];
|
340 |
+
$mc_title_template_list = $post['mc_title_template_list'];
|
341 |
+
$mc_details_label = $post['mc_details_label'];
|
342 |
+
$mc_link_label = $post['mc_link_label'];
|
343 |
+
$mc_event_title_template = $post['mc_event_title_template'];
|
344 |
+
$mc_notime_text = $post['mc_notime_text'];
|
345 |
+
$mc_previous_events = $post['mc_previous_events'];
|
346 |
+
$mc_next_events = $post['mc_next_events'];
|
347 |
+
$mc_week_caption = $post['mc_week_caption'];
|
348 |
+
$mc_caption = $post['mc_caption'];
|
349 |
+
$templates = get_option( 'mc_templates' );
|
350 |
+
$templates['title'] = $mc_title_template;
|
351 |
+
$templates['title_solo'] = $mc_title_template_solo;
|
352 |
+
$templates['title_list'] = $mc_title_template_list;
|
353 |
+
$templates['label'] = $mc_details_label;
|
354 |
+
$templates['link'] = $mc_link_label;
|
355 |
+
update_option( 'mc_templates', $templates );
|
356 |
+
update_option( 'mc_event_title_template', $mc_event_title_template );
|
357 |
+
update_option( 'mc_notime_text', $mc_notime_text );
|
358 |
+
update_option( 'mc_week_caption', $mc_week_caption );
|
359 |
+
update_option( 'mc_next_events', $mc_next_events );
|
360 |
+
update_option( 'mc_previous_events', $mc_previous_events );
|
361 |
+
update_option( 'mc_caption', $mc_caption );
|
362 |
+
// Date/time.
|
363 |
+
update_option( 'mc_date_format', stripslashes( $post['mc_date_format'] ) );
|
364 |
+
update_option( 'mc_multidate_format', stripslashes( $post['mc_multidate_format'] ) );
|
365 |
+
update_option( 'mc_week_format', stripslashes( $post['mc_week_format'] ) );
|
366 |
+
update_option( 'mc_time_format', stripslashes( $post['mc_time_format'] ) );
|
367 |
+
update_option( 'mc_month_format', stripslashes( $post['mc_month_format'] ) );
|
368 |
+
}
|
369 |
+
|
370 |
/**
|
371 |
* Build settings form.
|
372 |
*/
|
388 |
echo '<li>' . __( 'Event generation completed.', 'my-calendar' ) . '</li>';
|
389 |
echo '</ol></div>';
|
390 |
}
|
391 |
+
if ( isset( $_POST['mc_manage'] ) ) {
|
392 |
+
mc_update_management_settings( $_POST );
|
393 |
+
$permalinks = get_option( 'mc_use_permalinks' );
|
394 |
+
$note = '';
|
395 |
+
if ( ( isset( $_POST['mc_use_permalinks'] ) && 'true' === get_option( 'mc_use_permalinks' ) ) && 'true' !== $permalinks ) {
|
396 |
+
$url = admin_url( 'options-permalink.php#mc_cpt_base' );
|
397 |
+
// Translators: URL to permalink settings page.
|
398 |
+
$note = ' ' . sprintf( __( 'You activated My Calendar permalinks. Go to <a href="%s">permalink settings</a> to set the base URL for My Calendar Events.', 'my-calendar' ), $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
}
|
400 |
+
mc_show_notice( __( 'My Calendar Management Settings saved', 'my-calendar' ) . $note );
|
401 |
}
|
402 |
+
if ( isset( $_POST['mc_permissions'] ) ) {
|
403 |
+
mc_update_permissions_settings( $_POST );
|
404 |
+
mc_show_notice( __( 'My Calendar Permissions Updated', 'my-calendar' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
}
|
406 |
+
// Output.
|
407 |
+
if ( isset( $_POST['mc_show_months'] ) ) {
|
408 |
+
mc_update_output_settings( $_POST );
|
409 |
+
mc_show_notice( __( 'Output Settings saved', 'my-calendar' ) );
|
|
|
|
|
410 |
}
|
411 |
+
// INPUT.
|
412 |
+
if ( isset( $_POST['mc_input'] ) ) {
|
413 |
+
mc_update_input_settings( $_POST );
|
414 |
+
mc_show_notice( __( 'Input Settings saved', 'my-calendar' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
}
|
416 |
+
if ( current_user_can( 'manage_network' ) && is_multisite() ) {
|
417 |
+
if ( isset( $_POST['mc_network'] ) ) {
|
418 |
+
$mc_multisite = (int) $_POST['mc_multisite'];
|
419 |
+
update_site_option( 'mc_multisite', $mc_multisite );
|
420 |
+
$mc_multisite_show = (int) $_POST['mc_multisite_show'];
|
421 |
+
update_site_option( 'mc_multisite_show', $mc_multisite_show );
|
422 |
+
mc_show_notice( __( 'Multisite settings saved', 'my-calendar' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
}
|
424 |
}
|
425 |
+
// custom text.
|
426 |
+
if ( isset( $_POST['mc_previous_events'] ) ) {
|
427 |
+
mc_update_text_settings( $_POST );
|
428 |
+
mc_show_notice( __( 'Custom text settings saved', 'my-calendar' ) );
|
429 |
+
}
|
430 |
+
// Mail function by Roland.
|
431 |
+
if ( isset( $_POST['mc_email'] ) ) {
|
432 |
+
$mc_event_mail = ( ! empty( $_POST['mc_event_mail'] ) && 'on' === $_POST['mc_event_mail'] ) ? 'true' : 'false';
|
433 |
+
$mc_html_email = ( ! empty( $_POST['mc_html_email'] ) && 'on' === $_POST['mc_html_email'] ) ? 'true' : 'false';
|
434 |
+
$mc_event_mail_to = $_POST['mc_event_mail_to'];
|
435 |
+
$mc_event_mail_from = $_POST['mc_event_mail_from'];
|
436 |
+
$mc_event_mail_subject = $_POST['mc_event_mail_subject'];
|
437 |
+
$mc_event_mail_message = $_POST['mc_event_mail_message'];
|
438 |
+
$mc_event_mail_bcc = $_POST['mc_event_mail_bcc'];
|
439 |
+
update_option( 'mc_event_mail_to', $mc_event_mail_to );
|
440 |
+
update_option( 'mc_event_mail_from', $mc_event_mail_from );
|
441 |
+
update_option( 'mc_event_mail_subject', $mc_event_mail_subject );
|
442 |
+
update_option( 'mc_event_mail_message', $mc_event_mail_message );
|
443 |
+
update_option( 'mc_event_mail_bcc', $mc_event_mail_bcc );
|
444 |
+
update_option( 'mc_event_mail', $mc_event_mail );
|
445 |
+
update_option( 'mc_html_email', $mc_html_email );
|
446 |
+
mc_show_notice( __( 'Email notice settings saved', 'my-calendar' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
|
449 |
+
$settings = apply_filters( 'mc_save_settings', '', $_POST );
|
450 |
+
}
|
451 |
// Pull templates for passing into functions.
|
452 |
$templates = get_option( 'mc_templates' );
|
453 |
$mc_title_template = ( isset( $templates['title'] ) ) ? esc_attr( stripslashes( $templates['title'] ) ) : '';
|
462 |
<h1><?php _e( 'My Calendar Settings', 'my-calendar' ); ?></h1>
|
463 |
|
464 |
<div class="mc-tabs settings postbox-container jcd-wide">
|
465 |
+
<div class="metabox-holder">
|
466 |
<?php
|
467 |
if ( isset( $_POST['import'] ) && 'true' === $_POST['import'] ) {
|
468 |
$nonce = $_REQUEST['_wpnonce'];
|
509 |
</ul>
|
510 |
|
511 |
<div class="ui-sortable meta-box-sortables">
|
512 |
+
<div class="wptab postbox" tabindex="-1" aria-labelledby="tab_manage" role="tabpanel" id="my-calendar-manage">
|
513 |
<h2><?php _e( 'My Calendar Management', 'my-calendar' ); ?></h2>
|
514 |
|
515 |
<div class="inside">
|
626 |
<?php
|
627 |
}
|
628 |
?>
|
629 |
+
<li><?php mc_settings_field( 'mc_api_enabled', __( 'Enable external API.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?>
|
630 |
<?php
|
631 |
if ( 'true' === get_option( 'mc_api_enabled' ) ) {
|
|
|
|
|
|
|
632 |
$url = add_query_arg(
|
633 |
array(
|
634 |
'to' => current_time( 'Y-m-d' ),
|
638 |
home_url()
|
639 |
);
|
640 |
// Translators: Linked URL to API endpoint.
|
641 |
+
printf( ' <code>' . __( 'API URL: %s', 'my-calendar' ) . '</code>', '<a href="' . esc_html( $url ) . '">' . esc_url( $url ) . '</a>' );
|
|
|
|
|
|
|
642 |
}
|
643 |
?>
|
644 |
+
</li>
|
645 |
<li><?php mc_settings_field( 'remigrate', __( 'Re-generate event occurrences table.', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
|
646 |
<li><?php mc_settings_field( 'mc_drop_tables', __( 'Drop MySQL tables on uninstall', 'my-calendar' ), '', '', array(), 'checkbox-single' ); ?></li>
|
647 |
<?php
|
679 |
</div>
|
680 |
</div>
|
681 |
|
682 |
+
<div class="wptab postbox initial-hidden" tabindex="-1" aria-labelledby="tab_text" role="tabpanel" id="my-calendar-text">
|
683 |
<h2><?php _e( 'Text Settings', 'my-calendar' ); ?></h2>
|
684 |
|
685 |
<div class="inside">
|
735 |
</div>
|
736 |
</div>
|
737 |
|
738 |
+
<div class="wptab postbox initial-hidden" tabindex="-1" aria-labelledby="tab_output" role="tabpanel" id="mc-output">
|
739 |
<h2><?php _e( 'Output Settings', 'my-calendar' ); ?></h2>
|
740 |
|
741 |
<div class="inside">
|
900 |
</div>
|
901 |
</div>
|
902 |
|
903 |
+
<div class="wptab postbox initial-hidden" tabindex="-1" aria-labelledby="tab_input" role="tabpanel" id="my-calendar-input">
|
904 |
<h2><?php _e( 'Calendar Input Fields', 'my-calendar' ); ?></h2>
|
905 |
|
906 |
<div class="inside">
|
982 |
<?php
|
983 |
if ( current_user_can( 'manage_network' ) && is_multisite() ) {
|
984 |
?>
|
985 |
+
<div class="wptab postbox initial-hidden" tabindex="-1" aria-labelledby="tab_multi" role="tabpanel" id="my-calendar-multisite">
|
986 |
<h2><?php _e( 'Multisite Settings (Network Administrators only)', 'my-calendar' ); ?></h2>
|
987 |
|
988 |
<div class="inside">
|
1030 |
}
|
1031 |
?>
|
1032 |
|
1033 |
+
<div class="wptab postbox initial-hidden" tabindex="-1" aria-labelledby="tab_permissions" role="tabpanel" id="my-calendar-permissions">
|
1034 |
<h2><?php _e( 'My Calendar Permissions', 'my-calendar' ); ?></h2>
|
1035 |
|
1036 |
<div class="inside">
|
1082 |
</div>
|
1083 |
</div>
|
1084 |
|
1085 |
+
<div class="wptab postbox initial-hidden" tabindex="-1" aria-labelledby="tab_email" role="tabpanel" id="my-calendar-email">
|
1086 |
<h2><?php _e( 'Calendar Email Settings', 'my-calendar' ); ?></h2>
|
1087 |
|
1088 |
<div class="inside">
|
my-calendar-templates.php
CHANGED
@@ -441,7 +441,7 @@ function mc_create_tags( $event, $context = 'filters' ) {
|
|
441 |
$e['time'],
|
442 |
);
|
443 |
|
444 |
-
$classes = mc_event_classes( $event,
|
445 |
$nofollow = ( stripos( $classes, 'past-event' ) !== false ) ? 'rel="nofollow"' : '';
|
446 |
|
447 |
$e_label = str_replace( $tags, $replacements, $e_template );
|
441 |
$e['time'],
|
442 |
);
|
443 |
|
444 |
+
$classes = mc_event_classes( $event, 'template' );
|
445 |
$nofollow = ( stripos( $classes, 'past-event' ) !== false ) ? 'rel="nofollow"' : '';
|
446 |
|
447 |
$e_label = str_replace( $tags, $replacements, $e_template );
|
my-calendar-widgets.php
CHANGED
@@ -195,7 +195,7 @@ function my_calendar_upcoming_events( $args ) {
|
|
195 |
$date = mc_date( 'Y-m-d H:i', strtotime( $details['dtstart'], false ) );
|
196 |
$class = ( true === my_calendar_date_comp( $date, $today ) ) ? 'past-event' : 'future-event';
|
197 |
$category = mc_category_class( $details, 'mc_' );
|
198 |
-
$classes = mc_event_classes( $event,
|
199 |
|
200 |
$prepend = apply_filters( 'mc_event_upcoming_before', "<li class='$class $category $classes'>", $class, $category );
|
201 |
$append = apply_filters( 'mc_event_upcoming_after', '</li>', $class, $category );
|
@@ -411,7 +411,7 @@ function mc_produce_upcoming_events( $events, $template, $type = 'list', $order
|
|
411 |
$date = mc_date( 'Y-m-d H:i:s', strtotime( $details['dtstart'] ), false );
|
412 |
$class = ( true === my_calendar_date_comp( $date, $today . ' ' . current_time( 'H:i' ) ) ) ? 'past-event' : 'future-event';
|
413 |
$category = mc_category_class( $details, 'mc_' );
|
414 |
-
$classes = mc_event_classes( $event,
|
415 |
|
416 |
if ( my_calendar_date_equal( $date, $today ) ) {
|
417 |
$class = 'today';
|
195 |
$date = mc_date( 'Y-m-d H:i', strtotime( $details['dtstart'], false ) );
|
196 |
$class = ( true === my_calendar_date_comp( $date, $today ) ) ? 'past-event' : 'future-event';
|
197 |
$category = mc_category_class( $details, 'mc_' );
|
198 |
+
$classes = mc_event_classes( $event, 'upcoming' );
|
199 |
|
200 |
$prepend = apply_filters( 'mc_event_upcoming_before', "<li class='$class $category $classes'>", $class, $category );
|
201 |
$append = apply_filters( 'mc_event_upcoming_after', '</li>', $class, $category );
|
411 |
$date = mc_date( 'Y-m-d H:i:s', strtotime( $details['dtstart'] ), false );
|
412 |
$class = ( true === my_calendar_date_comp( $date, $today . ' ' . current_time( 'H:i' ) ) ) ? 'past-event' : 'future-event';
|
413 |
$category = mc_category_class( $details, 'mc_' );
|
414 |
+
$classes = mc_event_classes( $event, 'upcoming' );
|
415 |
|
416 |
if ( my_calendar_date_equal( $date, $today ) ) {
|
417 |
$class = 'today';
|
my-calendar.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package MyCalendar
|
6 |
* @author Joe Dolson
|
7 |
-
* @copyright 2009-
|
8 |
* @license GPL-2.0+
|
9 |
*
|
10 |
* @wordpress-plugin
|
@@ -17,11 +17,11 @@
|
|
17 |
* License: GPL-2.0+
|
18 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
19 |
* Domain Path: lang
|
20 |
-
* Version: 3.2.
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
-
Copyright 2009-
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
42 |
}
|
43 |
|
44 |
global $mc_version, $wpdb;
|
45 |
-
$mc_version = '3.2.
|
46 |
|
47 |
define( 'MC_DEBUG', false );
|
48 |
|
4 |
*
|
5 |
* @package MyCalendar
|
6 |
* @author Joe Dolson
|
7 |
+
* @copyright 2009-2021 Joe Dolson
|
8 |
* @license GPL-2.0+
|
9 |
*
|
10 |
* @wordpress-plugin
|
17 |
* License: GPL-2.0+
|
18 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
19 |
* Domain Path: lang
|
20 |
+
* Version: 3.2.14
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
+
Copyright 2009-2021 Joe Dolson (email : joe@joedolson.com)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
42 |
}
|
43 |
|
44 |
global $mc_version, $wpdb;
|
45 |
+
$mc_version = '3.2.14';
|
46 |
|
47 |
define( 'MC_DEBUG', false );
|
48 |
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Requires at least: 4.4
|
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
Text domain: my-calendar
|
9 |
-
Stable tag: 3.2.
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
|
@@ -84,6 +84,19 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
|
|
84 |
|
85 |
== Changelog ==
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
= 3.2.13 =
|
88 |
|
89 |
* Bug fix: Using embed targets is more complicated than expected; disable by default. Enable with 'mc_use_embed_targets' filter.
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
Text domain: my-calendar
|
9 |
+
Stable tag: 3.2.14
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Accessible WordPress event calendar plugin. Show events from multiple calendars on pages, in posts, or in widgets.
|
84 |
|
85 |
== Changelog ==
|
86 |
|
87 |
+
= 3.2.14 =
|
88 |
+
|
89 |
+
* Bug fixes: Misc. type casting issues.
|
90 |
+
* Add filters `mc_filter_events` to filter results of main event queries.
|
91 |
+
* Add $args array to `mc_searched_events` filter parameters.
|
92 |
+
* Avoid running My Calendar core functionality through My Calendar's own hooks.
|
93 |
+
* When using REST API, variables are not submitted in a POST query.
|
94 |
+
* [Performance] Move custom location query into object creation to reduce DB calls.
|
95 |
+
* Use try/catch in mc-ajax.js to handle case where href does not contain a full URL.
|
96 |
+
* Autocomplete support for locations in admin.
|
97 |
+
* Reset select elements in My Calendar nav to inline.
|
98 |
+
* Minor refactoring in settings pages.
|
99 |
+
|
100 |
= 3.2.13 =
|
101 |
|
102 |
* Bug fix: Using embed targets is more complicated than expected; disable by default. Enable with 'mc_use_embed_targets' filter.
|