diff --git a/.gitignore b/.gitignore index 706e5908..a7597b20 100644 --- a/.gitignore +++ b/.gitignore @@ -47,7 +47,6 @@ local.properties [Dd]ebug/ [Rr]elease/ x64/ -build/ [Bb]in/ [Oo]bj/ @@ -195,7 +194,6 @@ $RECYCLE.BIN/ *.egg *.egg-info dist/ -build/ eggs/ parts/ var/ diff --git a/README.md b/README.md index ecb51cb5..d37c8666 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ GNU Version 2 or Any Later Version ## Releases -[Official Release Version: 2.6.0](https://github.com/ultimatemember/ultimatemember/releases/tag/2.6.0). +[Official Release Version: 2.6.1](https://github.com/ultimatemember/ultimatemember/releases/tag/2.6.1). ## Changelog diff --git a/assets/js/dropdown.min.js b/assets/js/dropdown.min.js index c5a7723e..b5e4578b 100644 --- a/assets/js/dropdown.min.js +++ b/assets/js/dropdown.min.js @@ -1 +1 @@ -function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(p){function o(e){var i={get:function(){return i},show:function(){i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=p('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler).attr("data-cloned","1"),p(window).on("resize",i.updatePosition);var e=""!==i.data.parent?i.data.parent:document.body;return p(e).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(p(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.$element.data("um-new-dropdown-show")&&i.hide(),p('div.um-new-dropdown[data-cloned="1"]').remove(),p(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e,t=i.$element.get(0).getBoundingClientRect(),n=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r=(e=""!==i.data.parent?(r=p(i.data.parent).offset(),{top:(e=i.$element.offset()).top-r.top,left:e.left-r.left}):i.$element.offset(),""!==i.data.parent?p(i.data.parent)[0].offsetWidth:window.innerWidth),a={position:"absolute",width:o+"px"};switch((""!==i.data.parent?p(i.data.parent)[0].offsetHeight:window.innerHeight)-t.bottom>n?(a.top=e.top+t.height+"px",d+="bottom"):(d+="top",a.top=e.top-n+"px"),e.left>o||e.left>r/2?(a.left=e.left+t.width-o+"px",d+="-left"):(a.left=e.left+"px",d+="-right"),d){case"bottom-right":a.borderRadius="0px 5px 5px 5px";break;case"bottom-left":a.borderRadius="5px 0px 5px 5px";break;case"top-right":a.borderRadius="5px 5px 5px 0px";break;case"top-left":a.borderRadius="5px 5px 0px 5px"}return a},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();e=p(e.currentTarget).attr("class");i.$menu.find('li a[class="'+e+'"]').trigger("click"),i.$element.data("um-new-dropdown-show")&&i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=p(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=p(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=p(i.data.element).first()),i.$dropdown=p(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),i.data=i.$menu.data(),void 0===o.screenTriggers&&(o.screenTriggers={}),o.screenTriggers[i.data.element]!==i.data.trigger&&(o.screenTriggers[i.data.element]=i.data.trigger,p(document.body).on(i.data.trigger,i.data.element,i.triggerHandler))),void 0===o.globalHandlersInitted&&(o.globalHandlersInitted=!0,p(document.body).on("click",function(e){p(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}p.fn.um_dropdownMenu=function(n){return"string"==typeof n&&n?this.map(function(e,t){t=o(t);return"function"==typeof t[n]?t[n]():t[n]}).toArray():this.each(function(e,t){o(t)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()}); \ No newline at end of file +function um_init_new_dropdown(){jQuery(".um-new-dropdown").um_dropdownMenu()}!function(p){function o(e){var i={get:function(){return i},show:function(){i.hideAll(),i.$menu=i.$element.find(".um-new-dropdown"),i.$menu.length||(i.$menu=p('div.um-new-dropdown[data-element="'+i.data.element+'"]').first()),i.$dropdown=i.$menu.clone(),i.$dropdown.on("click","li a",i.itemHandler).attr("data-cloned","1"),p(window).on("resize",i.updatePosition);var e=""!==i.data.parent?i.data.parent:document.body;return p(e).append(i.$dropdown),i.$element.trigger("um_new_dropdown_render",{dropdown_layout:i.$dropdown,trigger:i.data.trigger,element:i.data.elemen,obj:i.$element}),i.$dropdown.css(i.calculatePosition()).show(),i.$element.addClass("um-new-dropdown-shown").data("um-new-dropdown-show",!0),i},hide:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&(p(window).off("resize",i.updatePosition),i.$dropdown.remove(),i.$element.removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1)),i},hideAll:function(){return i.$element.data("um-new-dropdown-show")&&i.hide(),p('div.um-new-dropdown[data-cloned="1"]').remove(),p(".um-new-dropdown-shown").removeClass("um-new-dropdown-shown").data("um-new-dropdown-show",!1),i},calculatePosition:function(){var e,t=i.$element.get(0).getBoundingClientRect(),n=i.$dropdown.innerHeight()||150,o=i.data.width||150,d="",r=(e=""!==i.data.parent?(r=p(i.data.parent).offset(),{top:(e=i.$element.offset()).top-r.top,left:e.left-r.left}):i.$element.offset(),""!==i.data.parent?p(i.data.parent)[0].offsetWidth:window.innerWidth),a={position:"absolute",width:o+"px"};switch((""!==i.data.parent?p(i.data.parent)[0].offsetHeight:window.innerHeight)-t.bottom>n?(a.top=e.top+t.height+"px",d+="bottom"):(d+="top",a.top=e.top-n+"px"),e.left>o||e.left>r/2?(a.left=e.left+t.width-o+"px",d+="-left"):(a.left=e.left+"px",d+="-right"),d){case"bottom-right":a.borderRadius="0px 5px 5px 5px";break;case"bottom-left":a.borderRadius="5px 0px 5px 5px";break;case"top-right":a.borderRadius="5px 5px 5px 0px";break;case"top-left":a.borderRadius="5px 5px 0px 5px"}return a},updatePosition:function(){return i.$dropdown&&i.$dropdown.is(":visible")&&i.$dropdown.css(i.calculatePosition()),i},itemHandler:function(e){e.stopPropagation();e=p(e.currentTarget).attr("class");i.$menu.find('li a[class="'+e+'"]').trigger("click"),i.$element.data("um-new-dropdown-show")&&i.hide()},triggerHandler:function(e){e.stopPropagation(),i.$element=p(e.currentTarget),i.$element.data("um-new-dropdown-show")?i.hide():i.show()}};return i.$menu=p(e),i.data=i.$menu.data(),i.$element=i.$menu.closest(i.data.element),i.$element.length||(i.$element=p(i.data.element).first()),i.$dropdown=p(document.body).children('div[data-element="'+i.data.element+'"]'),void 0===i.data.initted&&(i.$menu.data("initted",!0),i.data=i.$menu.data(),void 0===o.screenTriggers&&(o.screenTriggers={}),o.screenTriggers[i.data.element]!==i.data.trigger)&&(o.screenTriggers[i.data.element]=i.data.trigger,p(document.body).on(i.data.trigger,i.data.element,i.triggerHandler)),void 0===o.globalHandlersInitted&&(o.globalHandlersInitted=!0,p(document.body).on("click",function(e){p(e.target).closest(".um-new-dropdown").length||i.hideAll()})),i}p.fn.um_dropdownMenu=function(n){return"string"==typeof n&&n?this.map(function(e,t){t=o(t);return"function"==typeof t[n]?t[n]():t[n]}).toArray():this.each(function(e,t){o(t)})}}(jQuery),jQuery(document).ready(function(e){um_init_new_dropdown()}); \ No newline at end of file diff --git a/assets/js/simplebar.min.js b/assets/js/simplebar.min.js index 86c23248..52cf1706 100644 --- a/assets/js/simplebar.min.js +++ b/assets/js/simplebar.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SimpleBar=e()}(this,function(){"use strict";function c(t){try{return!!t()}catch(t){return!0}}function C(t){return D.call(t).slice(8,-1)}function w(t){return Object(s(t))}function O(t){return 0n;)!m(r,i=e[n++])||~St(s,i)||s.push(i);return s}function e(t,e){return(t=jt[Rt(t)])==zt||t!=Nt&&("function"==typeof e?c(e):!!e)}function i(t,e){var i,r,n,s=t.target,o=t.global,a=t.stat,l=o?g:a?g[s]||Y(s,{}):(g[s]||{}).prototype;if(l)for(i in e){if(r=e[i],n=t.noTargetGet?(n=Vt(l,i))&&n.value:l[i],!Ct(o?i:s+(a?".":"#")+i,t.forced)&&void 0!==n){if(typeof r==typeof n)continue;v=p=d=f=u=void 0;for(var c=r,h=n,u=Wt(h),f=ot.f,d=yt.f,p=0;p>>0||(Zt.test(i)?16:10))}:Qt,te=(i({global:!0,forced:parseInt!=E},{parseInt:E}),RegExp.prototype.exec),ee=String.prototype.replace,x=te,ie=(p=/a/,f=/b*/g,te.call(p,"a"),te.call(f,"a"),0!==p.lastIndex||0!==f.lastIndex),re=void 0!==/()??/.exec("")[1],ne=x=ie||re?function(t){var e,i,r,n,s=this;return re&&(i=new RegExp("^"+s.source+"$(?!\\s)",function(){var t=S(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}.call(s))),ie&&(e=s.lastIndex),r=te.call(s,t),ie&&r&&(s.lastIndex=s.global?r.index+r[0].length:e),re&&r&&1")}),ae=!c(function(){var t=/(?:)/,e=t.exec,t=(t.exec=function(){return e.apply(this,arguments)},"ab".split(t));return 2!==t.length||"a"!==t[0]||"b"!==t[1]}),le=(Ht("match",1,function(r,l,c){return[function(t){var e=s(this),i=null==t?void 0:t[r];return void 0!==i?i.call(t,e):new RegExp(t)[r](String(e))},function(t){var e=c(l,t,this);if(e.done)return e.value;var i=S(t),r=String(this);if(!i.global)return Pt(i,r);for(var n=i.unicode,s=[],o=i.lastIndex=0;null!==(a=Pt(i,r));){var a=String(a[0]);""===(s[o]=a)&&(i.lastIndex=It(r,O(i.lastIndex),n)),o++}return 0===o?null:s}]}),Math.max),ce=Math.min,he=Math.floor,ue=/\$([$&`']|\d\d?|<[^>]*>)/g,fe=/\$([$&`']|\d\d?)/g;Ht("replace",2,function(n,x,E){return[function(t,e){var i=s(this),r=null==t?void 0:t[n];return void 0!==r?r.call(t,i,e):x.call(String(i),t,e)},function(t,e){var i=E(x,t,this,e);if(i.done)return i.value;for(var r,n=S(t),s=String(this),o="function"==typeof e,a=(o||(e=String(e)),n.global),l=(a&&(r=n.unicode,n.lastIndex=0),[]);null!==(d=Pt(n,s))&&(l.push(d),a);)""===String(d[0])&&(n.lastIndex=It(s,O(n.lastIndex),r));for(var c,h="",u=0,f=0;f
',t.firstElementChild),e=(document.body.appendChild(t),t.firstElementChild),i=(t.scrollLeft=0,o.getOffset(t)),r=o.getOffset(e),t=(t.scrollLeft=999,o.getOffset(e));return{isRtlScrollingInverted:i.left!==r.left&&r.left-t.left!=0,isRtlScrollbarInverted:i.left!==r.left}},o.initHtmlApi=function(){this.initDOMLoadedElements=this.initDOMLoadedElements.bind(this),"undefined"!=typeof MutationObserver&&(this.globalObserver=new MutationObserver(function(t){t.forEach(function(t){Array.prototype.forEach.call(t.addedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar||new o(t,o.getElOptions(t)):Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new o(t,o.getElOptions(t))}))}),Array.prototype.forEach.call(t.removedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar&&t.SimpleBar.unMount():Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar&&t.SimpleBar.unMount()}))})})}),this.globalObserver.observe(document,{childList:!0,subtree:!0})),"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?window.setTimeout(this.initDOMLoadedElements):(document.addEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.addEventListener("load",this.initDOMLoadedElements))},o.getElOptions=function(t){return Array.prototype.reduce.call(t.attributes,function(t,e){var i=e.name.match(/data-simplebar-(.+)/);if(i){var r=i[1].replace(/\W+(.)/g,function(t,e){return e.toUpperCase()});switch(e.value){case"true":t[r]=!0;break;case"false":t[r]=!1;break;case void 0:t[r]=!0;break;default:t[r]=e.value}}return t},{})},o.removeObserver=function(){this.globalObserver.disconnect()},o.initDOMLoadedElements=function(){document.removeEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.removeEventListener("load",this.initDOMLoadedElements),Array.prototype.forEach.call(document.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new o(t,o.getElOptions(t))})},o.getOffset=function(t){t=t.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft)}};var t=o.prototype;return t.init=function(){this.el.SimpleBar=this,ji&&(this.initDOM(),this.scrollbarWidth=de(),this.recalculate(),this.initListeners())},t.initDOM=function(){var t,e,i=this;if(Array.prototype.filter.call(this.el.children,function(t){return t.classList.contains(i.classNames.wrapper)}).length)this.wrapperEl=this.el.querySelector("."+this.classNames.wrapper),this.contentWrapperEl=this.el.querySelector("."+this.classNames.contentWrapper),this.offsetEl=this.el.querySelector("."+this.classNames.offset),this.maskEl=this.el.querySelector("."+this.classNames.mask),this.contentEl=this.el.querySelector("."+this.classNames.contentEl),this.placeholderEl=this.el.querySelector("."+this.classNames.placeholder),this.heightAutoObserverWrapperEl=this.el.querySelector("."+this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl=this.el.querySelector("."+this.classNames.heightAutoObserverEl),this.axis.x.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.horizontal),this.axis.y.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.vertical);else{for(this.wrapperEl=document.createElement("div"),this.contentWrapperEl=document.createElement("div"),this.offsetEl=document.createElement("div"),this.maskEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.placeholderEl=document.createElement("div"),this.heightAutoObserverWrapperEl=document.createElement("div"),this.heightAutoObserverEl=document.createElement("div"),this.wrapperEl.classList.add(this.classNames.wrapper),this.contentWrapperEl.classList.add(this.classNames.contentWrapper),this.offsetEl.classList.add(this.classNames.offset),this.maskEl.classList.add(this.classNames.mask),this.contentEl.classList.add(this.classNames.contentEl),this.placeholderEl.classList.add(this.classNames.placeholder),this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl);this.el.firstChild;)this.contentEl.appendChild(this.el.firstChild);this.contentWrapperEl.appendChild(this.contentEl),this.offsetEl.appendChild(this.contentWrapperEl),this.maskEl.appendChild(this.offsetEl),this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl),this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl),this.wrapperEl.appendChild(this.maskEl),this.wrapperEl.appendChild(this.placeholderEl),this.el.appendChild(this.wrapperEl)}this.axis.x.track.el&&this.axis.y.track.el||(t=document.createElement("div"),e=document.createElement("div"),t.classList.add(this.classNames.track),e.classList.add(this.classNames.scrollbar),t.appendChild(e),this.axis.x.track.el=t.cloneNode(!0),this.axis.x.track.el.classList.add(this.classNames.horizontal),this.axis.y.track.el=t.cloneNode(!0),this.axis.y.track.el.classList.add(this.classNames.vertical),this.el.appendChild(this.axis.x.track.el),this.el.appendChild(this.axis.y.track.el)),this.axis.x.scrollbar.el=this.axis.x.track.el.querySelector("."+this.classNames.scrollbar),this.axis.y.scrollbar.el=this.axis.y.track.el.querySelector("."+this.classNames.scrollbar),this.options.autoHide||(this.axis.x.scrollbar.el.classList.add(this.classNames.visible),this.axis.y.scrollbar.el.classList.add(this.classNames.visible)),this.el.setAttribute("data-simplebar","init")},t.initListeners=function(){var e=this;this.options.autoHide&&this.el.addEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.addEventListener(t,e.onPointerEvent,!0)}),this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.onWindowResize),this.resizeObserver=new Ri(this.recalculate),this.resizeObserver.observe(this.el),this.resizeObserver.observe(this.contentEl)},t.recalculate=function(){var t=this.heightAutoObserverEl.offsetHeight<=1,e=this.heightAutoObserverEl.offsetWidth<=1;this.elStyles=window.getComputedStyle(this.el),this.isRtl="rtl"===this.elStyles.direction,this.contentEl.style.padding=this.elStyles.paddingTop+" "+this.elStyles.paddingRight+" "+this.elStyles.paddingBottom+" "+this.elStyles.paddingLeft,this.wrapperEl.style.margin="-"+this.elStyles.paddingTop+" -"+this.elStyles.paddingRight+" -"+this.elStyles.paddingBottom+" -"+this.elStyles.paddingLeft,this.contentWrapperEl.style.height=t?"auto":"100%",this.placeholderEl.style.width=e?this.contentEl.offsetWidth+"px":"auto",this.placeholderEl.style.height=this.contentEl.scrollHeight+"px",this.axis.x.isOverflowing=this.contentWrapperEl.scrollWidth>this.contentWrapperEl.offsetWidth,this.axis.y.isOverflowing=this.contentWrapperEl.scrollHeight>this.contentWrapperEl.offsetHeight,this.axis.x.isOverflowing="hidden"!==this.elStyles.overflowX&&this.axis.x.isOverflowing,this.axis.y.isOverflowing="hidden"!==this.elStyles.overflowY&&this.axis.y.isOverflowing,this.axis.x.forceVisible="x"===this.options.forceVisible||!0===this.options.forceVisible,this.axis.y.forceVisible="y"===this.options.forceVisible||!0===this.options.forceVisible,this.hideNativeScrollbar(),this.axis.x.track.rect=this.axis.x.track.el.getBoundingClientRect(),this.axis.y.track.rect=this.axis.y.track.el.getBoundingClientRect(),this.axis.x.scrollbar.size=this.getScrollbarSize("x"),this.axis.y.scrollbar.size=this.getScrollbarSize("y"),this.axis.x.scrollbar.el.style.width=this.axis.x.scrollbar.size+"px",this.axis.y.scrollbar.el.style.height=this.axis.y.scrollbar.size+"px",this.positionScrollbar("x"),this.positionScrollbar("y"),this.toggleTrackVisibility("x"),this.toggleTrackVisibility("y")},t.getScrollbarSize=function(t){void 0===t&&(t="y");var e=this.scrollbarWidth?this.contentWrapperEl[this.axis[t].scrollSizeAttr]:this.contentWrapperEl[this.axis[t].scrollSizeAttr]-this.minScrollbarWidth,i=this.axis[t].track.rect[this.axis[t].sizeAttr];if(this.axis[t].isOverflowing)return t=Math.max(~~(i/e*i),this.options.scrollbarMinSize),this.options.scrollbarMaxSize?Math.min(t,this.options.scrollbarMaxSize):t},t.positionScrollbar=function(t){var e=this.contentWrapperEl[this.axis[t=void 0===t?"y":t].scrollSizeAttr],i=this.axis[t].track.rect[this.axis[t].sizeAttr],r=parseInt(this.elStyles[this.axis[t].sizeAttr],10),n=this.axis[t].scrollbar,s=this.contentWrapperEl[this.axis[t].scrollOffsetAttr],s="x"===t&&this.isRtl&&o.getRtlHelpers().isRtlScrollingInverted?-s:s,s=~~((i-n.size)*(s/(e-r))),s="x"===t&&this.isRtl&&o.getRtlHelpers().isRtlScrollbarInverted?s+(i-n.size):s;n.el.style.transform="x"===t?"translate3d("+s+"px, 0, 0)":"translate3d(0, "+s+"px, 0)"},t.toggleTrackVisibility=function(t){var e=this.axis[t=void 0===t?"y":t].track.el,i=this.axis[t].scrollbar.el;this.axis[t].isOverflowing||this.axis[t].forceVisible?(e.style.visibility="visible",this.contentWrapperEl.style[this.axis[t].overflowAttr]="scroll"):(e.style.visibility="hidden",this.contentWrapperEl.style[this.axis[t].overflowAttr]="hidden"),this.axis[t].isOverflowing?i.style.display="block":i.style.display="none"},t.hideNativeScrollbar=function(){var t;this.offsetEl.style[this.isRtl?"left":"right"]=this.axis.y.isOverflowing||this.axis.y.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.offsetEl.style.bottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.scrollbarWidth||(t=[this.isRtl?"paddingLeft":"paddingRight"],this.contentWrapperEl.style[t]=this.axis.y.isOverflowing||this.axis.y.forceVisible?this.minScrollbarWidth+"px":0,this.contentWrapperEl.style.paddingBottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?this.minScrollbarWidth+"px":0)},t.onMouseMoveForAxis=function(t){this.axis[t=void 0===t?"y":t].track.rect=this.axis[t].track.el.getBoundingClientRect(),this.axis[t].scrollbar.rect=this.axis[t].scrollbar.el.getBoundingClientRect(),this.isWithinBounds(this.axis[t].scrollbar.rect)?this.axis[t].scrollbar.el.classList.add(this.classNames.hover):this.axis[t].scrollbar.el.classList.remove(this.classNames.hover),this.isWithinBounds(this.axis[t].track.rect)?(this.showScrollbar(t),this.axis[t].track.el.classList.add(this.classNames.hover)):this.axis[t].track.el.classList.remove(this.classNames.hover)},t.onMouseLeaveForAxis=function(t){this.axis[t=void 0===t?"y":t].track.el.classList.remove(this.classNames.hover),this.axis[t].scrollbar.el.classList.remove(this.classNames.hover)},t.showScrollbar=function(t){var e=this.axis[t=void 0===t?"y":t].scrollbar.el;this.axis[t].isVisible||(e.classList.add(this.classNames.visible),this.axis[t].isVisible=!0),this.options.autoHide&&this.hideScrollbars()},t.onDragStart=function(t,e){var i=this.axis[e=void 0===e?"y":e].scrollbar.el,t="y"===e?t.pageY:t.pageX;this.axis[e].dragOffset=t-i.getBoundingClientRect()[this.axis[e].offsetAttr],this.draggedAxis=e,this.el.classList.add(this.classNames.dragging),document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.onEndDrag)},t.getContentElement=function(){return this.contentEl},t.getScrollElement=function(){return this.contentWrapperEl},t.removeListeners=function(){var e=this;this.options.autoHide&&this.el.removeEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.removeEventListener(t,e.onPointerEvent)}),this.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onWindowResize),this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver.disconnect(),this.recalculate.cancel(),this.onMouseMove.cancel(),this.hideScrollbars.cancel(),this.onWindowResize.cancel()},t.unMount=function(){this.removeListeners(),this.el.SimpleBar=null},t.isChildNode=function(t){return null!==t&&(t===this.el||this.isChildNode(t.parentNode))},t.isWithinBounds=function(t){return this.mouseX>=t.left&&this.mouseX<=t.left+t.width&&this.mouseY>=t.top&&this.mouseY<=t.top+t.height},o}();return p.defaultOptions={autoHide:!0,forceVisible:!1,classNames:{contentEl:"simplebar-content",contentWrapper:"simplebar-content-wrapper",offset:"simplebar-offset",mask:"simplebar-mask",wrapper:"simplebar-wrapper",placeholder:"simplebar-placeholder",scrollbar:"simplebar-scrollbar",track:"simplebar-track",heightAutoObserverWrapperEl:"simplebar-height-auto-observer-wrapper",heightAutoObserverEl:"simplebar-height-auto-observer",visible:"simplebar-visible",horizontal:"simplebar-horizontal",vertical:"simplebar-vertical",hover:"simplebar-hover",dragging:"simplebar-dragging"},scrollbarMinSize:25,scrollbarMaxSize:0,timeout:1e3},ji&&p.initHtmlApi(),p}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SimpleBar=e()}(this,function(){"use strict";function c(t){try{return!!t()}catch(t){return!0}}function C(t){return D.call(t).slice(8,-1)}function w(t){return Object(s(t))}function O(t){return 0n;)!m(r,i=e[n++])||~St(s,i)||s.push(i);return s}function e(t,e){return(t=jt[Rt(t)])==zt||t!=Nt&&("function"==typeof e?c(e):!!e)}function i(t,e){var i,r,n,s=t.target,o=t.global,a=t.stat,l=o?g:a?g[s]||Y(s,{}):(g[s]||{}).prototype;if(l)for(i in e){if(r=e[i],n=t.noTargetGet?(n=Vt(l,i))&&n.value:l[i],!Ct(o?i:s+(a?".":"#")+i,t.forced)&&void 0!==n){if(typeof r==typeof n)continue;v=p=d=f=u=void 0;for(var c=r,h=n,u=Wt(h),f=ot.f,d=yt.f,p=0;p>>0||(Zt.test(i)?16:10))}:Qt,te=(i({global:!0,forced:parseInt!=E},{parseInt:E}),RegExp.prototype.exec),ee=String.prototype.replace,x=te,ie=(p=/a/,f=/b*/g,te.call(p,"a"),te.call(f,"a"),0!==p.lastIndex||0!==f.lastIndex),re=void 0!==/()??/.exec("")[1],ne=x=ie||re?function(t){var e,i,r,n,s=this;return re&&(i=new RegExp("^"+s.source+"$(?!\\s)",function(){var t=S(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}.call(s))),ie&&(e=s.lastIndex),r=te.call(s,t),ie&&r&&(s.lastIndex=s.global?r.index+r[0].length:e),re&&r&&1")}),ae=!c(function(){var t=/(?:)/,e=t.exec,t=(t.exec=function(){return e.apply(this,arguments)},"ab".split(t));return 2!==t.length||"a"!==t[0]||"b"!==t[1]}),le=(Ht("match",1,function(r,l,c){return[function(t){var e=s(this),i=null==t?void 0:t[r];return void 0!==i?i.call(t,e):new RegExp(t)[r](String(e))},function(t){var e=c(l,t,this);if(e.done)return e.value;var i=S(t),r=String(this);if(!i.global)return Pt(i,r);for(var n=i.unicode,s=[],o=i.lastIndex=0;null!==(a=Pt(i,r));){var a=String(a[0]);""===(s[o]=a)&&(i.lastIndex=It(r,O(i.lastIndex),n)),o++}return 0===o?null:s}]}),Math.max),ce=Math.min,he=Math.floor,ue=/\$([$&`']|\d\d?|<[^>]*>)/g,fe=/\$([$&`']|\d\d?)/g;Ht("replace",2,function(n,x,E){return[function(t,e){var i=s(this),r=null==t?void 0:t[n];return void 0!==r?r.call(t,i,e):x.call(String(i),t,e)},function(t,e){var i=E(x,t,this,e);if(i.done)return i.value;for(var r,n=S(t),s=String(this),o="function"==typeof e,a=(o||(e=String(e)),n.global),l=(a&&(r=n.unicode,n.lastIndex=0),[]);null!==(d=Pt(n,s))&&(l.push(d),a);)""===String(d[0])&&(n.lastIndex=It(s,O(n.lastIndex),r));for(var c,h="",u=0,f=0;f
',t.firstElementChild),e=(document.body.appendChild(t),t.firstElementChild),i=(t.scrollLeft=0,o.getOffset(t)),r=o.getOffset(e),t=(t.scrollLeft=999,o.getOffset(e));return{isRtlScrollingInverted:i.left!==r.left&&r.left-t.left!=0,isRtlScrollbarInverted:i.left!==r.left}},o.initHtmlApi=function(){this.initDOMLoadedElements=this.initDOMLoadedElements.bind(this),"undefined"!=typeof MutationObserver&&(this.globalObserver=new MutationObserver(function(t){t.forEach(function(t){Array.prototype.forEach.call(t.addedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar||new o(t,o.getElOptions(t)):Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new o(t,o.getElOptions(t))}))}),Array.prototype.forEach.call(t.removedNodes,function(t){1===t.nodeType&&(t.hasAttribute("data-simplebar")?t.SimpleBar&&t.SimpleBar.unMount():Array.prototype.forEach.call(t.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar&&t.SimpleBar.unMount()}))})})}),this.globalObserver.observe(document,{childList:!0,subtree:!0})),"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?window.setTimeout(this.initDOMLoadedElements):(document.addEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.addEventListener("load",this.initDOMLoadedElements))},o.getElOptions=function(t){return Array.prototype.reduce.call(t.attributes,function(t,e){var i=e.name.match(/data-simplebar-(.+)/);if(i){var r=i[1].replace(/\W+(.)/g,function(t,e){return e.toUpperCase()});switch(e.value){case"true":t[r]=!0;break;case"false":t[r]=!1;break;case void 0:t[r]=!0;break;default:t[r]=e.value}}return t},{})},o.removeObserver=function(){this.globalObserver.disconnect()},o.initDOMLoadedElements=function(){document.removeEventListener("DOMContentLoaded",this.initDOMLoadedElements),window.removeEventListener("load",this.initDOMLoadedElements),Array.prototype.forEach.call(document.querySelectorAll("[data-simplebar]"),function(t){t.SimpleBar||new o(t,o.getElOptions(t))})},o.getOffset=function(t){t=t.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft)}};var t=o.prototype;return t.init=function(){this.el.SimpleBar=this,ji&&(this.initDOM(),this.scrollbarWidth=de(),this.recalculate(),this.initListeners())},t.initDOM=function(){var t,e,i=this;if(Array.prototype.filter.call(this.el.children,function(t){return t.classList.contains(i.classNames.wrapper)}).length)this.wrapperEl=this.el.querySelector("."+this.classNames.wrapper),this.contentWrapperEl=this.el.querySelector("."+this.classNames.contentWrapper),this.offsetEl=this.el.querySelector("."+this.classNames.offset),this.maskEl=this.el.querySelector("."+this.classNames.mask),this.contentEl=this.el.querySelector("."+this.classNames.contentEl),this.placeholderEl=this.el.querySelector("."+this.classNames.placeholder),this.heightAutoObserverWrapperEl=this.el.querySelector("."+this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl=this.el.querySelector("."+this.classNames.heightAutoObserverEl),this.axis.x.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.horizontal),this.axis.y.track.el=this.el.querySelector("."+this.classNames.track+"."+this.classNames.vertical);else{for(this.wrapperEl=document.createElement("div"),this.contentWrapperEl=document.createElement("div"),this.offsetEl=document.createElement("div"),this.maskEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.placeholderEl=document.createElement("div"),this.heightAutoObserverWrapperEl=document.createElement("div"),this.heightAutoObserverEl=document.createElement("div"),this.wrapperEl.classList.add(this.classNames.wrapper),this.contentWrapperEl.classList.add(this.classNames.contentWrapper),this.offsetEl.classList.add(this.classNames.offset),this.maskEl.classList.add(this.classNames.mask),this.contentEl.classList.add(this.classNames.contentEl),this.placeholderEl.classList.add(this.classNames.placeholder),this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl),this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl);this.el.firstChild;)this.contentEl.appendChild(this.el.firstChild);this.contentWrapperEl.appendChild(this.contentEl),this.offsetEl.appendChild(this.contentWrapperEl),this.maskEl.appendChild(this.offsetEl),this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl),this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl),this.wrapperEl.appendChild(this.maskEl),this.wrapperEl.appendChild(this.placeholderEl),this.el.appendChild(this.wrapperEl)}this.axis.x.track.el&&this.axis.y.track.el||(t=document.createElement("div"),e=document.createElement("div"),t.classList.add(this.classNames.track),e.classList.add(this.classNames.scrollbar),t.appendChild(e),this.axis.x.track.el=t.cloneNode(!0),this.axis.x.track.el.classList.add(this.classNames.horizontal),this.axis.y.track.el=t.cloneNode(!0),this.axis.y.track.el.classList.add(this.classNames.vertical),this.el.appendChild(this.axis.x.track.el),this.el.appendChild(this.axis.y.track.el)),this.axis.x.scrollbar.el=this.axis.x.track.el.querySelector("."+this.classNames.scrollbar),this.axis.y.scrollbar.el=this.axis.y.track.el.querySelector("."+this.classNames.scrollbar),this.options.autoHide||(this.axis.x.scrollbar.el.classList.add(this.classNames.visible),this.axis.y.scrollbar.el.classList.add(this.classNames.visible)),this.el.setAttribute("data-simplebar","init")},t.initListeners=function(){var e=this;this.options.autoHide&&this.el.addEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.addEventListener(t,e.onPointerEvent,!0)}),this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.onWindowResize),this.resizeObserver=new Ri(this.recalculate),this.resizeObserver.observe(this.el),this.resizeObserver.observe(this.contentEl)},t.recalculate=function(){var t=this.heightAutoObserverEl.offsetHeight<=1,e=this.heightAutoObserverEl.offsetWidth<=1;this.elStyles=window.getComputedStyle(this.el),this.isRtl="rtl"===this.elStyles.direction,this.contentEl.style.padding=this.elStyles.paddingTop+" "+this.elStyles.paddingRight+" "+this.elStyles.paddingBottom+" "+this.elStyles.paddingLeft,this.wrapperEl.style.margin="-"+this.elStyles.paddingTop+" -"+this.elStyles.paddingRight+" -"+this.elStyles.paddingBottom+" -"+this.elStyles.paddingLeft,this.contentWrapperEl.style.height=t?"auto":"100%",this.placeholderEl.style.width=e?this.contentEl.offsetWidth+"px":"auto",this.placeholderEl.style.height=this.contentEl.scrollHeight+"px",this.axis.x.isOverflowing=this.contentWrapperEl.scrollWidth>this.contentWrapperEl.offsetWidth,this.axis.y.isOverflowing=this.contentWrapperEl.scrollHeight>this.contentWrapperEl.offsetHeight,this.axis.x.isOverflowing="hidden"!==this.elStyles.overflowX&&this.axis.x.isOverflowing,this.axis.y.isOverflowing="hidden"!==this.elStyles.overflowY&&this.axis.y.isOverflowing,this.axis.x.forceVisible="x"===this.options.forceVisible||!0===this.options.forceVisible,this.axis.y.forceVisible="y"===this.options.forceVisible||!0===this.options.forceVisible,this.hideNativeScrollbar(),this.axis.x.track.rect=this.axis.x.track.el.getBoundingClientRect(),this.axis.y.track.rect=this.axis.y.track.el.getBoundingClientRect(),this.axis.x.scrollbar.size=this.getScrollbarSize("x"),this.axis.y.scrollbar.size=this.getScrollbarSize("y"),this.axis.x.scrollbar.el.style.width=this.axis.x.scrollbar.size+"px",this.axis.y.scrollbar.el.style.height=this.axis.y.scrollbar.size+"px",this.positionScrollbar("x"),this.positionScrollbar("y"),this.toggleTrackVisibility("x"),this.toggleTrackVisibility("y")},t.getScrollbarSize=function(t){void 0===t&&(t="y");var e=this.scrollbarWidth?this.contentWrapperEl[this.axis[t].scrollSizeAttr]:this.contentWrapperEl[this.axis[t].scrollSizeAttr]-this.minScrollbarWidth,i=this.axis[t].track.rect[this.axis[t].sizeAttr];if(this.axis[t].isOverflowing)return t=Math.max(~~(i/e*i),this.options.scrollbarMinSize),this.options.scrollbarMaxSize?Math.min(t,this.options.scrollbarMaxSize):t},t.positionScrollbar=function(t){var e=this.contentWrapperEl[this.axis[t=void 0===t?"y":t].scrollSizeAttr],i=this.axis[t].track.rect[this.axis[t].sizeAttr],r=parseInt(this.elStyles[this.axis[t].sizeAttr],10),n=this.axis[t].scrollbar,s=this.contentWrapperEl[this.axis[t].scrollOffsetAttr],s="x"===t&&this.isRtl&&o.getRtlHelpers().isRtlScrollingInverted?-s:s,s=~~((i-n.size)*(s/(e-r))),s="x"===t&&this.isRtl&&o.getRtlHelpers().isRtlScrollbarInverted?s+(i-n.size):s;n.el.style.transform="x"===t?"translate3d("+s+"px, 0, 0)":"translate3d(0, "+s+"px, 0)"},t.toggleTrackVisibility=function(t){var e=this.axis[t=void 0===t?"y":t].track.el,i=this.axis[t].scrollbar.el;this.axis[t].isOverflowing||this.axis[t].forceVisible?(e.style.visibility="visible",this.contentWrapperEl.style[this.axis[t].overflowAttr]="scroll"):(e.style.visibility="hidden",this.contentWrapperEl.style[this.axis[t].overflowAttr]="hidden"),this.axis[t].isOverflowing?i.style.display="block":i.style.display="none"},t.hideNativeScrollbar=function(){var t;this.offsetEl.style[this.isRtl?"left":"right"]=this.axis.y.isOverflowing||this.axis.y.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.offsetEl.style.bottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?"-"+(this.scrollbarWidth||this.minScrollbarWidth)+"px":0,this.scrollbarWidth||(t=[this.isRtl?"paddingLeft":"paddingRight"],this.contentWrapperEl.style[t]=this.axis.y.isOverflowing||this.axis.y.forceVisible?this.minScrollbarWidth+"px":0,this.contentWrapperEl.style.paddingBottom=this.axis.x.isOverflowing||this.axis.x.forceVisible?this.minScrollbarWidth+"px":0)},t.onMouseMoveForAxis=function(t){this.axis[t=void 0===t?"y":t].track.rect=this.axis[t].track.el.getBoundingClientRect(),this.axis[t].scrollbar.rect=this.axis[t].scrollbar.el.getBoundingClientRect(),this.isWithinBounds(this.axis[t].scrollbar.rect)?this.axis[t].scrollbar.el.classList.add(this.classNames.hover):this.axis[t].scrollbar.el.classList.remove(this.classNames.hover),this.isWithinBounds(this.axis[t].track.rect)?(this.showScrollbar(t),this.axis[t].track.el.classList.add(this.classNames.hover)):this.axis[t].track.el.classList.remove(this.classNames.hover)},t.onMouseLeaveForAxis=function(t){this.axis[t=void 0===t?"y":t].track.el.classList.remove(this.classNames.hover),this.axis[t].scrollbar.el.classList.remove(this.classNames.hover)},t.showScrollbar=function(t){var e=this.axis[t=void 0===t?"y":t].scrollbar.el;this.axis[t].isVisible||(e.classList.add(this.classNames.visible),this.axis[t].isVisible=!0),this.options.autoHide&&this.hideScrollbars()},t.onDragStart=function(t,e){var i=this.axis[e=void 0===e?"y":e].scrollbar.el,t="y"===e?t.pageY:t.pageX;this.axis[e].dragOffset=t-i.getBoundingClientRect()[this.axis[e].offsetAttr],this.draggedAxis=e,this.el.classList.add(this.classNames.dragging),document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.onEndDrag)},t.getContentElement=function(){return this.contentEl},t.getScrollElement=function(){return this.contentWrapperEl},t.removeListeners=function(){var e=this;this.options.autoHide&&this.el.removeEventListener("mouseenter",this.onMouseEnter),["mousedown","click","dblclick","touchstart","touchend","touchmove"].forEach(function(t){e.el.removeEventListener(t,e.onPointerEvent)}),this.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseleave",this.onMouseLeave),this.contentWrapperEl.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onWindowResize),this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver.disconnect(),this.recalculate.cancel(),this.onMouseMove.cancel(),this.hideScrollbars.cancel(),this.onWindowResize.cancel()},t.unMount=function(){this.removeListeners(),this.el.SimpleBar=null},t.isChildNode=function(t){return null!==t&&(t===this.el||this.isChildNode(t.parentNode))},t.isWithinBounds=function(t){return this.mouseX>=t.left&&this.mouseX<=t.left+t.width&&this.mouseY>=t.top&&this.mouseY<=t.top+t.height},o}();return p.defaultOptions={autoHide:!0,forceVisible:!1,classNames:{contentEl:"simplebar-content",contentWrapper:"simplebar-content-wrapper",offset:"simplebar-offset",mask:"simplebar-mask",wrapper:"simplebar-wrapper",placeholder:"simplebar-placeholder",scrollbar:"simplebar-scrollbar",track:"simplebar-track",heightAutoObserverWrapperEl:"simplebar-height-auto-observer-wrapper",heightAutoObserverEl:"simplebar-height-auto-observer",visible:"simplebar-visible",horizontal:"simplebar-horizontal",vertical:"simplebar-vertical",hover:"simplebar-hover",dragging:"simplebar-dragging"},scrollbarMinSize:25,scrollbarMaxSize:0,timeout:1e3},ji&&p.initHtmlApi(),p}); \ No newline at end of file diff --git a/assets/js/um-blocks.js b/assets/js/um-blocks.js new file mode 100644 index 00000000..2b258d3b --- /dev/null +++ b/assets/js/um-blocks.js @@ -0,0 +1,79 @@ +jQuery(window).on( 'load', function($) { + var observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + jQuery(mutation.addedNodes).find('.um.um-directory').each(function() { + jQuery('.um-directory input, .um-directory select, .um-directory button').attr('disabled', 'disabled'); + jQuery('.um-directory a').attr('href', ''); + + if ( typeof( jQuery.fn.select2 ) === 'function' ) { + jQuery(".um-s1").each( function( e ) { + var obj = jQuery(this); + obj.select2({ + allowClear: true, + dropdownParent: obj.parent() + }).on( 'change', unselectEmptyOption ); + } ); + + jQuery(".um-s2").each( function( e ) { + var obj = jQuery(this); + + // fix https://github.com/ultimatemember/ultimatemember/issues/941 + // using .um-custom-shortcode-tab class as temporarily solution + var atts = {}; + if ( obj.parents('.um-custom-shortcode-tab').length ) { + atts = { + allowClear: false + }; + } else { + atts = { + allowClear: false, + minimumResultsForSearch: 10, + dropdownParent: obj.parent() + }; + } + obj.select2( atts ).on( 'change', unselectEmptyOption ); + } ); + + jQuery(".um-s3").each( function( e ) { + var obj = jQuery(this); + + obj.select2({ + allowClear: false, + minimumResultsForSearch: -1, + dropdownParent: obj.parent() + }).on( 'change', unselectEmptyOption ); + } ); + } + }); + jQuery(mutation.addedNodes).find('.um.um-profile').each(function() { + jQuery('.um-profile input, .um-profile select, .um-profile button').attr('disabled', 'disabled'); + jQuery('.um-profile a').attr('href', ''); + }); + jQuery(mutation.addedNodes).find('.um.um-account').each(function() { + jQuery('.um-account input, .um-account select, .um-account button').attr('disabled', 'disabled'); + jQuery('.um-account a').attr('href', ''); + }); + jQuery(mutation.addedNodes).find('.um.um-password').each(function() { + jQuery('.um-password input, .um-password select, .um-password button').attr('disabled', 'disabled'); + jQuery('.um-password a').attr('href', ''); + }); + }); + }); + + observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true}); + +}); + +function unselectEmptyOption( e ) { + var $element = jQuery( e.currentTarget ); + var $selected = $element.find(':selected'); + + if ( $selected.length > 1 ) { + $selected.each( function ( i, option ) { + if ( option.value === '' ) { + option.selected = false; + $element.trigger( 'change' ); + } + }); + } +}`` diff --git a/assets/js/um-blocks.min.js b/assets/js/um-blocks.min.js new file mode 100644 index 00000000..9aa09172 --- /dev/null +++ b/assets/js/um-blocks.min.js @@ -0,0 +1 @@ +function unselectEmptyOption(e){var u=jQuery(e.currentTarget),e=u.find(":selected");1parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"===i.operator&&(n=Array.isArray(a)&&1===a.length?a[0]:a,jQuery.isNumeric(i.value)&&parseInt(n)parseInt(i.value)?u[i.owner][e]=!0:u[i.owner][e]=!1),"less than"===i.operator&&(n=Array.isArray(a)&&1===a.length?a[0]:a,jQuery.isNumeric(i.value)&&parseInt(n)")[0].getContext)},init:function(){var e=this.defaults;n.each(e,function(t,i){switch(t){case"aspectRatio":e[t]=T(I(i))||NaN;break;case"autoCropArea":e[t]=T(I(i))||.8;break;case"minWidth":case"minHeight":e[t]=T(I(i))||0;break;case"maxWidth":case"maxHeight":e[t]=T(I(i))||1/0}}),this.image={rotate:0},this.load()},load:function(){var t,i,e=this,h=this.$element,a=this.element,s=this.image,r="";h.is("img")?i=h.prop("src"):h.is("canvas")&&this.support.canvas&&(i=a.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(h.prop("crossOrigin")||this.isCrossOriginURL(i))&&(r=" crossOrigin"),this.$clone=t=n("'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,e.url=i,e.ready=$,e.build()}),t.addClass(f).prependTo("body"))},isCrossOriginURL:function(t){t=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===d.protocol&&t[2]===d.hostname&&t[3]===d.port?D:$},build:function(){var t,i=this.$element,e=this.defaults;this.ready&&(this.built&&this.unbuild(),i.one(C,e.build),t=n.Event(C),i.trigger(t),t.isDefaultPrevented()||(this.$cropper=t=n(o.TEMPLATE),i.addClass(W),this.$clone.removeClass(f).prependTo(t),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(W).prependTo(this.$cropper),this.originalImage=n.extend({},this.image)),this.$container=i.parent(),this.$container.append(t),this.$canvas=t.find(".cropper-canvas"),this.$dragger=t.find(".cropper-dragger"),this.$viewer=t.find(".cropper-viewer"),e.autoCrop?this.cropped=$:this.$dragger.addClass(W),e.dragCrop&&this.setDragMode("crop"),e.modal&&this.$canvas.addClass(c),e.dashed||this.$dragger.find(".cropper-dashed").addClass(W),e.movable||this.$dragger.find(".cropper-face").data(p,"move"),e.resizable||this.$dragger.find(".cropper-line, .cropper-point").addClass(W),this.addListeners(),this.initPreview(),this.built=$,this.update(),this.replaced=D,i.one(k,e.built),i.trigger(k)))},unbuild:function(){this.built&&(this.built=D,this.removeListeners(),this.$preview.empty(),this.$preview=g,this.$dragger=g,this.$canvas=g,this.$container=g,this.$cropper.remove(),this.$cropper=g)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,$),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(n.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,e=this.dragger,h=t.width,a=t.height,s=e.left-t.left,r=e.top-t.top;this.$viewer.find("img").css({width:h,height:a,marginLeft:-s,marginTop:-r}),this.$preview.each(function(){var t=n(this),i=t.width()/e.width;t.find("img").css({width:h*i,height:a*i,marginLeft:-s*i,marginTop:-r*i})})},addListeners:function(){var t=this.defaults;this.$element.on(R,t.dragstart).on(z,t.dragmove).on(L,t.dragend),this.$cropper.on(w,n.proxy(this.dragstart,this)).on(H,n.proxy(this.dblclick,this)),t.zoomable&&this.$cropper.on(b,n.proxy(this.wheel,this)),t.multiple?this.$cropper.on(v,n.proxy(this.dragmove,this)).on(x,n.proxy(this.dragend,this)):a.on(v,this._dragmove=i(this.dragmove,this)).on(x,this._dragend=i(this.dragend,this)),h.on(y,this._resize=i(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(R,t.dragstart).off(z,t.dragmove).off(L,t.dragend),this.$cropper.off(w,this.dragstart).off(H,this.dblclick),t.zoomable&&this.$cropper.off(b,this.wheel),t.multiple?this.$cropper.off(v,this.dragmove).off(x,this.dragend):a.off(v,this._dragmove).off(x,this._dragend),h.off(y,this._resize)},initPreview:function(){var t='';this.$preview=n(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var t=this.$container;t!==g&&(this.container={width:M(t.width(),300),height:M(t.height(),150)})},initCropper:function(){var t,i=this.container,e=this.image;0<=e.naturalWidth*i.height/e.naturalHeight-i.width?(t={width:i.width,height:i.width/e.aspectRatio,left:0}).top=(i.height-t.height)/2:(t={width:i.height*e.aspectRatio,height:i.height,top:0}).left=(i.width-t.width)/2,this.$cropper&&this.$cropper.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.cropper=t},initImage:function(){var t=this.image,i=this.cropper,e={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=n.extend({},t,e),t._width!==i.width||t._height!==i.height?n.extend(t,e):(t=n.extend({},e,t),this.replaced&&(t.ratio=e.ratio)),this.image=t,this.renderImage()},renderImage:function(t){var i=this.image;"zoom"===t&&(i.left-=(i.width-i.oldWidth)/2,i.top-=(i.height-i.oldHeight)/2),i.left=X(M(i.left,i._width-i.width),0),i.top=X(M(i.top,i._height-i.height),0),this.$clone.css({width:i.width,height:i.height,marginLeft:i.left,marginTop:i.top}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t=this.defaults,i=this.cropper,e=t.aspectRatio||this.image.aspectRatio,h=this.image.ratio,a=0<=i.height*e-i.width?{height:i.width/e,width:i.width,left:0,top:(i.height-i.width/e)/2,maxWidth:i.width,maxHeight:i.width/e}:{height:i.height,width:i.height*e,left:(i.width-i.height*e)/2,top:0,maxWidth:i.height*e,maxHeight:i.height};a.minWidth=0,a.minHeight=0,t.aspectRatio?(isFinite(t.maxWidth)?(a.maxWidth=X(a.maxWidth,t.maxWidth*h),a.maxHeight=a.maxWidth/e):isFinite(t.maxHeight)&&(a.maxHeight=X(a.maxHeight,t.maxHeight*h),a.maxWidth=a.maxHeight*e),0t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.widtht.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height').one("load",function(){s.width=this.width,s.height=this.height,e.clearRect(0,0,s.width,s.height),e.drawImage(this,0,0),h.load()})))},setData:function(t,i){var e=this.cropper,h=this.dragger,a=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!=l&&(t!==g&&!n.isEmptyObject(t)||(h=n.extend({},this.defaultDragger)),n.isPlainObject(t)&&!n.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),r(t.x)&&t.x<=e.width-a.left&&(h.left=t.x+a.left),r(t.y)&&t.y<=e.height-a.top&&(h.top=t.y+a.top),s?r(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth?(h.width=t.width,h.height=h.width/s):r(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height,h.width=h.height*s):(r(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth&&(h.width=t.width),r(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height))),this.dragger=h,this.renderDragger())},getData:function(t){var i=this.dragger,e=this.image,h={};return this.built&&(h={x:i.left-e.left,y:i.top-e.top,width:i.width,height:i.height},h=this.transformData(h,$,t)),h},transformData:function(t,e,h){var a=this.image.ratio,s={};return n.each(t,function(t,i){i=I(i),_.test(t)&&!isNaN(i)&&(s[t]=e?h?Math.round(i/a):i/a:i*a)}),s},setAspectRatio:function(t){var i="auto"===t;t=I(t),(i||!isNaN(t)&&0")[0],s=this.getData(),r="";return n.isPlainObject(t)||(e=i,i=t,t={}),t=n.extend({width:s.width,height:s.height},t),this.cropped&&this.support.canvas&&(a.width=t.width,a.height=t.height,h=a.getContext("2d"),"image/jpeg"===i&&(h.fillStyle="#fff",h.fillRect(0,0,t.width,t.height)),h.drawImage(this.$clone[0],s.x,s.y,s.width,s.height,0,0,t.width,t.height),r=a.toDataURL(i,e)),r},setDragMode:function(t){var i=this.$canvas,e=this.defaults,h=D,a=D;if(this.built&&!this.disabled){switch(t){case"crop":e.dragCrop&&(h=$,i.data(p,t));break;case"move":a=$,i.data(p,t);break;default:i.removeData(p)}i.toggleClass(m,h).toggleClass("cropper-move",a)}},enable:function(){this.built&&(this.disabled=D,this.$cropper.removeClass(u))},disable:function(){this.built&&(this.disabled=$,this.$cropper.addClass(u))},rotate:function(t){var i=this.image;t=I(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=$,t=i.rotate=(i.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(t){var i=n("")[0],e=i.getContext("2d"),h=t*Math.PI/180,t=T(t)%180,t=(90<0 6="5-canvas"><0 6="5-dragger"><1 6="5-viewer"><1 6="5-8 8-h"><1 6="5-8 8-v"><1 6="5-face" 3-2="all"><1 6="5-7 7-e" 3-2="e"><1 6="5-7 7-n" 3-2="n"><1 6="5-7 7-w" 3-2="w"><1 6="5-7 7-s" 3-2="s"><1 6="5-4 4-e" 3-2="e"><1 6="5-4 4-n" 3-2="n"><1 6="5-4 4-w" 3-2="w"><1 6="5-4 4-s" 3-2="s"><1 6="5-4 4-ne" 3-2="ne"><1 6="5-4 4-nw" 3-2="nw"><1 6="5-4 4-sw" 3-2="sw"><1 6="5-4 4-se" 3-2="se">'.replace(/\d+/g,function(t){return e[t]})),o.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:n.noop,preview:"",multiple:D,autoCrop:$,dragCrop:$,dashed:$,modal:$,movable:$,resizable:$,zoomable:$,rotatable:$,checkImageOrigin:$,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,build:g,built:g,dragstart:g,dragmove:g,dragend:g},o.setDefaults=function(t){n.extend(o.DEFAULTS,t)},o.other=n.fn.cropper,n.fn.cropper=function(e){var h,a=s(arguments,1);return this.each(function(){var t=n(this),i=t.data("cropper");i||t.data("cropper",i=new o(this,e)),"string"==typeof e&&n.isFunction(t=i[e])&&(h=t.apply(i,a))}),typeof h!=l?h:this},n.fn.cropper.Constructor=o,n.fn.cropper.setDefaults=o.setDefaults,n.fn.cropper.noConflict=function(){return n.fn.cropper=o.other,this}}); \ No newline at end of file +!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(n){"use strict";function r(t){return"number"==typeof t}function s(t,i){var e=[];return"number"==typeof i&&e.push(i),e.slice.apply(t,e)}function i(t,i){var e=s(arguments,2);return function(){return t.apply(i,e.concat(s(arguments)))}}function o(t,i){this.element=t,this.$element=n(t),this.defaults=n.extend({},o.DEFAULTS,n.isPlainObject(i)?i:{}),this.$original=g,this.ready=D,this.built=D,this.cropped=D,this.rotated=D,this.disabled=D,this.replaced=D,this.init()}var e,h=n(window),a=n(document),d=window.location,$=!0,D=!1,g=null,l="undefined",p="directive",t=".cropper",E=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,_=/^(x|y|width|height)$/,P=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,c="cropper-modal",W="cropper-hidden",m="cropper-invisible",f="cropper-crop",u="cropper-disabled",w="mousedown touchstart",v="mousemove touchmove",x="mouseup mouseleave touchend touchleave touchcancel",b="wheel mousewheel DOMMouseScroll",y="resize"+t,H="dblclick",C="build"+t,k="built"+t,R="dragstart"+t,z="dragmove"+t,L="dragend"+t,Y=Math.sqrt,X=Math.min,M=Math.max,T=Math.abs,O=Math.sin,U=Math.cos,I=parseFloat;o.prototype={constructor:o,support:{canvas:n.isFunction(n("")[0].getContext)},init:function(){var e=this.defaults;n.each(e,function(t,i){switch(t){case"aspectRatio":e[t]=T(I(i))||NaN;break;case"autoCropArea":e[t]=T(I(i))||.8;break;case"minWidth":case"minHeight":e[t]=T(I(i))||0;break;case"maxWidth":case"maxHeight":e[t]=T(I(i))||1/0}}),this.image={rotate:0},this.load()},load:function(){var t,i,e=this,h=this.$element,a=this.element,s=this.image,r="";h.is("img")?i=h.prop("src"):h.is("canvas")&&this.support.canvas&&(i=a.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(h.prop("crossOrigin")||this.isCrossOriginURL(i))&&(r=" crossOrigin"),this.$clone=t=n("'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,e.url=i,e.ready=$,e.build()}),t.addClass(m).prependTo("body"))},isCrossOriginURL:function(t){t=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===d.protocol&&t[2]===d.hostname&&t[3]===d.port?D:$},build:function(){var t,i=this.$element,e=this.defaults;this.ready&&(this.built&&this.unbuild(),i.one(C,e.build),t=n.Event(C),i.trigger(t),t.isDefaultPrevented()||(this.$cropper=t=n(o.TEMPLATE),i.addClass(W),this.$clone.removeClass(m).prependTo(t),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(W).prependTo(this.$cropper),this.originalImage=n.extend({},this.image)),this.$container=i.parent(),this.$container.append(t),this.$canvas=t.find(".cropper-canvas"),this.$dragger=t.find(".cropper-dragger"),this.$viewer=t.find(".cropper-viewer"),e.autoCrop?this.cropped=$:this.$dragger.addClass(W),e.dragCrop&&this.setDragMode("crop"),e.modal&&this.$canvas.addClass(c),e.dashed||this.$dragger.find(".cropper-dashed").addClass(W),e.movable||this.$dragger.find(".cropper-face").data(p,"move"),e.resizable||this.$dragger.find(".cropper-line, .cropper-point").addClass(W),this.addListeners(),this.initPreview(),this.built=$,this.update(),this.replaced=D,i.one(k,e.built),i.trigger(k)))},unbuild:function(){this.built&&(this.built=D,this.removeListeners(),this.$preview.empty(),this.$preview=g,this.$dragger=g,this.$canvas=g,this.$container=g,this.$cropper.remove(),this.$cropper=g)},update:function(t){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),t?(this.setData(t,$),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(n.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,e=this.dragger,h=t.width,a=t.height,s=e.left-t.left,r=e.top-t.top;this.$viewer.find("img").css({width:h,height:a,marginLeft:-s,marginTop:-r}),this.$preview.each(function(){var t=n(this),i=t.width()/e.width;t.find("img").css({width:h*i,height:a*i,marginLeft:-s*i,marginTop:-r*i})})},addListeners:function(){var t=this.defaults;this.$element.on(R,t.dragstart).on(z,t.dragmove).on(L,t.dragend),this.$cropper.on(w,n.proxy(this.dragstart,this)).on(H,n.proxy(this.dblclick,this)),t.zoomable&&this.$cropper.on(b,n.proxy(this.wheel,this)),t.multiple?this.$cropper.on(v,n.proxy(this.dragmove,this)).on(x,n.proxy(this.dragend,this)):a.on(v,this._dragmove=i(this.dragmove,this)).on(x,this._dragend=i(this.dragend,this)),h.on(y,this._resize=i(this.resize,this))},removeListeners:function(){var t=this.defaults;this.$element.off(R,t.dragstart).off(z,t.dragmove).off(L,t.dragend),this.$cropper.off(w,this.dragstart).off(H,this.dblclick),t.zoomable&&this.$cropper.off(b,this.wheel),t.multiple?this.$cropper.off(v,this.dragmove).off(x,this.dragend):a.off(v,this._dragmove).off(x,this._dragend),h.off(y,this._resize)},initPreview:function(){var t='';this.$preview=n(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var t=this.$container;t!==g&&(this.container={width:M(t.width(),300),height:M(t.height(),150)})},initCropper:function(){var t,i=this.container,e=this.image;0<=e.naturalWidth*i.height/e.naturalHeight-i.width?(t={width:i.width,height:i.width/e.aspectRatio,left:0}).top=(i.height-t.height)/2:(t={width:i.height*e.aspectRatio,height:i.height,top:0}).left=(i.width-t.width)/2,this.$cropper&&this.$cropper.css({width:t.width,height:t.height,left:t.left,top:t.top}),this.cropper=t},initImage:function(){var t=this.image,i=this.cropper,e={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=n.extend({},t,e),t._width!==i.width||t._height!==i.height?n.extend(t,e):(t=n.extend({},e,t),this.replaced&&(t.ratio=e.ratio)),this.image=t,this.renderImage()},renderImage:function(t){var i=this.image;"zoom"===t&&(i.left-=(i.width-i.oldWidth)/2,i.top-=(i.height-i.oldHeight)/2),i.left=X(M(i.left,i._width-i.width),0),i.top=X(M(i.top,i._height-i.height),0),this.$clone.css({width:i.width,height:i.height,marginLeft:i.left,marginTop:i.top}),t&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t=this.defaults,i=this.cropper,e=t.aspectRatio||this.image.aspectRatio,h=this.image.ratio,a=0<=i.height*e-i.width?{height:i.width/e,width:i.width,left:0,top:(i.height-i.width/e)/2,maxWidth:i.width,maxHeight:i.width/e}:{height:i.height,width:i.height*e,left:(i.width-i.height*e)/2,top:0,maxWidth:i.height*e,maxHeight:i.height};a.minWidth=0,a.minHeight=0,t.aspectRatio?(isFinite(t.maxWidth)?(a.maxWidth=X(a.maxWidth,t.maxWidth*h),a.maxHeight=a.maxWidth/e):isFinite(t.maxHeight)&&(a.maxHeight=X(a.maxHeight,t.maxHeight*h),a.maxWidth=a.maxHeight*e),0t.maxWidth?(t.width=t.maxWidth,t.left=t.oldLeft):t.widtht.maxHeight?(t.height=t.maxHeight,t.top=t.oldTop):t.height').one("load",function(){s.width=this.width,s.height=this.height,e.clearRect(0,0,s.width,s.height),e.drawImage(this,0,0),h.load()})))},setData:function(t,i){var e=this.cropper,h=this.dragger,a=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!=l&&(t!==g&&!n.isEmptyObject(t)||(h=n.extend({},this.defaultDragger)),n.isPlainObject(t)&&!n.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),r(t.x)&&t.x<=e.width-a.left&&(h.left=t.x+a.left),r(t.y)&&t.y<=e.height-a.top&&(h.top=t.y+a.top),s?r(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth?(h.width=t.width,h.height=h.width/s):r(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height,h.width=h.height*s):(r(t.width)&&t.width<=h.maxWidth&&t.width>=h.minWidth&&(h.width=t.width),r(t.height)&&t.height<=h.maxHeight&&t.height>=h.minHeight&&(h.height=t.height))),this.dragger=h,this.renderDragger())},getData:function(t){var i=this.dragger,e=this.image,h={};return this.built&&(h={x:i.left-e.left,y:i.top-e.top,width:i.width,height:i.height},h=this.transformData(h,$,t)),h},transformData:function(t,e,h){var a=this.image.ratio,s={};return n.each(t,function(t,i){i=I(i),_.test(t)&&!isNaN(i)&&(s[t]=e?h?Math.round(i/a):i/a:i*a)}),s},setAspectRatio:function(t){var i="auto"===t;t=I(t),(i||!isNaN(t)&&0")[0],s=this.getData(),r="";return n.isPlainObject(t)||(e=i,i=t,t={}),t=n.extend({width:s.width,height:s.height},t),this.cropped&&this.support.canvas&&(a.width=t.width,a.height=t.height,h=a.getContext("2d"),"image/jpeg"===i&&(h.fillStyle="#fff",h.fillRect(0,0,t.width,t.height)),h.drawImage(this.$clone[0],s.x,s.y,s.width,s.height,0,0,t.width,t.height),r=a.toDataURL(i,e)),r},setDragMode:function(t){var i=this.$canvas,e=this.defaults,h=D,a=D;if(this.built&&!this.disabled){switch(t){case"crop":e.dragCrop&&(h=$,i.data(p,t));break;case"move":a=$,i.data(p,t);break;default:i.removeData(p)}i.toggleClass(f,h).toggleClass("cropper-move",a)}},enable:function(){this.built&&(this.disabled=D,this.$cropper.removeClass(u))},disable:function(){this.built&&(this.disabled=$,this.$cropper.addClass(u))},rotate:function(t){var i=this.image;t=I(t)||0,this.built&&0!==t&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=$,t=i.rotate=(i.rotate+t)%360,this.replace(this.getRotatedDataURL(t),!0))},getRotatedDataURL:function(t){var i=n("")[0],e=i.getContext("2d"),h=t*Math.PI/180,t=T(t)%180,t=(90<0 6="5-canvas"><0 6="5-dragger"><1 6="5-viewer"><1 6="5-8 8-h"><1 6="5-8 8-v"><1 6="5-face" 3-2="all"><1 6="5-7 7-e" 3-2="e"><1 6="5-7 7-n" 3-2="n"><1 6="5-7 7-w" 3-2="w"><1 6="5-7 7-s" 3-2="s"><1 6="5-4 4-e" 3-2="e"><1 6="5-4 4-n" 3-2="n"><1 6="5-4 4-w" 3-2="w"><1 6="5-4 4-s" 3-2="s"><1 6="5-4 4-ne" 3-2="ne"><1 6="5-4 4-nw" 3-2="nw"><1 6="5-4 4-sw" 3-2="sw"><1 6="5-4 4-se" 3-2="se">'.replace(/\d+/g,function(t){return e[t]})),o.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:n.noop,preview:"",multiple:D,autoCrop:$,dragCrop:$,dashed:$,modal:$,movable:$,resizable:$,zoomable:$,rotatable:$,checkImageOrigin:$,minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,build:g,built:g,dragstart:g,dragmove:g,dragend:g},o.setDefaults=function(t){n.extend(o.DEFAULTS,t)},o.other=n.fn.cropper,n.fn.cropper=function(e){var h,a=s(arguments,1);return this.each(function(){var t=n(this),i=t.data("cropper");i||t.data("cropper",i=new o(this,e)),"string"==typeof e&&n.isFunction(t=i[e])&&(h=t.apply(i,a))}),typeof h!=l?h:this},n.fn.cropper.Constructor=o,n.fn.cropper.setDefaults=o.setDefaults,n.fn.cropper.noConflict=function(){return n.fn.cropper=o.other,this}}); \ No newline at end of file diff --git a/assets/js/um-functions.min.js b/assets/js/um-functions.min.js index 0e1693ac..d735ad75 100644 --- a/assets/js/um-functions.min.js +++ b/assets/js/um-functions.min.js @@ -1 +1 @@ -function UM_hide_menus(){UM.dropdown.hideAll()}function UM_domenus(){jQuery(".um-dropdown").each(function(e,t){UM.dropdown.setPosition(t)})}function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),a=jQuery("input[data-key=confirm_user_password]").val(),o=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||a?t!==a?o.removeClass("um-validate-matched").addClass("um-validate-not-matched"):o.removeClass("um-validate-not-matched").addClass("um-validate-matched"):o.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function um_responsive(){jQuery(".um").each(function(){(element_width=jQuery(this).width())<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):960'+r.data("upload_help_text")+"":"",icon=r.data("icon")?'':"",upload_text=r.data("upload_text")?''+r.data("upload_text")+"":"";var e=0;jQuery("#um_upload_single:visible").data("user_id")&&(e=jQuery("#um_upload_single:visible").data("user_id")),r.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_imageupload",key:r.data("key"),set_id:r.data("set_id"),set_mode:r.data("set_mode"),_wpnonce:r.data("nonce"),timestamp:r.data("timestamp"),user_id:e},fileName:r.data("key"),allowedTypes:r.data("allowed_types"),maxFileSize:r.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:r.data("max_size_error"),extErrorStr:r.data("extension_error"),maxFileCountErrorStr:r.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,returnType:"json",onSubmit:function(e){r.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){r.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(r.parents(".um-modal-body").append('
'+t.data.error+"
"),r.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(t.data,function(e,t){var a=r.parents(".um-modal-body").find(".um-single-image-preview img"),o=r.parents(".um-modal-body").find(".um-single-image-preview"),i=new Date;a.attr("src",t.url+"?"+i.getTime()),a.data("file",t.file),a.on("load",function(){r.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),r.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.show(0),um_modal_responsive()})})},onError:function(e){console.log(e)}})}function initFileUpload_UM(o){upload_help_text=o.data("upload_help_text")?''+o.data("upload_help_text")+"":"",icon=o.data("icon")?'':"",upload_text=o.data("upload_text")?''+o.data("upload_text")+"":"",jQuery("#um_upload_single:visible").data("user_id")&&(user_id=jQuery("#um_upload_single:visible").data("user_id")),o.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_fileupload",key:o.data("key"),set_id:o.data("set_id"),user_id:o.data("user_id"),set_mode:o.data("set_mode"),_wpnonce:o.data("nonce"),timestamp:o.data("timestamp")},fileName:o.data("key"),allowedTypes:o.data("allowed_types"),maxFileSize:o.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:o.data("max_size_error"),extErrorStr:o.data("extension_error"),maxFileCountErrorStr:o.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){o.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){o.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(o.parents(".um-modal-body").append('
'+t.data.error+"
"),o.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(t.data,function(e,t){o.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),o.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?o.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(t):"icon_bg"==e?o.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":t}):"filename"==e?o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-file",t):"original_name"==e?(o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-orignal-name",t),o.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(t)):"url"==e&&o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",t)}),setTimeout(function(){um_modal_responsive()},1e3)},onError:function(e){console.log(e)}})}function initCrop_UM(){var e,t,a=jQuery(".um-modal .um-single-image-preview img").first(),o=jQuery(".um-modal .um-single-image-preview"),i=a.parent().attr("data-crop"),r=a.parent().attr("data-min_width"),d=a.parent().attr("data-min_height"),u=a.parent().attr("data-ratio");jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")&&(u=(u=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")).split(":")[0]),a.length&&""!=a.attr("src")&&(e=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height(),a.css({height:"auto"}),o.css({height:"auto"}),jQuery(window).height()<=400?(o.css({height:e+"px","max-height":e+"px"}),a.css({height:"auto"})):(a.css({height:"auto","max-height":e+"px"}),o.css({height:a.height(),"max-height":e+"px"})),"square"==i?t={minWidth:r,minHeight:d,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){a.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}}:"cover"==i?t={minWidth:r,minHeight:d=0')))}function um_new_modal(e,t,a,o){var i,r,d,u=jQuery(".um-modal-overlay"),u=(0!==u.length&&(u.hide(),u.next(".um-modal").hide()),jQuery(".tipsy").hide(),UM.dropdown.hideAll(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),jQuery('
')),s=u.filter(".um-modal");s.append(jQuery("#"+e)),jQuery("body").append(u),a?(i=jQuery(''),r=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height(),i.on("load",function(){s.find(".um-modal-photo").html(i),s.addClass("is-photo").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}).show().children().show(),i.css({opacity:0,"max-width":r,"max-height":d}).animate({opacity:1},1e3),um_modal_responsive()})):(s.addClass("no-photo").show().children().show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible .um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible .um-single-file-upload")),um_modal_responsive())}function um_modal_responsive(){var e,t,a,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=jQuery(".um-modal:visible").not(".um-modal-hidden");r.find(".um-modal-body.photo:visible").length?(r.removeClass("uimob340"),r.removeClass("uimob500"),a=o-60,t=i-.25*i,(e=jQuery(".um-modal-photo img")).css({opacity:0}),e.css({"max-width":a}),e.css({"max-height":t}),r.css({width:e.width(),"margin-left":"-"+e.width()/2+"px"}),e.animate({opacity:1},1e3),a=(i-r.innerHeight())/2+"px",r.animate({bottom:a},300)):r.length&&(r.removeClass("uimob340"),r.removeClass("uimob500"),o<=340?(r.addClass("uimob340"),initCrop_UM(),r.animate({bottom:0},300)):o<=500?(r.addClass("uimob500"),initCrop_UM(),r.animate({bottom:0},300)):(o<=800||o<=960||960 .um-modal div[id^="um_"]').hide().appendTo("body"),jQuery("body > .um-modal, body > .um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").not(".um-modal-hidden").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").not(".um-modal-hidden").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('
'),jQuery("body").append('
'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(wp.hooks.doAction("um_before_modal_removed",jQuery(".um-popup")),jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(350<(ag_height=jQuery(window).height()-jQuery(".um-popup .um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80)&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}):jQuery(".um-popup-autogrow2:visible").length&&jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").prop("checked",!1).prop("selected",!1)}function um_selected(e,t){if(e==t)return"selected='selected'"}"object"!=typeof window.UM&&(window.UM={}),UM.dropdown={hide:function(e){e=jQuery(e);e.parents("div").find("a").removeClass("active"),e.hide()},hideAll:function(){var e=jQuery(".um-dropdown");e.parents("div").find("a").removeClass("active"),e.hide()},setPosition:function(e){var t,a=jQuery(e),o=200,e=jQuery("html").attr("dir"),i=a.attr("data-element"),r=a.attr("data-position"),d=a.attr("data-trigger"),u=i&&jQuery(i).length?jQuery(i):a.siblings("a").length?a.siblings("a").first():a.parent(),s=(u.addClass("um-trigger-menu-on-"+d),0),n=(u.outerWidth()-o)/2,m=u.outerHeight(),i=u.offset();switch(u.is(".um-profile-photo")&&(t=u.find(".um-profile-photo-img"),m=u.closest("div.uimob500").length?u.outerHeight()-t.outerHeight()/4:(n=(t.outerWidth()-o)/2,t.outerHeight()/4)),u.is(".um-cover")&&(t=u.find(".um-cover-e"),m=u.closest("div.uimob500").length?(n=(t.outerWidth()-o)/2,t.outerHeight()/2+24):(n=(t.outerWidth()-o)/2,t.outerHeight()/2+46)),"lc"===r&&"rtl"===e&&(r="rc"),u.outerWidth()'+r.data("upload_help_text")+"":"",icon=r.data("icon")?'':"",upload_text=r.data("upload_text")?''+r.data("upload_text")+"":"";var e=0;jQuery("#um_upload_single:visible").data("user_id")&&(e=jQuery("#um_upload_single:visible").data("user_id")),r.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_imageupload",key:r.data("key"),set_id:r.data("set_id"),set_mode:r.data("set_mode"),_wpnonce:r.data("nonce"),timestamp:r.data("timestamp"),user_id:e},fileName:r.data("key"),allowedTypes:r.data("allowed_types"),maxFileSize:r.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:r.data("max_size_error"),extErrorStr:r.data("extension_error"),maxFileCountErrorStr:r.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,returnType:"json",onSubmit:function(e){r.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){r.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(r.parents(".um-modal-body").append('
'+t.data.error+"
"),r.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(t.data,function(e,t){var a=r.parents(".um-modal-body").find(".um-single-image-preview img"),o=r.parents(".um-modal-body").find(".um-single-image-preview"),i=new Date;a.attr("src",t.url+"?"+i.getTime()),a.data("file",t.file),a.on("load",function(){r.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),r.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.show(0),um_modal_responsive()})})},onError:function(e){console.log(e)}})}function initFileUpload_UM(o){upload_help_text=o.data("upload_help_text")?''+o.data("upload_help_text")+"":"",icon=o.data("icon")?'':"",upload_text=o.data("upload_text")?''+o.data("upload_text")+"":"",jQuery("#um_upload_single:visible").data("user_id")&&(user_id=jQuery("#um_upload_single:visible").data("user_id")),o.uploadFile({url:wp.ajax.settings.url,method:"POST",multiple:!1,formData:{action:"um_fileupload",key:o.data("key"),set_id:o.data("set_id"),user_id:o.data("user_id"),set_mode:o.data("set_mode"),_wpnonce:o.data("nonce"),timestamp:o.data("timestamp")},fileName:o.data("key"),allowedTypes:o.data("allowed_types"),maxFileSize:o.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:o.data("max_size_error"),extErrorStr:o.data("extension_error"),maxFileCountErrorStr:o.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(e){o.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(e,t,a){o.selectedFiles=0,t.success&&0==t.success||void 0!==t.data.error?(o.parents(".um-modal-body").append('
'+t.data.error+"
"),o.parents(".um-modal-body").find(".upload-statusbar").hide(0)):jQuery.each(t.data,function(e,t){o.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),o.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),o.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==e?o.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(t):"icon_bg"==e?o.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":t}):"filename"==e?o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-file",t):"original_name"==e?(o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("data-orignal-name",t),o.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(t)):"url"==e&&o.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",t)}),setTimeout(function(){um_modal_responsive()},1e3)},onError:function(e){console.log(e)}})}function initCrop_UM(){var e,t,a=jQuery(".um-modal .um-single-image-preview img").first(),o=jQuery(".um-modal .um-single-image-preview"),i=a.parent().attr("data-crop"),r=a.parent().attr("data-min_width"),d=a.parent().attr("data-min_height"),u=a.parent().attr("data-ratio");jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")&&(u=(u=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio")).split(":")[0]),a.length&&""!=a.attr("src")&&(e=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height(),a.css({height:"auto"}),o.css({height:"auto"}),jQuery(window).height()<=400?(o.css({height:e+"px","max-height":e+"px"}),a.css({height:"auto"})):(a.css({height:"auto","max-height":e+"px"}),o.css({height:a.height(),"max-height":e+"px"})),"square"==i?t={minWidth:r,minHeight:d,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(e){a.parent().attr("data-coord",Math.round(e.x)+","+Math.round(e.y)+","+Math.round(e.width)+","+Math.round(e.height))}}:"cover"==i?t={minWidth:r,minHeight:d=0'))}function um_new_modal(e,t,a,o){var i,r,d,u=jQuery(".um-modal-overlay"),u=(0!==u.length&&(u.hide(),u.next(".um-modal").hide()),jQuery(".tipsy").hide(),UM.dropdown.hideAll(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),jQuery('
')),s=u.filter(".um-modal");s.append(jQuery("#"+e)),jQuery("body").append(u),a?(i=jQuery(''),r=jQuery(window).width()-60,d=jQuery(window).height()-.25*jQuery(window).height(),i.on("load",function(){s.find(".um-modal-photo").html(i),s.addClass("is-photo").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}).show().children().show(),i.css({opacity:0,"max-width":r,"max-height":d}).animate({opacity:1},1e3),um_modal_responsive()})):(s.addClass("no-photo").show().children().show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible .um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible .um-single-file-upload")),um_modal_responsive())}function um_modal_responsive(){var e,t,a,o=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=jQuery(".um-modal:visible").not(".um-modal-hidden");r.find(".um-modal-body.photo:visible").length?(r.removeClass("uimob340"),r.removeClass("uimob500"),a=o-60,t=i-.25*i,(e=jQuery(".um-modal-photo img")).css({opacity:0}),e.css({"max-width":a}),e.css({"max-height":t}),r.css({width:e.width(),"margin-left":"-"+e.width()/2+"px"}),e.animate({opacity:1},1e3),a=(i-r.innerHeight())/2+"px",r.animate({bottom:a},300)):r.length&&(r.removeClass("uimob340"),r.removeClass("uimob500"),o<=340?(r.addClass("uimob340"),initCrop_UM(),r.animate({bottom:0},300)):o<=500?(r.addClass("uimob500"),initCrop_UM(),r.animate({bottom:0},300)):(o<=800||o<=960||960 .um-modal div[id^="um_"]').hide().appendTo("body"),jQuery("body > .um-modal, body > .um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").not(".um-modal-hidden").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").not(".um-modal-hidden").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('
'),jQuery("body").append('
'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(wp.hooks.doAction("um_before_modal_removed",jQuery(".um-popup")),jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(350<(ag_height=jQuery(window).height()-jQuery(".um-popup .um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80)&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}):jQuery(".um-popup-autogrow2:visible").length&&jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").prop("checked",!1).prop("selected",!1)}function um_selected(e,t){if(e==t)return"selected='selected'"}"object"!=typeof window.UM&&(window.UM={}),UM.dropdown={hide:function(e){e=jQuery(e);e.parents("div").find("a").removeClass("active"),e.hide()},hideAll:function(){var e=jQuery(".um-dropdown");e.parents("div").find("a").removeClass("active"),e.hide()},setPosition:function(e){var t,a=jQuery(e),o=200,e=jQuery("html").attr("dir"),i=a.attr("data-element"),r=a.attr("data-position"),d=a.attr("data-trigger"),u=i&&jQuery(i).length?jQuery(i):a.siblings("a").length?a.siblings("a").first():a.parent(),s=(u.addClass("um-trigger-menu-on-"+d),0),n=(u.outerWidth()-o)/2,m=u.outerHeight(),i=u.offset();switch(u.is(".um-profile-photo")&&(t=u.find(".um-profile-photo-img"),m=u.closest("div.uimob500").length?u.outerHeight()-t.outerHeight()/4:(n=(t.outerWidth()-o)/2,t.outerHeight()/4)),u.is(".um-cover")&&(t=u.find(".um-cover-e"),m=u.closest("div.uimob500").length?(n=(t.outerWidth()-o)/2,t.outerHeight()/2+24):(n=(t.outerWidth()-o)/2,t.outerHeight()/2+46)),"lc"===r&&"rtl"===e&&(r="rc"),u.outerWidth()").get(0).files,h.formdata=void 0!==window.FormData,!!L.fn.prop);function r(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),L(e.target).ajaxSubmit(t))}function a(e){var t=e.target,r=L(t);if(!r.is("[type=submit],[type=image]")){var a=r.closest("[type=submit]");if(0===a.length)return;t=a[0]}var n=this;"image"==(n.clk=t).type&&(void 0!==e.offsetX?(n.clk_x=e.offsetX,n.clk_y=e.offsetY):"function"==typeof L.fn.offset?(a=r.offset(),n.clk_x=e.pageX-a.left,n.clk_y=e.pageY-a.top):(n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop)),setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function M(){var e;L.fn.ajaxSubmit.debug&&(e="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e))}L.fn.attr2=function(){if(!t)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},L.fn.ajaxSubmit=function(u){if(!this.length)return M("ajaxSubmit: skipping submit process - no element selected"),this;var A,E=this,e=("function"==typeof u?u={success:u}:void 0===u&&(u={}),A=u.type||this.attr2("method"),e=(e=(e="string"==typeof(e=u.url||this.attr2("action"))?L.trim(e):"")||window.location.href||"")&&(e.match(/^([^#]+)/)||[])[1],u=L.extend(!0,{url:e,success:L.ajaxSettings.success,type:A||L.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},u),{});if(this.trigger("form-pre-serialize",[this,u,e]),e.veto)return M("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(u.beforeSerialize&&!1===u.beforeSerialize(this,u))return M("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var t=u.traditional,n=(void 0===t&&(t=L.ajaxSettings.traditional),[]),r=this.formToArray(u.semantic,n);if(u.data&&(u.extraData=u.data,l=L.param(u.data,t)),u.beforeSubmit&&!1===u.beforeSubmit(r,this,u))return M("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[r,this,u,e]),e.veto)return M("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var a,o,i,e=L.param(r,t),s=(l&&(e=e?e+"&"+l:l),"GET"==u.type.toUpperCase()?(u.url+=(0<=u.url.indexOf("?")?"&":"?")+e,u.data=null):u.data=e,[]);u.resetForm&&s.push(function(){E.resetForm()}),u.clearForm&&s.push(function(){E.clearForm(u.includeHidden)}),!u.dataType&&u.target?(a=u.success||function(){},s.push(function(e){var t=u.replaceTarget?"replaceWith":"html";L(u.target)[t](e).each(a,arguments)})):u.success&&s.push(u.success),u.success=function(e,t,r){for(var a=u.context||this,n=0,o=s.length;n')).css({position:"absolute",top:"-1000px",left:"-1000px"}),m=f[0],p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";M("aborting upload... "+t),this.aborted=1;try{m.contentWindow.document.execCommand&&m.contentWindow.document.execCommand("Stop")}catch(e){}f.attr("src",c.iframeSrc),p.error=t,c.error&&c.error.call(c.context,p,t,e),l&&L.event.trigger("ajaxError",[p,c,t]),c.complete&&c.complete.call(c.context,p,t)}},(l=c.global)&&0==L.active++&&L.event.trigger("ajaxStart"),l&&L.event.trigger("ajaxSend",[p,c]),c.beforeSend&&!1===c.beforeSend.call(c.context,p,c))return c.global&&L.active--,v.reject(),v;if(p.aborted)return v.reject(),v;(e=i.clk)&&(r=e.name)&&!e.disabled&&(c.extraData=c.extraData||{},c.extraData[r]=e.value,"image"==e.type&&(c.extraData[r+".x"]=i.clk_x,c.extraData[r+".y"]=i.clk_y));var g=1,x=2;function b(t){var r=null;try{t.contentWindow&&(r=t.contentWindow.document)}catch(e){M("cannot get iframe.contentWindow document: "+e)}if(r)return r;try{r=t.contentDocument||t.document}catch(e){M("cannot get iframe.contentDocument: "+e),r=t.document}return r}var e=L("meta[name=csrf-token]").attr("content"),r=L("meta[name=csrf-param]").attr("content");function a(){var e=E.attr2("target"),t=E.attr2("action"),r=E.attr("enctype")||E.attr("encoding")||"multipart/form-data";i.setAttribute("target",o),A&&!/post/i.test(A)||i.setAttribute("method","POST"),t!=c.url&&i.setAttribute("action",c.url),c.skipEncodingOverride||A&&!/post/i.test(A)||E.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),c.timeout&&(h=setTimeout(function(){d=!0,S(g)},c.timeout));var a=[];try{if(c.extraData)for(var n in c.extraData)c.extraData.hasOwnProperty(n)&&(L.isPlainObject(c.extraData[n])&&c.extraData[n].hasOwnProperty("name")&&c.extraData[n].hasOwnProperty("value")?a.push(L('').val(c.extraData[n].value).appendTo(i)[0]):a.push(L('').val(c.extraData[n]).appendTo(i)[0]));c.iframeTarget||f.appendTo("body"),m.attachEvent?m.attachEvent("onload",S):m.addEventListener("load",S,!1),setTimeout(function e(){try{var t=b(m).readyState;M("state = "+t),t&&"uninitialized"==t.toLowerCase()&&setTimeout(e,50)}catch(e){M("Server abort: ",e," (",e.name,")"),S(x),h&&clearTimeout(h),h=void 0}},15);try{i.submit()}catch(e){document.createElement("form").submit.apply(i)}}finally{i.setAttribute("action",t),i.setAttribute("enctype",r),e?i.setAttribute("target",e):E.removeAttr("target"),L(a).remove()}}r&&e&&(c.extraData=c.extraData||{},c.extraData[r]=e),c.forceSync?a():setTimeout(a,10);var y,T,j,w=50;function S(t){if(!p.aborted&&!j){if((T=b(m))||(M("cannot access response document"),t=x),t===g&&p)return p.abort("timeout"),void v.reject(p,"timeout");if(t==x&&p)return p.abort("server abort"),void v.reject(p,"error","server abort");if(T&&T.location.href!=c.iframeSrc||d){m.detachEvent?m.detachEvent("onload",S):m.removeEventListener("load",S,!1);var r,t="success";try{if(d)throw"timeout";var e="xml"==c.dataType||T.XMLDocument||L.isXMLDoc(T);if(M("isXml="+e),!e&&window.opera&&(null===T.body||!T.body.innerHTML)&&--w)return M("requeing onLoad callback, DOM not available"),void setTimeout(S,250);var a,n,o,i=T.body||T.documentElement,s=(p.responseText=i?i.innerHTML:null,p.responseXML=T.XMLDocument||T,e&&(c.dataType="xml"),p.getResponseHeader=function(e){return{"content-type":c.dataType}[e.toLowerCase()]},i&&(p.status=Number(i.getAttribute("status"))||p.status,p.statusText=i.getAttribute("statusText")||p.statusText),(c.dataType||"").toLowerCase()),u=/(json|script|text)/.test(s);u||c.textarea?(a=T.getElementsByTagName("textarea")[0])?(p.responseText=a.value,p.status=Number(a.getAttribute("status"))||p.status,p.statusText=a.getAttribute("statusText")||p.statusText):u&&(n=T.getElementsByTagName("pre")[0],o=T.getElementsByTagName("body")[0],n?p.responseText=n.textContent||n.innerText:o&&(p.responseText=o.textContent||o.innerText)):"xml"==s&&!p.responseXML&&p.responseText&&(p.responseXML=k(p.responseText));try{y=D(p,s,c)}catch(e){t="parsererror",p.error=r=e||t}}catch(e){M("error caught: ",e),t="error",p.error=r=e||t}p.aborted&&(M("upload aborted"),t=null),"success"===(t=p.status?200<=p.status&&p.status<300||304===p.status?"success":"error":t)?(c.success&&c.success.call(c.context,y,"success",p),v.resolve(p.responseText,"success",p),l&&L.event.trigger("ajaxSuccess",[p,c])):t&&(void 0===r&&(r=p.statusText),c.error&&c.error.call(c.context,p,t,r),v.reject(p,"error",r),l&&L.event.trigger("ajaxError",[p,c,r])),l&&L.event.trigger("ajaxComplete",[p,c]),l&&!--L.active&&L.event.trigger("ajaxStop"),c.complete&&c.complete.call(c.context,p,t),j=!0,c.timeout&&clearTimeout(h),setTimeout(function(){c.iframeTarget?f.attr("src",c.iframeSrc):f.remove(),p.responseXML=null},100)}}}var k=L.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},s=L.parseJSON||function(e){return window.eval("("+e+")")},D=function(e,t,r){var a=e.getResponseHeader("content-type")||"",n="xml"===t||!t&&0<=a.indexOf("xml"),e=n?e.responseXML:e.responseText;return n&&"parsererror"===e.documentElement.nodeName&&L.error&&L.error("parsererror"),"string"==typeof(e=r&&r.dataFilter?r.dataFilter(e,t):e)&&("json"===t||!t&&0<=a.indexOf("json")?e=s(e):("script"===t||!t&&0<=a.indexOf("javascript"))&&L.globalEval(e)),e};return v}},L.fn.ajaxForm=function(e){var t;return(e=e||{}).delegation=e.delegation&&L.isFunction(L.fn.on),e.delegation||0!==this.length?e.delegation?(L(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,e,r).on("click.form-plugin",this.selector,e,a),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,r).bind("click.form-plugin",e,a):(t={s:this.selector,c:this.context},!L.isReady&&t.s?(M("DOM not ready, queuing ajaxForm"),L(function(){L(t.s,t.c).ajaxForm(e)})):M("terminating; zero elements found by selector"+(L.isReady?"":" (DOM not ready)")),this)},L.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},L.fn.formToArray=function(e,t){var r=[];if(0===this.length)return r;var a,n,o,i,s,u,c,l,f=this[0],m=this.attr("id"),p=e?f.getElementsByTagName("*"):f.elements;if(p&&!/MSIE [678]/.test(navigator.userAgent)&&(p=L(p).get()),!(p=m&&(m=L(':input[form="'+m+'"]').get()).length?(p||[]).concat(m):p)||!p.length)return r;for(a=0,s=p.length;a").get(0).files,h.formdata=void 0!==window.FormData,!!L.fn.prop);function a(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),L(e.target).ajaxSubmit(t))}function r(e){var t=e.target,a=L(t);if(!a.is("[type=submit],[type=image]")){var r=a.closest("[type=submit]");if(0===r.length)return;t=r[0]}var n=this;"image"==(n.clk=t).type&&(void 0!==e.offsetX?(n.clk_x=e.offsetX,n.clk_y=e.offsetY):"function"==typeof L.fn.offset?(r=a.offset(),n.clk_x=e.pageX-r.left,n.clk_y=e.pageY-r.top):(n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop)),setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function M(){var e;L.fn.ajaxSubmit.debug&&(e="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e))}L.fn.attr2=function(){var e;return t&&((e=this.prop.apply(this,arguments))&&e.jquery||"string"==typeof e)?e:this.attr.apply(this,arguments)},L.fn.ajaxSubmit=function(c){if(this.length){var A,E=this,e=("function"==typeof c?c={success:c}:void 0===c&&(c={}),A=c.type||this.attr2("method"),e=(e=(e="string"==typeof(e=c.url||this.attr2("action"))?L.trim(e):"")||window.location.href||"")&&(e.match(/^([^#]+)/)||[])[1],c=L.extend(!0,{url:e,success:L.ajaxSettings.success,type:A||L.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},c),{});if(this.trigger("form-pre-serialize",[this,c,e]),e.veto)M("ajaxSubmit: submit vetoed via form-pre-serialize trigger");else if(c.beforeSerialize&&!1===c.beforeSerialize(this,c))M("ajaxSubmit: submit aborted via beforeSerialize callback");else{var t=c.traditional,n=(void 0===t&&(t=L.ajaxSettings.traditional),[]),a=this.formToArray(c.semantic,n);if(c.data&&(c.extraData=c.data,u=L.param(c.data,t)),c.beforeSubmit&&!1===c.beforeSubmit(a,this,c))M("ajaxSubmit: submit aborted via beforeSubmit callback");else if(this.trigger("form-submit-validate",[a,this,c,e]),e.veto)M("ajaxSubmit: submit vetoed via form-submit-validate trigger");else{var r,o,i,e=L.param(a,t),s=(u&&(e=e?e+"&"+u:u),"GET"==c.type.toUpperCase()?(c.url+=(0<=c.url.indexOf("?")?"&":"?")+e,c.data=null):c.data=e,[]);c.resetForm&&s.push(function(){E.resetForm()}),c.clearForm&&s.push(function(){E.clearForm(c.includeHidden)}),!c.dataType&&c.target?(r=c.success||function(){},s.push(function(e){var t=c.replaceTarget?"replaceWith":"html";L(c.target)[t](e).each(r,arguments)})):c.success&&s.push(c.success),c.success=function(e,t,a){for(var r=c.context||this,n=0,o=s.length;n')).css({position:"absolute",top:"-1000px",left:"-1000px"}),m=f[0],p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";M("aborting upload... "+t),this.aborted=1;try{m.contentWindow.document.execCommand&&m.contentWindow.document.execCommand("Stop")}catch(e){}f.attr("src",l.iframeSrc),p.error=t,l.error&&l.error.call(l.context,p,t,e),u&&L.event.trigger("ajaxError",[p,l,t]),l.complete&&l.complete.call(l.context,p,t)}},(u=l.global)&&0==L.active++&&L.event.trigger("ajaxStart"),u&&L.event.trigger("ajaxSend",[p,l]),l.beforeSend&&!1===l.beforeSend.call(l.context,p,l)?(l.global&&L.active--,S.reject()):p.aborted?S.reject():((e=s.clk)&&(a=e.name)&&!e.disabled&&(l.extraData=l.extraData||{},l.extraData[a]=e.value,"image"==e.type)&&(l.extraData[a+".x"]=s.clk_x,l.extraData[a+".y"]=s.clk_y),g=1,v=2,e=L("meta[name=csrf-token]").attr("content"),(a=L("meta[name=csrf-param]").attr("content"))&&e&&(l.extraData=l.extraData||{},l.extraData[a]=e),l.forceSync?r():setTimeout(r,10),y=50,j=L.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},i=L.parseJSON||function(e){return window.eval("("+e+")")},w=function(e,t,a){var r=e.getResponseHeader("content-type")||"",n="xml"===t||!t&&0<=r.indexOf("xml"),e=n?e.responseXML:e.responseText;return n&&"parsererror"===e.documentElement.nodeName&&L.error&&L.error("parsererror"),"string"==typeof(e=a&&a.dataFilter?a.dataFilter(e,t):e)&&("json"===t||!t&&0<=r.indexOf("json")?e=i(e):("script"===t||!t&&0<=r.indexOf("javascript"))&&L.globalEval(e)),e}),S;function k(t){var a=null;try{t.contentWindow&&(a=t.contentWindow.document)}catch(e){M("cannot get iframe.contentWindow document: "+e)}if(!a)try{a=t.contentDocument||t.document}catch(e){M("cannot get iframe.contentDocument: "+e),a=t.document}return a}function r(){var e=E.attr2("target"),t=E.attr2("action"),a=E.attr("enctype")||E.attr("encoding")||"multipart/form-data";s.setAttribute("target",o),A&&!/post/i.test(A)||s.setAttribute("method","POST"),t!=l.url&&s.setAttribute("action",l.url),l.skipEncodingOverride||A&&!/post/i.test(A)||E.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),l.timeout&&(h=setTimeout(function(){d=!0,D(g)},l.timeout));var r=[];try{if(l.extraData)for(var n in l.extraData)l.extraData.hasOwnProperty(n)&&(L.isPlainObject(l.extraData[n])&&l.extraData[n].hasOwnProperty("name")&&l.extraData[n].hasOwnProperty("value")?r.push(L('').val(l.extraData[n].value).appendTo(s)[0]):r.push(L('').val(l.extraData[n]).appendTo(s)[0]));l.iframeTarget||f.appendTo("body"),m.attachEvent?m.attachEvent("onload",D):m.addEventListener("load",D,!1),setTimeout(function e(){try{var t=k(m).readyState;M("state = "+t),t&&"uninitialized"==t.toLowerCase()&&setTimeout(e,50)}catch(e){M("Server abort: ",e," (",e.name,")"),D(v),h&&clearTimeout(h),h=void 0}},15);try{s.submit()}catch(e){document.createElement("form").submit.apply(s)}}finally{s.setAttribute("action",t),s.setAttribute("enctype",a),e?s.setAttribute("target",e):E.removeAttr("target"),L(r).remove()}}function D(t){if(!p.aborted&&!T)if((b=k(m))||(M("cannot access response document"),t=v),t===g&&p)p.abort("timeout"),S.reject(p,"timeout");else if(t==v&&p)p.abort("server abort"),S.reject(p,"error","server abort");else if(b&&b.location.href!=l.iframeSrc||d){m.detachEvent?m.detachEvent("onload",D):m.removeEventListener("load",D,!1);var a,t="success";try{if(d)throw"timeout";var e="xml"==l.dataType||b.XMLDocument||L.isXMLDoc(b);if(M("isXml="+e),!e&&window.opera&&(null===b.body||!b.body.innerHTML)&&--y)return M("requeing onLoad callback, DOM not available"),void setTimeout(D,250);var r,n,o,i=b.body||b.documentElement,s=(p.responseText=i?i.innerHTML:null,p.responseXML=b.XMLDocument||b,e&&(l.dataType="xml"),p.getResponseHeader=function(e){return{"content-type":l.dataType}[e.toLowerCase()]},i&&(p.status=Number(i.getAttribute("status"))||p.status,p.statusText=i.getAttribute("statusText")||p.statusText),(l.dataType||"").toLowerCase()),c=/(json|script|text)/.test(s);c||l.textarea?(r=b.getElementsByTagName("textarea")[0])?(p.responseText=r.value,p.status=Number(r.getAttribute("status"))||p.status,p.statusText=r.getAttribute("statusText")||p.statusText):c&&(n=b.getElementsByTagName("pre")[0],o=b.getElementsByTagName("body")[0],n?p.responseText=n.textContent||n.innerText:o&&(p.responseText=o.textContent||o.innerText)):"xml"==s&&!p.responseXML&&p.responseText&&(p.responseXML=j(p.responseText));try{x=w(p,s,l)}catch(e){t="parsererror",p.error=a=e||t}}catch(e){M("error caught: ",e),t="error",p.error=a=e||t}p.aborted&&(M("upload aborted"),t=null),"success"===(t=p.status?200<=p.status&&p.status<300||304===p.status?"success":"error":t)?(l.success&&l.success.call(l.context,x,"success",p),S.resolve(p.responseText,"success",p),u&&L.event.trigger("ajaxSuccess",[p,l])):t&&(void 0===a&&(a=p.statusText),l.error&&l.error.call(l.context,p,t,a),S.reject(p,"error",a),u)&&L.event.trigger("ajaxError",[p,l,a]),u&&L.event.trigger("ajaxComplete",[p,l]),u&&!--L.active&&L.event.trigger("ajaxStop"),l.complete&&l.complete.call(l.context,p,t),T=!0,l.timeout&&clearTimeout(h),setTimeout(function(){l.iframeTarget?f.attr("src",l.iframeSrc):f.remove(),p.responseXML=null},100)}}}},L.fn.ajaxForm=function(e){var t;return(e=e||{}).delegation=e.delegation&&L.isFunction(L.fn.on),e.delegation||0!==this.length?e.delegation?(L(document).off("submit.form-plugin",this.selector,a).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,e,a).on("click.form-plugin",this.selector,e,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,a).bind("click.form-plugin",e,r):(t={s:this.selector,c:this.context},!L.isReady&&t.s?(M("DOM not ready, queuing ajaxForm"),L(function(){L(t.s,t.c).ajaxForm(e)})):M("terminating; zero elements found by selector"+(L.isReady?"":" (DOM not ready)")),this)},L.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},L.fn.formToArray=function(e,t){var a=[];if(0!==this.length){var r=this[0],n=this.attr("id"),o=e?r.getElementsByTagName("*"):r.elements;if(o&&!/MSIE [678]/.test(navigator.userAgent)&&(o=L(o).get()),(o=n&&(n=L(':input[form="'+n+'"]').get()).length?(o||[]).concat(n):o)&&o.length){for(var i,s,c,l,u,f,m=0,p=o.length;m a").html(r)))}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){var e,r;jQuery(this).hasClass("disabled")||(um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(um_members_show_preloader(e),1===(r="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?+e.data("page")-1:"next"===jQuery(this).data("page")?+e.data("page")+1:"last"===jQuery(this).data("page")?parseInt(e.data("total_pages")):parseInt(jQuery(this).data("page")))?(e.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(r===parseInt(e.data("total_pages"))?e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),e.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)))}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e,r=jQuery(this).parents(".um-directory");um_is_directory_busy(r)||(um_members_show_preloader(r),e=jQuery(this).val(),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r))}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();e=jQuery(this).parents(".um-member");return e.find(".um-member-more").hide(),e.find(".um-member-meta-main").slideDown(),e.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();e=jQuery(this).parents(".um-member");return e.find(".um-member-less").hide(),e.find(".um-member-meta-main").slideUp(),e.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var e=jQuery(this).parents(".um-member"),r=jQuery(this).parents(".um-members");return e.find(".um-member-more").hide(),e.find(".um-member-meta").slideDown(function(){UM_Member_Grid(r)}),e.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(r)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").on("click",function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){var e,r,t,a=jQuery(this).val(),i=um_sanitize_value(a);""===i||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(um_members_show_preloader(e),t=void 0===(t=um_get_data_for_directory(e,"filter_"+(r=jQuery(this).prop("name"))))?[]:t.split("||"),-1===jQuery.inArray(i,t)&&(t.push(i),um_set_url_from_data(e,"filter_"+r,t=t.join("||")),e.data("page",1),um_set_url_from_data(e,"page","")),jQuery(this).find('option[value="'+a+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),(i=jQuery(this)).select2("destroy").select2({dropdownParent:i.parent()}),i.val("").trigger("change"),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e,r,t,a=jQuery(this).parents(".um-directory");um_is_directory_busy(a)||(e=um_sanitize_value(jQuery(this).val()))!==(t=void 0===(t=um_get_data_for_directory(a,"filter_"+(r=jQuery(this).prop("name"))))?"":t)&&(um_members_show_preloader(a),um_set_url_from_data(a,"filter_"+r,e),a.data("page",1),um_set_url_from_data(a,"page",""),um_ajax_get_members(a),um_change_tag(a),a.data("searched",1),a.find(".um-member-directory-sorting-options").prop("disabled",!1),a.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){var r,t,a;13!==e.which||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(r=um_sanitize_value(jQuery(this).val()))!==(a=void 0===(a=um_get_data_for_directory(e,"filter_"+(t=jQuery(this).prop("name"))))?"":a)&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type"),i=("text"===a?(um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("")):"select"===a?(m=void 0===(m=um_get_data_for_directory(e,"filter_"+t))?[]:(m=um_unsanitize_value(m)).split("||"),um_set_url_from_data(e,"filter_"+t,m=(m=-1!==jQuery.inArray(r.toString(),m)?jQuery.grep(m,function(e){return e!==r.toString()}):m).length?m:""),(m=jQuery('.um-search-filter select[name="'+t+'"]')).find('option[value="'+r+'"]').prop("disabled",!1).show(),1a.data("total_pages")&&(t=a.data("total_pages")),a.data("page",t).attr("data-page",t),a.find(".um-member-directory-sorting").length&&(void 0===(t=um_get_data_for_directory(a,"sort"))&&(t=a.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),a.data("sorting",t),(e=a.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]')).find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),e.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),a.find(".um-member-directory-sorting-a").find("> a").html(e.find('a[data-value="'+t+'"]').html())),a.find(".um-member-directory-view-type").length&&(void 0===(e=um_get_data_for_directory(a,"view_type"))&&(e=a.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),a.data("view_type",e),a.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),a.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+e+'"]').show()),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),e=e.data("range"),t=um_get_data_for_directory(a,"filter_"+t+"_"+e);void 0!==t?r.set("select",1e3*t):r.clear()}),a.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(a,"filter_"+r+"_from"),r=um_get_data_for_directory(a,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===r&&(r=e.data("max")),r=parseInt(r),e.slider("values",[t,r]),um_set_range_label(e)}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),e=e.data("range"),t=um_get_data_for_directory(a,"filter_"+t+"_"+e);void 0!==t?(e=t.split(":"),r.set("select",60*e[0])):r.clear()}),wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,a));if(!t&&1===a.data("must-search")){var i=um_get_search(a);if(!um_get_filters_data(a).length&&!i)return a.data("searched",0),void um_members_hide_preloader(a);a.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,a,r)||(um_ajax_get_members(a),um_change_tag(a))})})}); \ No newline at end of file +var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var r={},t=window.location.search.substring(1).split("&");return jQuery.each(t,function(e){e=t[e].split("=");r[e[0]]=e[1]}),r}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={},d=(Array.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r,t=um_member_directories[e];t!==a&&(r=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+t+'"]')),jQuery.each(r,function(e){m[e+"_"+t]=r[e]}))}),[]),e=(jQuery.each(m,function(e){d.push(e+"="+m[e])}),"?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&"));"?"===e&&(e=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+e)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){e=um_members_get_hash(e);return void 0!==um_members_directory_busy[e]&&um_members_directory_busy[e]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t,a="",i=e.siblings(".um-slider-range").data("placeholder-s"),m=e.siblings(".um-slider-range").data("placeholder-p"),r=r?(a=(r.values[0]===r.values[1]?i.replace("{value}",r.values[0]):m.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1])).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=r.values[0],r.values[1]):(a=(e.slider("values",0)===e.slider("values",1)?i.replace("{value}",e.slider("values",0)):m.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1))).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1));e.siblings(".um-slider-range").html(a),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(r)}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){e=e.data("page");return e=e&&void 0!==e?e:1}function um_time_convert(e,r){var t=Math.floor(e/60),e=e%60;return(t=60<=e&&(e=0,24<=(t+=1))?0:t)+":"+(e=e<10?"0"+e:e)}function um_ajax_get_members(_,e){var r,t,a,i,s,m=um_members_get_hash(_);wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,m,_)?(r=um_get_current_page(_),t=um_get_search(_),a=um_get_sort(_),i=-(new Date).getTimezoneOffset()/60,s={directory_id:m,page:r,search:t,sorting:a,gmt_offset:i,post_refferer:_.data("base-post"),nonce:um_scripts.nonce},_.find(".um-search-filter").length&&_.find(".um-search-filter").each(function(){var e,r,t,a,i,m,d,u=jQuery(this);u.find(".um-slider").length?(m=u.find(".um-slider").data("field_name"),r=um_get_data_for_directory(_,"filter_"+m+"_from"),e=um_get_data_for_directory(_,"filter_"+m+"_to"),void 0===r&&void 0===e||(s[m]=[r,e])):u.find(".um-datepicker-filter").length?(m=u.find(".um-datepicker-filter").data("filter_name"),r=um_get_data_for_directory(_,"filter_"+m+"_from"),e=um_get_data_for_directory(_,"filter_"+m+"_to"),void 0===r&&void 0===e||(s[m]=[r,e])):u.find(".um-timepicker-filter").length?(m=u.find(".um-timepicker-filter").data("filter_name"),r=um_get_data_for_directory(_,"filter_"+m+"_from"),e=um_get_data_for_directory(_,"filter_"+m+"_to"),void 0!==r&&(r=(i=(i=+(r=r.split(":"))[0])<10?"0"+i:i)+":"+(a=(a=+r[1])<10?"0"+a:a)+":00"),void 0!==e&&(a=+(t=e.split(":"))[1],e=(i=(i=+t[0])<10?"0"+i:i)+":"+(a=a<10?"0"+a:a)+":59"),void 0===r&&void 0===e||(s[m]=[r,e])):u.find("select").length?(m=u.find("select").attr("name"),void 0!==(d=um_get_data_for_directory(_,"filter_"+m))&&(d=um_unsanitize_value(d),s[m]=d.split("||"))):u.hasClass("um-text-filter-type")&&u.find('input[type="text"]').length?(m=u.find('input[type="text"]').attr("name"),void 0!==(d=um_get_data_for_directory(_,"filter_"+m))&&(d=um_unsanitize_value(d),s[m]=d)):s=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",s,u,_)}),s=wp.hooks.applyFilters("um_member_directory_filter_request",s),wp.ajax.send("um_get_members",{data:s,success:function(e){um_member_directory_last_data[m]=e,um_build_template(_,e);var r=wp.template("um-members-pagination");_.find(".um-members-pagination-box").html(r(e)),_.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(_.find(".um-member-directory-sorting-options").prop("disabled",!1),_.find(".um-member-directory-view-type").removeClass("um-disabled")):(_.find(".um-member-directory-sorting-options").prop("disabled",!0),_.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",_,e),um_init_new_dropdown(),um_members_hide_preloader(_)},error:function(e){console.log(e),um_members_hide_preloader(_)}})):setTimeout(um_ajax_get_members,600,_,e)}function um_build_template(e,r){var t=e.data("view_type"),t=wp.template("um-member-"+t+"-"+um_members_get_hash(e)),t=(e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(t(r.users)),wp.template("um-members-header")),a=(e.find(".um-members-intro").remove(),wp.hooks.applyFilters("um_member_directory_generate_header",!1,e));(void 0!==r.is_search&&r.is_search||a)&&e.find(".um-members-wrapper").prepend(t(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(_){var s=[];return _.find(".um-search-filter").each(function(){var d,t,a,i,e,r,m,u=jQuery(this);u.find("input.um-datepicker-filter").length?(d="datepicker",u.find("input.um-datepicker-filter").each(function(){var e,r,t,a,i,m;"to"!==jQuery(this).data("range")&&(e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(_,"filter_"+e+"_from"),t=um_get_data_for_directory(_,"filter_"+e+"_to"),void 0!==r||void 0!==t)&&((a=jQuery(this).val())===(i=_.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val())?m=i:""!==a&&""!==i?m=a+" - "+i:""===a?m="before "+i:""===i&&(m="since "+a),s.push({name:e,label:jQuery(this).data("filter-label"),value_label:m,value:[r,t],type:d}))})):u.find("input.um-timepicker-filter").length?(d="timepicker",u.find("input.um-timepicker-filter").each(function(){var e,r,t,a,i,m;"to"!==jQuery(this).data("range")&&(e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(_,"filter_"+e+"_from"),t=um_get_data_for_directory(_,"filter_"+e+"_to"),void 0!==r||void 0!==t)&&((a=jQuery(this).val())===(i=_.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val())?m=i:""!==a&&""!==i?m=a+" - "+i:""===a?m="before "+i:""===i&&(m="since "+a),s.push({name:e,label:jQuery(this).data("filter-label"),value_label:m,value:[r,t],type:d}))})):u.find("select").length?(d="select",t=u.find("select").attr("name"),a=u.find("select").data("placeholder"),i=void 0===(i=um_get_data_for_directory(_,"filter_"+t))?[]:(i=um_unsanitize_value(i)).split("||"),jQuery.each(i,function(e){var r=u.find('select option[value="'+i[e]+'"]').data("value_label");s.push({name:t,label:a,value_label:r,value:i[e],type:d})})):u.hasClass("um-text-filter-type")&&u.find('input[type="text"]').length?(d="text",t=u.find('input[type="text"]').attr("name"),a=u.find('input[type="text"]').attr("placeholder"),""!=(i=void 0===(i=um_get_data_for_directory(_,"filter_"+t))?"":i)&&s.push({name:t,label:a,value_label:i,value:i,type:d})):u.find("div.ui-slider").length?(d="slider",t=u.find("div.ui-slider").data("field_name"),e=um_get_data_for_directory(_,"filter_"+t+"_from"),r=um_get_data_for_directory(_,"filter_"+t+"_to"),void 0===e&&void 0===r||(m=(e===r?u.find("div.um-slider-range").data("placeholder-s").replace("{value}",e):u.find("div.um-slider-range").data("placeholder-p").replace("{min_range}",e).replace("{max_range}",r)).replace("{field_label}",u.find("div.um-slider-range").data("label")),a=u.find("div.um-slider-range").data("label"),s.push({name:t,label:a,value_label:m,value:[e,r],type:d}))):s=wp.hooks.applyFilters("um_member_directory_get_filter_data",s,_,u)}),s}function um_change_tag(e){var r,t=um_get_filters_data(e),a=(e.find(".um-members-filter-tag").remove(),e.find(".um-filtered-line"));a.length&&(r=wp.template("um-members-filtered-line"),a.prepend(r({filters:t})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible")))}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");if(!wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,e)){r=e.data("must-search");if(1===r&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length)&&!t)return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e)}e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){var e;jQuery(this).hasClass("um-disabled")||((e=jQuery(this).find(".um-member-directory-view-type-a:visible")).hide(),(e.next().length?e.next():jQuery(this).find(".um-member-directory-view-type-a:first")).show().tipsy("show"))}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r,t=jQuery(this),a=t.parents(".um-member-directory-view-type");a.hasClass("um-disabled")||(um_members_show_preloader(e),(r=a.find(".um-member-directory-view-type-a:visible")).hide(),(r.next().length?r.next():a.find(".um-member-directory-view-type-a:first")).show().tipsy("show"),null!==(r=um_member_directory_last_data[um_members_get_hash(e)])&&(um_set_url_from_data(e,"view_type",a=t.data("type")),e.data("view_type",a),um_build_template(e,r),um_init_new_dropdown()),um_members_hide_preloader(e))}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",'.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){var e,r,t;1===jQuery(this).data("selected")||(e=jQuery(this).data("directory-hash"),um_is_directory_busy(e=jQuery('.um-directory[data-hash="'+e+'"]')))||(um_members_show_preloader(e),r=jQuery(this).html(),t=jQuery(this).data("value"),e.data("sorting",t),um_set_url_from_data(e,"sort",t),um_ajax_get_members(e),e.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),e.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),e.find(".um-member-directory-sorting-a").find("> a").html(r))}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){var e,r;jQuery(this).hasClass("disabled")||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(um_members_show_preloader(e),(1===(r="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?+e.data("page")-1:"next"===jQuery(this).data("page")?+e.data("page")+1:"last"===jQuery(this).data("page")?parseInt(e.data("total_pages")):parseInt(jQuery(this).data("page")))?(e.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),e.find('.pagi[data-page="prev"], .pagi[data-page="last"]')):(r===parseInt(e.data("total_pages"))?e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):e.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),e.find('.pagi[data-page="first"], .pagi[data-page="prev"]'))).removeClass("disabled"),e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e))}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e,r=jQuery(this).parents(".um-directory");um_is_directory_busy(r)||(um_members_show_preloader(r),e=jQuery(this).val(),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r))}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();e=jQuery(this).parents(".um-member");return e.find(".um-member-more").hide(),e.find(".um-member-meta-main").slideDown(),e.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();e=jQuery(this).parents(".um-member");return e.find(".um-member-less").hide(),e.find(".um-member-meta-main").slideUp(),e.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var e=jQuery(this).parents(".um-member"),r=jQuery(this).parents(".um-members");return e.find(".um-member-more").hide(),e.find(".um-member-meta").slideDown(function(){UM_Member_Grid(r)}),e.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(r)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").on("click",function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){var e,r,t,a=jQuery(this).val(),i=um_sanitize_value(a);""===i||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(um_members_show_preloader(e),t=void 0===(t=um_get_data_for_directory(e,"filter_"+(r=jQuery(this).prop("name"))))?[]:t.split("||"),-1===jQuery.inArray(i,t)&&(t.push(i),um_set_url_from_data(e,"filter_"+r,t=t.join("||")),e.data("page",1),um_set_url_from_data(e,"page","")),jQuery(this).find('option[value="'+a+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0),(i=jQuery(this)).select2("destroy").select2({dropdownParent:i.parent()}),i.val("").trigger("change"),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e,r,t,a=jQuery(this).parents(".um-directory");um_is_directory_busy(a)||(e=um_sanitize_value(jQuery(this).val()))!==(t=void 0===(t=um_get_data_for_directory(a,"filter_"+(r=jQuery(this).prop("name"))))?"":t)&&(um_members_show_preloader(a),um_set_url_from_data(a,"filter_"+r,e),a.data("page",1),um_set_url_from_data(a,"page",""),um_ajax_get_members(a),um_change_tag(a),a.data("searched",1),a.find(".um-member-directory-sorting-options").prop("disabled",!1),a.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){var r,t,a;13!==e.which||um_is_directory_busy(e=jQuery(this).parents(".um-directory"))||(r=um_sanitize_value(jQuery(this).val()))!==(a=void 0===(a=um_get_data_for_directory(e,"filter_"+(t=jQuery(this).prop("name"))))?"":a)&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type"),i=("text"===a?(um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("")):"select"===a?(m=void 0===(m=um_get_data_for_directory(e,"filter_"+t))?[]:(m=um_unsanitize_value(m)).split("||"),um_set_url_from_data(e,"filter_"+t,m=(m=-1!==jQuery.inArray(r.toString(),m)?jQuery.grep(m,function(e){return e!==r.toString()}):m).length?m:""),(m=jQuery('.um-search-filter select[name="'+t+'"]')).find('option[value="'+r+'"]').prop("disabled",!1).show(),1a.data("total_pages")&&(t=a.data("total_pages")),a.data("page",t).attr("data-page",t),a.find(".um-member-directory-sorting").length&&(void 0===(t=um_get_data_for_directory(a,"sort"))&&(t=a.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),a.data("sorting",t),(e=a.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]')).find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),e.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),a.find(".um-member-directory-sorting-a").find("> a").html(e.find('a[data-value="'+t+'"]').html())),a.find(".um-member-directory-view-type").length&&(void 0===(e=um_get_data_for_directory(a,"view_type"))&&(e=a.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),a.data("view_type",e),a.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),a.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+e+'"]').show()),a.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),e=e.data("range"),t=um_get_data_for_directory(a,"filter_"+t+"_"+e);void 0!==t?r.set("select",1e3*t):r.clear()}),a.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(a,"filter_"+r+"_from"),r=um_get_data_for_directory(a,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===r&&(r=e.data("max")),r=parseInt(r),e.slider("values",[t,r]),um_set_range_label(e)}),a.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),e=e.data("range"),t=um_get_data_for_directory(a,"filter_"+t+"_"+e);void 0!==t?(e=t.split(":"),r.set("select",60*e[0])):r.clear()}),wp.hooks.applyFilters("um_member_directory_ignore_after_search",!1,a));if(!t&&1===a.data("must-search")){var i=um_get_search(a);if(!um_get_filters_data(a).length&&!i)return a.data("searched",0),void um_members_hide_preloader(a);a.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,a,r)||(um_ajax_get_members(a),um_change_tag(a))})})}); \ No newline at end of file diff --git a/assets/js/um-modal.min.js b/assets/js/um-modal.min.js index c4bcc88e..0d29bf7a 100644 --- a/assets/js/um-modal.min.js +++ b/assets/js/um-modal.min.js @@ -1 +1 @@ -jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal:not(:has(.um-form)) a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),e=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href"),t=a.find(".um-single-file-upload").data("set_mode");return jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:e,mode:t,nonce:um_scripts.nonce},success:function(){a.find(".um-single-file-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive()}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var a=jQuery(this).parents(".um-modal-body"),e=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src"),t=a.find(".um-single-image-upload").data("set_mode");return jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_remove_file",src:e,mode:t,nonce:um_scripts.nonce},success:function(){jQuery("img.cropper-hidden").cropper("destroy"),a.find(".um-single-image-preview img").attr("src",""),a.find(".um-single-image-preview").hide(),a.find(".ajax-upload-dragdrop").show(),a.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive()}}),!1}),jQuery(document).on("click",".um-finish-upload.file:not(.disabled)",function(){var e=jQuery(this).attr("data-key"),a=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html(),a=(um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(a),jQuery(".um-field[data-key="+e+"]").find(".um-single-fileinfo a").data("file"));jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find('input[type="hidden"]').val(a)}),jQuery(document).on("click",".um-finish-upload.image:not(.disabled)",function(){var a,e,t=jQuery(this),i=jQuery(this).attr("data-key"),r=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),u=r.find("img").attr("src"),d=r.attr("data-coord"),r=r.find("img").data("file"),m=0,n=(jQuery(this).parents("#um_upload_single").data("user_id")&&(m=jQuery(this).parents("#um_upload_single").data("user_id")),0),o="";1===jQuery('div.um-field-image[data-key="'+i+'"]').length&&(n=(e=jQuery('div.um-field-image[data-key="'+i+'"]').closest(".um-form")).find('input[name="form_id"]').val(),o=e.attr("data-mode")),d?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:"um_resize_image",src:u,coord:d,user_id:m,key:i,set_id:n,set_mode:o,nonce:um_scripts.nonce},success:function(e){e.success&&(a=new Date,"profile_photo"===i?jQuery(".um-profile-photo-img img").attr("src",e.data.image.source_url+"?"+a.getTime()):"cover_photo"===i&&(jQuery(".um-cover-e").empty().html(''),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+a.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(a=new Date,jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",u+"?"+a.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find("input[type=hidden]").val(r))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";jQuery(this).data("modal-size")&&(t=jQuery(this).data("modal-size")),jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0'),jQuery(".um").hasClass("um-editing"))&&jQuery(".um-cover-overlay").show(),jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",e.data.image.source_url+"?"+a.getTime()),um_remove_modal(),jQuery("img.cropper-invisible").remove(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find('input[type="hidden"]').val(e.data.image.filename))}})):(a=new Date,jQuery(".um-single-image-preview[data-key="+i+"]").fadeIn().find("img").attr("src",u+"?"+a.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find(".um-btn-auto-width").html(t.attr("data-change")),jQuery(".um-single-image-preview[data-key="+i+"]").parents(".um-field").find("input[type=hidden]").val(r))}),jQuery(document.body).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var a=jQuery(this).attr("data-modal"),t="normal";jQuery(this).data("modal-size")&&(t=jQuery(this).data("modal-size")),jQuery(this).data("modal-copy")&&(jQuery("#"+a).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+a).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+a).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),0",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,e=i("<"+this.opt.starType+" />",{title:this.opt.cancelHint,class:this.opt.cancelClass});"img"===this.opt.starType?e.attr({src:t,alt:"x"}):e.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(e):this.self.append(" ").append(e),this.cancel=e},_createScore:function(){var t=i(this.opt.targetScore);this.score=t.length?t:r._buildScoreField.call(this)},_createStars:function(){for(var t=1;t<=this.opt.number;t++){var e=r._nameForIndex.call(this,t),e={alt:t,src:this.opt.path+this.opt[e]};(e="img"!==this.opt.starType?{"data-alt":t,class:e.src}:e).title=r._getHint.call(this,t),i("<"+this.opt.starType+" />",e).appendTo(this),this.opt.space&&this.self.append(te?(s=this.opt.iconRange[e],i=r._getRangeIcon.call(this,s,n),a<=s.range&&r._setIcon.call(this,o,i),a===s.range&&e++):(i=this.opt[n?"starOn":"starOff"],r._setIcon.call(this,o,i))}},_getRangeIcon:function(t,e){return e?t.on||this.opt.starOn:t.off||this.opt.starOff},_getScoreByPosition:function(t,e){var a,s=parseInt(e.alt||e.getAttribute("data-alt"),10);return this.opt.half&&(a=r._getSize.call(this),t=parseFloat((t.pageX-i(e).offset().left)/a),s=this.opt.precision?s-1+t:s-1+(.5=t?"starOn":"starOff"},_roundStars:function(t){var e,a=(t%1).toFixed(2);a>this.opt.round.down&&(e="starOn",this.opt.halfShow&&a=e.number&&(t=e.number-1,a=10);e=r._getSize.call(this)/10,t=i(this.stars[t]),e=t.offset().left+e*parseInt(a,10),a=i.Event("mousemove",{pageX:e});t.trigger(a)})},readOnly:function(e){return this.each(function(){var t=i(this);t.data("readonly")!==e&&(e?(t.off(".um_raty").children("img").off(".um_raty"),r._lock.call(this)):(r._binds.call(this),r._unlock.call(this)),t.data("readonly",e))})},reload:function(){return r.set.call(this,{})},score:function(){var t=i(this);return arguments.length?r.setScore.apply(t,arguments):r.getScore.call(t)},set:function(a){return this.each(function(){var t=i(this),e=t.data("options"),e=i.extend({},e,a);t.um_raty(e)})},setScore:function(t){return this.each(function(){!0!==i(this).data("readonly")&&(r._apply.call(this,t),r._target.call(this,t))})}};i.fn.um_raty=function(t){return r[t]?r[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void i.error("Method "+t+" does not exist!"):r.init.apply(this,arguments)},i.fn.um_raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:wp.i18n.__("Cancel this rating!","ultimate-member"),cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:wp.i18n.__("Not rated yet!","ultimate-member"),number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery); \ No newline at end of file +!function(i){"use strict";var r={init:function(t){return this.each(function(){this.self=i(this),r.destroy.call(this.self),this.opt=i.extend(!0,{},i.fn.um_raty.defaults,t),r._adjustCallback.call(this),r._adjustNumber.call(this),"img"!==this.opt.starType&&r._adjustStarType.call(this),r._adjustPath.call(this),r._createStars.call(this),this.opt.cancel&&r._createCancel.call(this),this.opt.precision&&r._adjustPrecision.call(this),r._createScore.call(this),r._apply.call(this,this.opt.score),r._target.call(this,this.opt.score),(this.opt.readOnly?r._lock:(this.style.cursor="pointer",r._binds)).call(this),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName","target"],e=0;e",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,e=i("<"+this.opt.starType+" />",{title:this.opt.cancelHint,class:this.opt.cancelClass});"img"===this.opt.starType?e.attr({src:t,alt:"x"}):e.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(e):this.self.append(" ").append(e),this.cancel=e},_createScore:function(){var t=i(this.opt.targetScore);this.score=t.length?t:r._buildScoreField.call(this)},_createStars:function(){for(var t=1;t<=this.opt.number;t++){var e=r._nameForIndex.call(this,t),e={alt:t,src:this.opt.path+this.opt[e]};(e="img"!==this.opt.starType?{"data-alt":t,class:e.src}:e).title=r._getHint.call(this,t),i("<"+this.opt.starType+" />",e).appendTo(this),this.opt.space&&this.self.append(te?(s=this.opt.iconRange[e],i=r._getRangeIcon.call(this,s,n),a<=s.range&&r._setIcon.call(this,o,i),a===s.range&&e++):(i=this.opt[n?"starOn":"starOff"],r._setIcon.call(this,o,i))}},_getRangeIcon:function(t,e){return e?t.on||this.opt.starOn:t.off||this.opt.starOff},_getScoreByPosition:function(t,e){var a,s=parseInt(e.alt||e.getAttribute("data-alt"),10);return this.opt.half&&(a=r._getSize.call(this),t=parseFloat((t.pageX-i(e).offset().left)/a),s=this.opt.precision?s-1+t:s-1+(.5=t?"starOn":"starOff"},_roundStars:function(t){var e,a=(t%1).toFixed(2);a>this.opt.round.down&&(e="starOn",this.opt.halfShow&&a=e.number&&(t=e.number-1,a=10);e=r._getSize.call(this)/10,t=i(this.stars[t]),e=t.offset().left+e*parseInt(a,10),a=i.Event("mousemove",{pageX:e});t.trigger(a)})},readOnly:function(e){return this.each(function(){var t=i(this);t.data("readonly")!==e&&((e?(t.off(".um_raty").children("img").off(".um_raty"),r._lock):(r._binds.call(this),r._unlock)).call(this),t.data("readonly",e))})},reload:function(){return r.set.call(this,{})},score:function(){var t=i(this);return arguments.length?r.setScore.apply(t,arguments):r.getScore.call(t)},set:function(a){return this.each(function(){var t=i(this),e=t.data("options"),e=i.extend({},e,a);t.um_raty(e)})},setScore:function(t){return this.each(function(){!0!==i(this).data("readonly")&&(r._apply.call(this,t),r._target.call(this,t))})}};i.fn.um_raty=function(t){return r[t]?r[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void i.error("Method "+t+" does not exist!"):r.init.apply(this,arguments)},i.fn.um_raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:wp.i18n.__("Cancel this rating!","ultimate-member"),cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:wp.i18n.__("Not rated yet!","ultimate-member"),number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery); \ No newline at end of file diff --git a/assets/js/um-scripts.min.js b/assets/js/um-scripts.min.js index 0e0c0a13..b215de80 100644 --- a/assets/js/um-scripts.min.js +++ b/assets/js/um-scripts.min.js @@ -1 +1 @@ -function um_sanitize_value(e,t){var a=document.createElement("div"),e=(a.innerText=e,a.innerHTML);return t&&jQuery(t).val(e),e}function um_unsanitize_value(e){var t=document.createElement("textarea");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){var e=jQuery(this),t=!1,a=(void 0!==e.attr("data-disabled_weekdays")&&""!==e.attr("data-disabled_weekdays")&&(t=JSON.parse(e.attr("data-disabled_weekdays"))),null),i=(void 0!==e.attr("data-years")&&(a=e.attr("data-years")),e.attr("data-date_min")),n=e.attr("data-date_max"),r=[],u=[],i=(void 0!==i&&(r=i.split(",")),void 0!==n&&(u=n.split(",")),r.length?new Date(r):null),n=r.length?new Date(u):null,u=(i&&"Invalid Date"==i.toString()&&3==r.length&&(r=r[1]+"/"+r[2]+"/"+r[0],i=new Date(Date.parse(r))),n&&"Invalid Date"==n.toString()&&3==u.length&&(r=u[1]+"/"+u[2]+"/"+u[0],n=new Date(Date.parse(r))),{disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}});null!==a&&(u.selectYears=a),null!==i&&(u.min=i),null!==n&&(u.max=n),e.pickadate(u)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){var e=jQuery(this);e.pickatime({format:e.attr("data-format"),interval:parseInt(e.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){function i(e){var a=jQuery(e.currentTarget),e=a.find(":selected");1').html('
'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},a.fn.tipsy=function(i){return!0===i?this.data("tipsy"):("string"==typeof i?(t=this.data("tipsy"))&&t[i]():((i=a.extend({},a.fn.tipsy.defaults,i)).on||this.each(function(){s(this)}),"manual"!=i.trigger&&(t="hover"==i.trigger?"mouseenter":"focus",e="hover"==i.trigger?"mouseleave":"blur",i.on?a(document).on(t,this.selector,n).on(e,this.selector,o):this.on(t,n).on(e,o))),this);var t,e;function s(t){var e=a.data(t,"tipsy");return e||(e=new h(t,a.fn.tipsy.elementOptions(t,i)),a.data(t,"tipsy",e)),e}function n(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}},a.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var t=a.data(this,"tipsy-pointee");t&&function(t){for(;t=t.parentNode;)if(t==document)return 1}(t)||a(this).remove()})},a.fn.tipsy.elementOptions=function(t,e){return a.metadata?a.extend({},e,a(t).metadata()):e},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"},a.fn.tipsy.autoBounds=function(n,o){return function(){var t={ns:o[0],ew:1').html('
'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},a.fn.tipsy=function(i){var t,e;return!0===i?this.data("tipsy"):("string"==typeof i?(t=this.data("tipsy"))&&t[i]():((i=a.extend({},a.fn.tipsy.defaults,i)).on||this.each(function(){s(this)}),"manual"!=i.trigger&&(t="hover"==i.trigger?"mouseenter":"focus",e="hover"==i.trigger?"mouseleave":"blur",i.on?a(document).on(t,this.selector,n).on(e,this.selector,o):this.on(t,n).on(e,o))),this);function s(t){var e=a.data(t,"tipsy");return e||(e=new h(t,a.fn.tipsy.elementOptions(t,i)),a.data(t,"tipsy",e)),e}function n(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}},a.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},a.fn.tipsy.revalidate=function(){a(".tipsy").each(function(){var t=a.data(this,"tipsy-pointee");t&&function(t){for(;t=t.parentNode;)if(t==document)return 1}(t)||a(this).remove()})},a.fn.tipsy.elementOptions=function(t,e){return a.metadata?a.extend({},e,a(t).metadata()):e},a.fn.tipsy.autoNS=function(){return a(this).offset().top>a(document).scrollTop()+a(window).height()/2?"s":"n"},a.fn.tipsy.autoWE=function(){return a(this).offset().left>a(document).scrollLeft()+a(window).width()/2?"e":"w"},a.fn.tipsy.autoBounds=function(n,o){return function(){var t={ns:o[0],ew:1 'um_form', - 'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ), - 'post_status' => 'publish', - 'post_author' => get_current_user_id(), + 'post_type' => 'um_form', + // translators: %s - Form title + 'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ), + 'post_status' => 'publish', + 'post_author' => get_current_user_id(), ); $n_id = wp_insert_post( $n ); $n_fields = get_post_custom( $post_id ); foreach ( $n_fields as $key => $value ) { - - if ( $key == '_um_custom_fields' ) { - $the_value = unserialize( $value[0] ); + if ( '_um_custom_fields' === $key ) { + $the_value = maybe_unserialize( $value[0] ); } else { $the_value = $value[0]; } update_post_meta( $n_id, $key, $the_value ); - } delete_post_meta( $n_id, '_um_core' ); - $url = admin_url( 'edit.php?post_type=um_form' ); - $url = add_query_arg( 'update', 'form_duplicated', $url ); - - exit( wp_redirect( $url ) ); - + $url = add_query_arg( + array( + 'post_type' => 'um_form', + 'update' => 'form_duplicated', + ), + admin_url( 'edit.php' ) + ); + wp_safe_redirect( $url ); + exit; } - /** * Action to hide notices in admin * @@ -1801,7 +1809,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { exit( wp_redirect( remove_query_arg( 'um_adm_action' ) ) ); } - /** * Various user actions * @@ -1868,6 +1875,36 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { } + /** + * Manual check templates versions + * + * @param $action + */ + public function check_templates_version( $action ) { + $templates = UM()->admin_settings()->get_override_templates( true ); + $out_date = false; + + foreach ( $templates as $template ) { + if ( 0 === $template['status_code'] ) { + $out_date = true; + break; + } + } + + if ( false === $out_date ) { + delete_option( 'um_override_templates_outdated' ); + } + + $url = add_query_arg( + array( + 'page' => 'um_options', + 'tab' => 'override_templates', + ), + admin_url( 'admin.php' ) + ); + wp_safe_redirect( $url ); + exit; + } /** * Add any custom links to plugin page diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index ebfc1aa6..a2eca841 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -1,9 +1,9 @@ 'um_form', + 'um_adm_action' => 'duplicate_form', + 'post_id' => $id, + 'nonce' => wp_create_nonce( "um-duplicate_form{$id}" ), + ), + admin_url( 'edit.php' ) + ); + return $url; } - /** * Custom columns for Form * diff --git a/includes/admin/core/class-admin-enqueue.php b/includes/admin/core/class-admin-enqueue.php index 659cfaa7..a46b67b8 100644 --- a/includes/admin/core/class-admin-enqueue.php +++ b/includes/admin/core/class-admin-enqueue.php @@ -1,8 +1,9 @@ js_url = um_url . 'includes/admin/assets/js/'; + public function __construct() { + $this->js_url = um_url . 'includes/admin/assets/js/'; $this->css_url = um_url . 'includes/admin/assets/css/'; - $this->front_js_baseurl = um_url . 'assets/js/'; + $this->front_js_baseurl = um_url . 'assets/js/'; $this->front_css_baseurl = um_url . 'assets/css/'; $this->suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'UM_SCRIPT_DEBUG' ) ) ? '' : '.min'; @@ -73,7 +74,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { add_action( 'admin_head', array( &$this, 'admin_head' ), 9 ); - add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); + add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); add_filter( 'enter_title_here', array( &$this, 'enter_title_here' ) ); @@ -89,20 +90,135 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { } else { add_filter( 'block_categories', array( &$this, 'blocks_category' ), 10, 2 ); } + add_action( 'enqueue_block_assets', array( &$this, 'block_editor' ), 11 ); } - function enqueue_role_wrapper() { - add_action( 'admin_enqueue_scripts', array( &$this, 'load_role_wrapper' ) ); + /** + * Enqueue Gutenberg Block Editor assets + */ + public function block_editor() { + wp_register_style( 'um_ui', um_url . 'assets/css/jquery-ui.css', array(), ultimatemember_version ); + wp_register_style( 'um_members', um_url . 'assets/css/um-members.css', array( 'um_ui' ), ultimatemember_version ); + if ( is_rtl() ) { + wp_register_style( 'um_members_rtl', um_url . 'assets/css/um-members-rtl.css', array( 'um_members' ), ultimatemember_version ); + } + wp_register_style( 'um_styles', um_url . 'assets/css/um-styles.css', array(), ultimatemember_version ); + wp_register_style( 'um_profile', um_url . 'assets/css/um-profile.css', array(), ultimatemember_version ); + wp_register_style( 'um_crop', um_url . 'assets/css/um-crop.css', array(), ultimatemember_version ); + wp_register_style( 'um_responsive', um_url . 'assets/css/um-responsive.css', array( 'um_profile', 'um_crop' ), ultimatemember_version ); + wp_register_style( 'um_account', um_url . 'assets/css/um-account.css', array(), ultimatemember_version ); + wp_register_style( 'um_default_css', um_url . 'assets/css/um-old-default.css', array(), ultimatemember_version ); + wp_register_style( 'um_fonticons_fa', um_url . 'assets/css/um-fonticons-fa.css', array(), ultimatemember_version ); + wp_register_style( 'select2', um_url . 'assets/css/select2/select2' . $this->suffix . '.css', array(), ultimatemember_version ); + wp_register_style( 'um_fonticons_ii', um_url . 'assets/css/um-fonticons-ii.css', array(), ultimatemember_version ); + + wp_register_script( 'um_admin_blocks_shortcodes', um_url . 'assets/js/um-blocks' . $this->suffix . '.js', array( 'wp-i18n', 'wp-blocks', 'wp-components' ), ultimatemember_version, true ); + wp_set_script_translations( 'um_admin_blocks_shortcodes', 'ultimate-member' ); + + if ( ! empty( UM()->account()->get_tab_fields( 'notifications', array() ) ) ) { + $notifications_enabled = 1; + } else { + $notifications_enabled = 0; + } + + $um_account_settings = array( + 'general' => array( + 'label' => __( 'General', 'ultimate-member' ), + 'enabled' => 1, + ), + 'password' => array( + 'label' => __( 'Password', 'ultimate-member' ), + 'enabled' => UM()->options()->get( 'account_tab_password' ), + ), + 'privacy' => array( + 'label' => __( 'Privacy', 'ultimate-member' ), + 'enabled' => UM()->options()->get( 'account_tab_privacy' ), + ), + 'notifications' => array( + 'label' => __( 'Notifications', 'ultimate-member' ), + 'enabled' => $notifications_enabled, + ), + 'delete' => array( + 'label' => __( 'Delete', 'ultimate-member' ), + 'enabled' => UM()->options()->get( 'account_tab_delete' ), + ), + ); + $um_account_settings = apply_filters( 'um_extend_account_settings', $um_account_settings ); + wp_localize_script( 'um_admin_blocks_shortcodes', 'um_account_settings', $um_account_settings ); + + wp_enqueue_script( 'um_admin_blocks_shortcodes' ); + + wp_register_script( 'select2', um_url . 'assets/js/select2/select2.full' . $this->suffix . '.js', array( 'jquery', 'jquery-masonry' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime', um_url . 'assets/js/pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_date', um_url . 'assets/js/pickadate/picker.date.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_time', um_url . 'assets/js/pickadate/picker.time.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); + wp_register_script( 'um_conditional', um_url . 'assets/js/um-conditional' . $this->suffix . '.js', array( 'jquery', 'wp-hooks' ), ultimatemember_version, true ); + wp_register_script( 'um_scripts', um_url . 'assets/js/um-scripts' . $this->suffix . '.js', array( 'jquery', 'wp-util', 'um_conditional', 'um_datetime', 'um_datetime_date', 'um_datetime_time', 'select2' ), ultimatemember_version, true ); + $max_upload_size = wp_max_upload_size(); + if ( ! $max_upload_size ) { + $max_upload_size = 0; + } + + $localize_data = apply_filters( + 'um_enqueue_localize_data', + array( + 'max_upload_size' => $max_upload_size, + 'nonce' => wp_create_nonce( 'um-frontend-nonce' ), + ) + ); + wp_localize_script( 'um_scripts', 'um_scripts', $localize_data ); + + wp_register_script( 'um_dropdown', um_url . 'assets/js/dropdown' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_members', um_url . 'assets/js/um-members' . $this->suffix . '.js', array( 'jquery', 'wp-util', 'jquery-ui-slider', 'um_dropdown', 'wp-hooks', 'jquery-masonry', 'um_scripts' ), ultimatemember_version, true ); + + wp_register_script( 'um_account', um_url . 'assets/js/um-account' . $this->suffix . '.js', array( 'jquery', 'wp-hooks' ), ultimatemember_version, true ); + wp_register_script( 'um_scrollbar', um_url . 'assets/js/simplebar' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_crop', um_url . 'assets/js/um-crop' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); + wp_register_script( 'um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array( 'jquery', 'jquery-masonry', 'wp-util', 'um_scrollbar' ), ultimatemember_version, true ); + wp_register_script( 'um_responsive', um_url . 'assets/js/um-responsive' . $this->suffix . '.js', array( 'jquery', 'um_functions', 'um_crop' ), ultimatemember_version, true ); + + // render blocks + wp_enqueue_script( 'um_datetime' ); + wp_enqueue_script( 'um_datetime_date' ); + wp_enqueue_script( 'um_datetime_time' ); + wp_enqueue_script( 'um_conditional' ); + wp_enqueue_script( 'um_dropdown' ); + wp_enqueue_script( 'um_members' ); + wp_enqueue_script( 'um_account' ); + wp_enqueue_script( 'um_scrollbar' ); + wp_enqueue_script( 'um_crop' ); + wp_enqueue_script( 'um_functions' ); + wp_enqueue_script( 'um_responsive' ); + + wp_enqueue_style( 'um_fonticons_ii' ); + wp_enqueue_style( 'select2' ); + wp_enqueue_style( 'um_default_css' ); + wp_enqueue_style( 'um_fonticons_fa' ); + wp_enqueue_style( 'um_members' ); + wp_enqueue_style( 'um_styles' ); + wp_enqueue_style( 'um_profile' ); + wp_enqueue_style( 'um_crop' ); + wp_enqueue_style( 'um_responsive' ); + wp_enqueue_style( 'um_account' ); + + $custom_css = '.um{opacity: 1;}.um_request_name {display: none !important;}'; + + wp_add_inline_style( 'um_styles', $custom_css ); + } + + + public function enqueue_role_wrapper() { + add_action( 'admin_enqueue_scripts', array( &$this, 'load_role_wrapper' ) ); } /** * */ - function enqueue_cpt_scripts() { - if ( ( isset( $_GET['post_type'] ) && 'um_form' === sanitize_key( $_GET['post_type'] ) ) || - ( isset( $_GET['post'] ) && 'um_form' === get_post_type( absint( $_GET['post'] ) ) ) ) { + public function enqueue_cpt_scripts() { + // phpcs:ignore WordPress.Security.NonceVerification + if ( ( isset( $_GET['post_type'] ) && 'um_form' === sanitize_key( $_GET['post_type'] ) ) || ( isset( $_GET['post'] ) && 'um_form' === get_post_type( absint( $_GET['post'] ) ) ) ) { $this->um_cpt_form_screen = true; add_action( 'admin_footer', array( $this, 'admin_footer_scripts' ), 20 ); } @@ -112,7 +228,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * */ - function enqueue_frontend_preview_assets() { + public function enqueue_frontend_preview_assets() { //scripts for FRONTEND PREVIEW if ( class_exists( 'WooCommerce' ) ) { wp_dequeue_style( 'select2' ); @@ -122,7 +238,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_deregister_script( 'select2' ); } - wp_register_script( 'select2', $this->front_js_baseurl . 'select2/select2.full' . $this->suffix . '.js', array( 'jquery', 'jquery-masonry' ), '4.0.13', true ); wp_register_script( 'um_jquery_form', $this->front_js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_fileupload', $this->front_js_baseurl . 'um-fileupload.js', array( 'jquery' ), ultimatemember_version, true ); @@ -138,9 +253,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { $locale = get_locale(); if ( $locale ) { if ( file_exists( WP_LANG_DIR . '/plugins/ultimate-member/assets/js/pickadate/' . $locale . '.js' ) ) { - wp_register_script('um_datetime_locale', content_url() . '/languages/plugins/ultimate-member/assets/js/pickadate/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_locale', content_url() . '/languages/plugins/ultimate-member/assets/js/pickadate/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); } elseif ( file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) { - wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); } } @@ -148,7 +263,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_register_script( 'um_responsive', $this->front_js_baseurl . 'um-responsive' . $this->suffix . '.js', array( 'um_scripts' ), ultimatemember_version, true ); wp_register_script( 'um_modal', $this->front_js_baseurl . 'um-modal' . $this->suffix . '.js', array( 'um_responsive' ), ultimatemember_version, true ); - wp_register_style( 'select2', $this->front_css_baseurl . 'select2/select2' . $this->suffix . '.css', array(), '4.0.13' ); wp_register_style( 'um_datetime', $this->front_css_baseurl . 'pickadate/default.css', array(), ultimatemember_version ); wp_register_style( 'um_datetime_date', $this->front_css_baseurl . 'pickadate/default.date.css', array( 'um_datetime' ), ultimatemember_version ); @@ -174,7 +288,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load js for Add/Edit User form */ - function load_role_wrapper() { + public function load_role_wrapper() { wp_register_script( 'um_admin_role_wrapper', $this->js_url . 'um-admin-role-wrapper.js', array( 'jquery' ), ultimatemember_version, true ); $localize_roles_data = get_option( 'um_roles', array() ); wp_localize_script( 'um_admin_role_wrapper', 'um_roles', (array) $localize_roles_data ); @@ -189,11 +303,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { * * @return string */ - function enter_title_here( $title ) { + public function enter_title_here( $title ) { $screen = get_current_screen(); - if ( 'um_directory' == $screen->post_type ) { + if ( 'um_directory' === $screen->post_type ) { $title = __( 'e.g. Member Directory', 'ultimate-member' ); - } elseif ( 'um_form' == $screen->post_type ) { + } elseif ( 'um_form' === $screen->post_type ) { $title = __( 'e.g. New Registration Form', 'ultimate-member' ); } return $title; @@ -203,7 +317,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Runs on admin head */ - function admin_head() { + public function admin_head() { if ( UM()->admin()->is_plugin_post_type() ) { ?> - css_url . 'um-admin-form.css', array(), ultimatemember_version ); wp_enqueue_style( 'um_admin_form' ); @@ -230,7 +345,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load Forms */ - function load_forms() { + public function load_forms() { if ( class_exists( 'WooCommerce' ) ) { wp_dequeue_style( 'select2' ); wp_deregister_style( 'select2' ); @@ -248,9 +363,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_register_script( 'um_admin_forms', $this->js_url . 'um-admin-forms.js', array( 'jquery', 'wp-i18n', 'select2' ), ultimatemember_version, true ); - wp_localize_script( 'um_admin_forms', 'um_forms_data', array( - 'successfully_redirect' => add_query_arg( array( 'page' => 'um_options', 'tab' => 'misc', 'msg' => 'updated' ), admin_url( 'admin.php' ) ), - ) ); + wp_localize_script( + 'um_admin_forms', + 'um_forms_data', + array( + 'successfully_redirect' => add_query_arg( + array( + 'page' => 'um_options', + 'tab' => 'misc', + 'msg' => 'updated', + ), + admin_url( 'admin.php' ) + ), + ) + ); wp_enqueue_script( 'um_admin_forms' ); } @@ -259,7 +385,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load dashboard */ - function load_dashboard() { + public function load_dashboard() { wp_register_style( 'um_admin_dashboard', $this->css_url . 'um-admin-dashboard.css', array(), ultimatemember_version ); wp_enqueue_style( 'um_admin_dashboard' ); } @@ -268,7 +394,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load settings */ - function load_settings() { + public function load_settings() { wp_register_style( 'um_admin_settings', $this->css_url . 'um-admin-settings.css', array(), ultimatemember_version ); wp_enqueue_style( 'um_admin_settings' ); @@ -280,7 +406,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load modal */ - function load_modal() { + public function load_modal() { wp_register_style( 'um_admin_modal', $this->css_url . 'um-admin-modal.css', array( 'wp-color-picker' ), ultimatemember_version ); wp_enqueue_style( 'um_admin_modal' ); @@ -292,8 +418,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Field Processing */ - function load_field() { - wp_register_script( 'um_admin_field', $this->js_url . 'um-admin-field.js', array('jquery', 'wp-util', 'wp-i18n'), ultimatemember_version, true ); + public function load_field() { + wp_register_script( 'um_admin_field', $this->js_url . 'um-admin-field.js', array( 'jquery', 'wp-util', 'wp-i18n' ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_field' ); } @@ -301,8 +427,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load Builder */ - function load_builder() { - wp_register_script( 'um_admin_builder', $this->js_url . 'um-admin-builder.js', array('jquery', 'wp-util'), ultimatemember_version, true ); + public function load_builder() { + wp_register_script( 'um_admin_builder', $this->js_url . 'um-admin-builder.js', array( 'jquery', 'wp-util' ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_builder' ); //hide footer text on add/edit UM Forms @@ -310,9 +436,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { //and WP calculate page height $hide_footer = false; global $pagenow, $post; - if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && - ( ( isset( $_GET['post_type'] ) && 'um_form' === sanitize_key( $_GET['post_type'] ) ) || - ( isset( $post->post_type ) && 'um_form' === $post->post_type ) ) ) { + // phpcs:ignore WordPress.Security.NonceVerification + if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && ( ( isset( $_GET['post_type'] ) && 'um_form' === sanitize_key( $_GET['post_type'] ) ) || ( isset( $post->post_type ) && 'um_form' === $post->post_type ) ) ) { $hide_footer = true; } @@ -321,7 +446,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { ); wp_localize_script( 'um_admin_builder', 'um_admin_builder_data', $localize_data ); - wp_register_script( 'um_admin_dragdrop', $this->js_url . 'um-admin-dragdrop.js', array('jquery', 'wp-util'), ultimatemember_version, true ); + wp_register_script( 'um_admin_dragdrop', $this->js_url . 'um-admin-dragdrop.js', array( 'jquery', 'wp-util' ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_dragdrop' ); wp_register_style( 'um_admin_builder', $this->css_url . 'um-admin-builder.css', array(), ultimatemember_version ); @@ -332,7 +457,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load core WP styles/scripts */ - function load_core_wp() { + public function load_core_wp() { wp_enqueue_script( 'jquery-ui-draggable' ); wp_enqueue_script( 'jquery-ui-sortable' ); @@ -343,7 +468,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load Admin Styles */ - function load_css() { + public function load_css() { wp_register_style( 'um_admin_menu', $this->css_url . 'um-admin-menu.css', array(), ultimatemember_version ); wp_enqueue_style( 'um_admin_menu' ); @@ -358,7 +483,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load functions js */ - function load_functions() { + public function load_functions() { wp_register_script( 'um_scrollbar', um_url . 'assets/js/simplebar.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_functions', um_url . 'assets/js/um-functions.js', array( 'jquery', 'jquery-masonry', 'wp-util', 'um_scrollbar' ), ultimatemember_version, true ); wp_enqueue_script( 'um_functions' ); @@ -368,7 +493,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load Fonticons */ - function load_fonticons() { + public function load_fonticons() { wp_register_style( 'um_fonticons_ii', um_url . 'assets/css/um-fonticons-ii.css', array(), ultimatemember_version ); wp_enqueue_style( 'um_fonticons_ii' ); @@ -380,8 +505,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load global css */ - function load_global_scripts() { - wp_register_script( 'um_admin_global', $this->js_url . 'um-admin-global.js', array('jquery'), ultimatemember_version, true ); + public function load_global_scripts() { + wp_register_script( 'um_admin_global', $this->js_url . 'um-admin-global.js', array( 'jquery' ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_global' ); wp_register_style( 'um_admin_global', $this->css_url . 'um-admin-global.css', array(), ultimatemember_version ); @@ -392,7 +517,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load jQuery custom code */ - function load_custom_scripts() { + public function load_custom_scripts() { wp_register_script( 'um_datetime', $this->front_js_baseurl . 'pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_date', $this->front_js_baseurl . 'pickadate/picker.date.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); wp_register_script( 'um_datetime_time', $this->front_js_baseurl . 'pickadate/picker.time.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); @@ -401,9 +526,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { $locale = get_locale(); if ( $locale ) { if ( file_exists( WP_LANG_DIR . '/plugins/ultimate-member/assets/js/pickadate/' . $locale . '.js' ) ) { - wp_register_script('um_datetime_locale', content_url() . '/languages/plugins/ultimate-member/assets/js/pickadate/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_locale', content_url() . '/languages/plugins/ultimate-member/assets/js/pickadate/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); } elseif ( file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) { - wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); + wp_register_script( 'um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true ); } } @@ -411,9 +536,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_register_style( 'um_datetime_date', $this->front_css_baseurl . 'pickadate/default.date.css', array( 'um_datetime' ), ultimatemember_version ); wp_register_style( 'um_datetime_time', $this->front_css_baseurl . 'pickadate/default.time.css', array( 'um_datetime' ), ultimatemember_version ); - wp_enqueue_style( 'um_datetime_date', 'um_datetime_time' ); + wp_enqueue_style( 'um_datetime_date' ); + wp_enqueue_style( 'um_datetime_time' ); - wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', array('jquery','wp-util', 'wp-color-picker', 'um_datetime', 'um_datetime_date', 'um_datetime_time'/*, 'um_datetime_legacy'*/ ), ultimatemember_version, true ); + wp_register_script( 'um_admin_scripts', $this->js_url . 'um-admin-scripts.js', array( 'jquery', 'wp-util', 'wp-color-picker', 'um_datetime', 'um_datetime_date', 'um_datetime_time'/*, 'um_datetime_legacy'*/ ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_scripts' ); } @@ -421,8 +547,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load jQuery custom code */ - function load_nav_manus_scripts() { - wp_register_script( 'um_admin_nav_manus', $this->js_url . 'um-admin-nav-menu.js', array('jquery','wp-util'), ultimatemember_version, true ); + public function load_nav_manus_scripts() { + wp_register_script( 'um_admin_nav_manus', $this->js_url . 'um-admin-nav-menu.js', array( 'jquery', 'wp-util' ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_nav_manus' ); } @@ -430,8 +556,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load AJAX */ - function load_ajax_js() { - wp_register_script( 'um_admin_ajax', $this->js_url . 'um-admin-ajax.js', array('jquery','wp-util'), ultimatemember_version, true ); + public function load_ajax_js() { + wp_register_script( 'um_admin_ajax', $this->js_url . 'um-admin-ajax.js', array( 'jquery', 'wp-util' ), ultimatemember_version, true ); wp_enqueue_script( 'um_admin_ajax' ); } @@ -439,7 +565,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Load Gutenberg scripts */ - function load_gutenberg_js() { + public function load_gutenberg_js() { //disable Gutenberg scripts to avoid the conflicts $disable_script = apply_filters( 'um_disable_blocks_script', false ); if ( $disable_script ) { @@ -455,12 +581,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_set_script_translations( 'um_block_js', 'ultimate-member' ); $restrict_options = array(); - $roles = UM()->roles()->get_roles( false ); + $roles = UM()->roles()->get_roles( false ); if ( ! empty( $roles ) ) { foreach ( $roles as $role_key => $title ) { $restrict_options[] = array( 'label' => $title, - 'value' => $role_key + 'value' => $role_key, ); } } @@ -472,71 +598,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { } - /** - * Load Gutenberg blocks js - */ - function load_gutenberg_shortcode_blocks() { - if ( ! function_exists( 'register_block_type' ) ) { - // Gutenberg is not active. - return; - } - - //disable Gutenberg scripts to avoid the conflicts - $disable_script = apply_filters( 'um_disable_blocks_script', false ); - if ( $disable_script ) { - return; - } - - $enable_blocks = UM()->options()->get( 'enable_blocks' ); - if ( empty( $enable_blocks ) ) { - return; - } - - wp_register_script( 'um-blocks-shortcode-js', $this->js_url . 'um-admin-blocks-shortcode.js', array( 'wp-i18n', 'wp-blocks', 'wp-components', /*'rich-text'*/ ), ultimatemember_version, true ); - wp_set_script_translations( 'um-blocks-shortcode-js', 'ultimate-member' ); - wp_enqueue_script( 'um-blocks-shortcode-js' ); - - $account_settings = array( - 'password' => array( - 'label' => __( 'Password', 'ultimate-member' ), - 'enabled' => UM()->options()->get( 'account_tab_password' ), - ), - 'privacy' => array( - 'label' => __( 'Privacy', 'ultimate-member' ), - 'enabled' => UM()->options()->get( 'account_tab_privacy' ), - ), - 'notifications' => array( - 'label' => __( 'Notifications', 'ultimate-member' ), - 'enabled' => UM()->options()->get( 'account_tab_notifications' ), - ), - 'delete' => array( - 'label' => __( 'Delete', 'ultimate-member' ), - 'enabled' => UM()->options()->get( 'account_tab_delete' ), - ), - ); - wp_localize_script( 'um-blocks-shortcode-js', 'um_account_settings', $account_settings ); - - /** - * create gutenberg blocks - */ - register_block_type( 'um-block/um-forms', array( - 'editor_script' => 'um-blocks-shortcode-js', - ) ); - - register_block_type( 'um-block/um-member-directories', array( - 'editor_script' => 'um-blocks-shortcode-js', - ) ); - - register_block_type( 'um-block/um-password-reset', array( - 'editor_script' => 'um-blocks-shortcode-js', - ) ); - - register_block_type( 'um-block/um-account', array( - 'editor_script' => 'um-blocks-shortcode-js', - ) ); - } - - /** * Add Gutenberg category for UM shortcodes * @@ -545,27 +606,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { * * @return array */ - function blocks_category( $categories, $context ) { - $enable_blocks = UM()->options()->get( 'enable_blocks' ); - if ( empty( $enable_blocks ) ) { - return $categories; - } + public function blocks_category( $categories, $context ) { + $enable_blocks = UM()->options()->get( 'enable_blocks' ); + if ( empty( $enable_blocks ) ) { + return $categories; + } - return array_merge( - $categories, - array( - array( - 'slug' => 'um-blocks', - 'title' => __( 'Ultimate Member Blocks', 'ultimate-member' ), - ), - ) - ); - } + return array_merge( + $categories, + array( + array( + 'slug' => 'um-blocks', + 'title' => __( 'Ultimate Member Blocks', 'ultimate-member' ), + ), + ) + ); + } /** * Load localize scripts */ - function load_localize_scripts() { + public function load_localize_scripts() { /** * UM hook @@ -587,10 +648,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { * } * ?> */ - $localize_data = apply_filters( 'um_admin_enqueue_localize_data', array( - 'nonce' => wp_create_nonce( "um-admin-nonce" ) - ) - ); + $localize_data = apply_filters( 'um_admin_enqueue_localize_data', array( 'nonce' => wp_create_nonce( 'um-admin-nonce' ) ) ); wp_localize_script( 'um_admin_global', 'um_admin_scripts', $localize_data ); } @@ -599,7 +657,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Enqueue scripts and styles */ - function admin_enqueue_scripts() { + public function admin_enqueue_scripts() { if ( UM()->admin()->is_um_screen() ) { /*if ( get_post_type() != 'shop_order' ) { @@ -628,7 +686,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { $this->load_fonticons(); $this->load_localize_scripts(); - //scripts for frontend preview UM()->enqueue()->load_imagecrop(); UM()->enqueue()->load_css(); @@ -646,7 +703,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { wp_register_style( 'um_admin_rtl', $this->css_url . 'um-admin-rtl.css', array(), ultimatemember_version ); wp_enqueue_style( 'um_admin_rtl' ); } - } else { $this->load_global_scripts(); @@ -659,7 +715,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { if ( version_compare( $wp_version, '5.0', '>=' ) ) { if ( isset( $current_screen ) && $current_screen->is_block_editor() ) { $this->load_gutenberg_js(); - $this->load_gutenberg_shortcode_blocks(); } } } @@ -668,7 +723,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { /** * Print editor scripts if they are not printed by default */ - function admin_footer_scripts() { + public function admin_footer_scripts() { /** * @var $class \_WP_Editors */ diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index 5a624153..260d29a9 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -123,10 +123,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { 'href' => array(), 'title' => array(), 'target' => array(), + 'class' => array(), + ), + 'i' => array( + 'class' => array(), + ), + 'span' => array( + 'class' => array(), ), 'br' => array(), 'em' => array(), - 'strong' => array(), + 'strong' => array( + 'style' => array() + ), ); $data['value'] = wp_kses( $data['value'], $arr_kses ); } diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index b76a84ce..975febe9 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -34,18 +34,38 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { private $custom_nonce_added = false; - var $init_icon = false; + public $init_icon = false; + /** + * @var bool + */ + public $in_edit = false; + + /** + * @var null + */ + public $edit_mode_value = null; + + /** + * @var array + */ + public $edit_array = array(); + + /** + * @var array + */ + public $postmeta = array(); + + /** + * @var bool + */ + public $is_loaded = false; /** * Admin_Metabox constructor. */ - function __construct() { - $this->in_edit = false; - $this->edit_mode_value = null; - $this->edit_array = []; - - add_action( 'admin_head', array( &$this, 'admin_head' ), 9); + public function __construct() { + add_action( 'admin_head', array( &$this, 'admin_head' ), 9 ); add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 ); add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 ); diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 7b335fc5..d19e13da 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -52,6 +52,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $this->extensions_page(); + $this->template_version(); + // removed for now to avoid the bad reviews //$this->reviews_notice(); @@ -714,6 +716,37 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } + /** + * Check Templates Versions notice + */ + public function template_version() { + if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) { + $link = admin_url( 'admin.php?page=um_options&tab=override_templates' ); + ob_start(); + ?> + +

+ override templates status page and update templates.', 'ultimate-member' ), $link ), UM()->get_allowed_html( 'admin_notice' ) ); + ?> +

+ + admin()->notices()->add_notice( + 'um_override_templates_notice', + array( + 'class' => 'error', + 'message' => $message, + 'dismissible' => false, + ), + 10 + ); + } + } + + function dismiss_notice() { UM()->admin()->check_ajax_nonce(); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 176b29ba..6ab73b1d 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -64,10 +64,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 ); + //custom content for override templates tab + add_action( 'plugins_loaded', array( $this, 'um_check_template_version' ), 10 ); + add_filter( 'um_settings_section_override_templates__content', array( $this, 'settings_override_templates_tab' ), 10, 2 ); add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 ); - //save handlers add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 ); @@ -75,10 +77,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) ); add_action( 'um_settings_save', array( $this, 'on_settings_save' ) ); - add_filter( 'um_change_settings_before_save', array( $this, 'save_email_templates' ) ); - //save licenses options add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) ); add_action( 'um_settings_save', array( $this, 'licenses_save' ) ); @@ -422,6 +422,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'id' => 'profile_menu_icons', 'type' => 'checkbox', 'label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ), + 'description' => __( '"Desktop view" means the profile block\'s width lower than 800px', 'ultimate-member' ), 'conditional' => array( 'profile_menu', '=', 1 ), ), ) @@ -440,7 +441,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { $duplicates = array(); $taxonomies_options = array(); $exclude_taxonomies = UM()->excluded_taxonomies(); - $all_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); + $all_taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), 'objects' ); foreach ( $all_taxonomies as $key => $taxonomy ) { if ( in_array( $key, $exclude_taxonomies, true ) ) { continue; @@ -1839,6 +1840,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), ), ), + 'override_templates' => array( + 'title' => __( 'Override templates', 'ultimate-member' ), + 'fields' => array( + array( + 'type' => 'override_templates', + ), + ), + ), ) ); @@ -1966,7 +1975,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { */ do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" ); - if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) { + if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info', 'override_templates' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) { /** * UM hook @@ -3007,6 +3016,215 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { return $section; } + /** + * Periodically checking the versions of templates. + * + * @since 2.6.1 + * + * @return void + */ + public function um_check_template_version() { + $um_check_version = get_transient( 'um_check_template_versions' ); + if ( false === $um_check_version ) { + $this->get_override_templates(); + } + } + + /** + * HTML for Settings > Override Templates tab. + * @return void + */ + public function settings_override_templates_tab() { + $um_check_version = get_transient( 'um_check_template_versions' ); + ?> + +

+ + + + +

+

+ here.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1516-templates-map' ), UM()->get_allowed_html( 'admin_notice' ) ); + ?> +

+ + scan_template_files( um_path . '/templates/' ); + /** + * Filters an array of the template files for scanning versions. + * + * @since 2.6.1 + * @hook um_override_templates_scan_files + * + * @param {array} $scan_files Template files for scanning versions. + * + * @return {array} Template files for scanning versions. + */ + $scan_files = apply_filters( 'um_override_templates_scan_files', $scan_files ); + $out_date = false; + + set_transient( 'um_check_template_versions', time(), 12 * HOUR_IN_SECONDS ); + + foreach ( $scan_files as $key => $files ) { + foreach ( $files as $file ) { + if ( ! str_contains( $file, 'email/' ) ) { + $located = array(); + /** + * Filters an array of the template files for scanning versions based on $key. + * + * Note: $key - means um or extension key. + * + * @since 2.6.1 + * @hook um_override_templates_get_template_path__{$key} + * + * @param {array} $located Template file paths for scanning versions. + * @param {string} $file Template file name. + * + * @return {array} Template file paths for scanning versions. + */ + $located = apply_filters( "um_override_templates_get_template_path__{$key}", $located, $file ); + + if ( ! empty( $located ) ) { + $theme_file = $located['theme']; + } elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) { + $theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file; + } else { + $theme_file = false; + } + + if ( ! empty( $theme_file ) ) { + $core_file = $file; + + if ( ! empty( $located ) ) { + $core_path = $located['core']; + $core_file_path = stristr( $core_path, 'wp-content' ); + } else { + $core_path = um_path . '/templates/' . $core_file; + $core_file_path = stristr( um_path . 'templates/' . $core_file, 'wp-content' ); + } + $core_version = $this->get_file_version( $core_path ); + $theme_version = $this->get_file_version( $theme_file ); + + $status = esc_html__( 'Theme version up to date', 'ultimate-member' ); + $status_code = 1; + if ( version_compare( $theme_version, $core_version, '<' ) ) { + $status = esc_html__( 'Theme version is out of date', 'ultimate-member' ); + $status_code = 0; + } + if ( '' === $theme_version ) { + $status = esc_html__( 'Theme version is empty', 'ultimate-member' ); + $status_code = 0; + } + if ( 0 === $status_code ) { + $out_date = true; + update_option( 'um_override_templates_outdated', true ); + } + $outdated_files[] = array( + 'core_version' => $core_version, + 'theme_version' => $theme_version, + 'core_file' => $core_file_path, + 'theme_file' => stristr( $theme_file, 'wp-content' ), + 'status' => $status, + 'status_code' => $status_code, + ); + } + } + } + } + + if ( false === $out_date ) { + delete_option( 'um_override_templates_outdated' ); + } + update_option( 'um_template_statuses', $outdated_files ); + if ( true === $get_list ) { + return $outdated_files; + } + } + + + /** + * Scan the template files. + * + * @param string $template_path Path to the template directory. + * @return array + */ + public static function scan_template_files( $template_path ) { + $files = @scandir( $template_path ); // @codingStandardsIgnoreLine. + $result = array(); + + if ( ! empty( $files ) ) { + + foreach ( $files as $value ) { + + if ( ! in_array( $value, array( '.', '..' ), true ) ) { + + if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { + $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); + foreach ( $sub_files as $sub_file ) { + $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; + } + } else { + $result[] = $value; + } + } + } + } + return $result; + } + + /** + * @param $file string + * + * @return string + */ + public static function get_file_version( $file ) { + // Avoid notices if file does not exist. + if ( ! file_exists( $file ) ) { + return ''; + } + + // We don't need to write to the file, so just open for reading. + $fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine. + + // Pull only the first 8kiB of the file in. + $file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine. + + // PHP will close a file handle, but we are good citizens. + fclose( $fp ); // @codingStandardsIgnoreLine. + + // Make sure we catch CR-only line endings. + $file_data = str_replace( "\r", "\n", $file_data ); + $version = ''; + + if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { + $version = _cleanup_header_comment( $match[1] ); + } + + return $version; + } + /** * @param $html @@ -3237,18 +3455,22 @@ Blacklist Words: options()->get('bl --- UM Email Configurations --- -Mail appears from: options()->get('mail_from'); if( ! empty( $mail_from ) ){echo UM()->options()->get('mail_from');}else{echo "-";}; echo "\n";?> -Mail appears from address: options()->get('mail_from_addr'); if( ! empty( $mail_from_addr ) ){echo UM()->options()->get('mail_from_addr');}else{echo "-";}; echo "\n";?> -Use HTML for E-mails: info_value( UM()->options()->get('email_html'), 'yesno', true ); ?> -Account Welcome Email: info_value( UM()->options()->get('welcome_email_on'), 'yesno', true ); ?> -Account Activation Email: info_value( UM()->options()->get('checkmail_email_on'), 'yesno', true ); ?> -Pending Review Email: info_value( UM()->options()->get('pending_email_on'), 'yesno', true ); ?> -Account Approved Email: info_value( UM()->options()->get('approved_email_on'), 'yesno', true ); ?> -Account Rejected Email: info_value( UM()->options()->get('rejected_email_on'), 'yesno', true ); ?> -Account Deactivated Email: info_value( UM()->options()->get('inactive_email_on'), 'yesno', true ); ?> -Account Deleted Email: info_value( UM()->options()->get('deletion_email_on'), 'yesno', true ); ?> -Password Reset Email: info_value( UM()->options()->get('resetpw_email_on'), 'yesno', true ); ?> -Password Changed Email: info_value( UM()->options()->get('changedpw_email_on'), 'yesno', true ); ?> +Mail appears from: options()->get( 'mail_from' ); if ( ! empty( $mail_from ) ){ echo UM()->options()->get( 'mail_from' ); } else { echo "-"; }; echo "\n"; ?> +Mail appears from address: options()->get( 'mail_from_addr' ); if ( ! empty( $mail_from_addr ) ) { echo UM()->options()->get( 'mail_from_addr' ); } else { echo "-"; }; echo "\n"; ?> +Use HTML for E-mails: info_value( UM()->options()->get( 'email_html' ), 'yesno', true ); ?> +Account Welcome Email: info_value( UM()->options()->get( 'welcome_email_on' ), 'yesno', true ); ?> +Account Activation Email: info_value( UM()->options()->get( 'checkmail_email_on' ), 'yesno', true ); ?> +Pending Review Email: info_value( UM()->options()->get( 'pending_email_on' ), 'yesno', true ); ?> +Account Approved Email: info_value( UM()->options()->get( 'approved_email_on' ), 'yesno', true ); ?> +Account Rejected Email: info_value( UM()->options()->get( 'rejected_email_on' ), 'yesno', true ); ?> +Account Deactivated Email: info_value( UM()->options()->get( 'inactive_email_on' ), 'yesno', true ); ?> +Account Deleted Email: info_value( UM()->options()->get( 'deletion_email_on' ), 'yesno', true ); ?> +Password Reset Email: info_value( UM()->options()->get( 'resetpw_email_on' ), 'yesno', true ); ?> +Password Changed Email: info_value( UM()->options()->get( 'changedpw_email_on' ), 'yesno', true ); ?> +Account Updated Email: info_value( UM()->options()->get( 'changedaccount_email_on' ), 'yesno', true ); ?> +New User Notification: info_value( UM()->options()->get( 'notification_new_user_on' ), 'yesno', true ); ?> +Account Needs Review Notification: info_value( UM()->options()->get( 'notification_review_on' ), 'yesno', true ); ?> +Account Deletion Notification: info_value( UM()->options()->get( 'notification_deletion_on' ), 'yesno', true ); ?> --- UM Total Users --- diff --git a/includes/admin/core/class-admin-users.php b/includes/admin/core/class-admin-users.php index 339677b9..09cef460 100644 --- a/includes/admin/core/class-admin-users.php +++ b/includes/admin/core/class-admin-users.php @@ -14,14 +14,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) { */ class Admin_Users { + /** + * @var string + */ + public $custom_role = 'um_role'; /** * Admin_Users constructor. */ - function __construct() { - - $this->custom_role = 'um_role'; - + public function __construct() { add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) ); add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 ); @@ -273,7 +274,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) { $submitted = get_user_meta( $user_id, 'submitted', true ); if ( ! empty( $submitted ) ) { - $actions['view_info'] = '' . __( 'Info', 'ultimate-member' ) . ''; } diff --git a/includes/admin/core/list-tables/version-template-list-table.php b/includes/admin/core/list-tables/version-template-list-table.php new file mode 100644 index 00000000..940ba523 --- /dev/null +++ b/includes/admin/core/list-tables/version-template-list-table.php @@ -0,0 +1,215 @@ + __( 'item', 'ultimate-member' ), + 'plural' => __( 'items', 'ultimate-member' ), + 'ajax' => false, + ) + ); + + $this->no_items_message = $args['plural'] . ' ' . __( 'not found.', 'ultimate-member' ); + + parent::__construct( $args ); + } + + /** + * @param callable $name + * @param array $arguments + * + * @return mixed + */ + public function __call( $name, $arguments ) { + return call_user_func_array( array( $this, $name ), $arguments ); + } + + /** + * + */ + public function prepare_items() { + $screen = $this->screen; + + $columns = $this->get_columns(); + $sortable = $this->get_sortable_columns(); + $this->_column_headers = array( $columns, array(), $sortable ); + + $templates = get_option( 'um_template_statuses', array() ); + $templates = is_array( $templates ) ? $templates : array(); + + @uasort( + $templates, + function ( $a, $b ) { + if ( strtolower( $a['status_code'] ) === strtolower( $b['status_code'] ) ) { + return 0; + } + return ( strtolower( $a['status_code'] ) < strtolower( $b['status_code'] ) ) ? -1 : 1; + } + ); + + $per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); + $paged = $this->get_pagenum(); + + $this->items = array_slice( $templates, ( $paged - 1 ) * $per_page, $per_page ); + + $this->set_pagination_args( + array( + 'total_items' => count( $templates ), + 'per_page' => $per_page, + ) + ); + } + + /** + * @param object $item + * @param string $column_name + * + * @return string + */ + public function column_default( $item, $column_name ) { + if ( isset( $item[ $column_name ] ) ) { + return $item[ $column_name ]; + } else { + return ''; + } + } + + /** + * + */ + public function no_items() { + echo $this->no_items_message; + } + + /** + * @param array $args + * + * @return $this + */ + public function set_columns( $args = array() ) { + $this->columns = $args; + return $this; + } + + /** + * @return array + */ + public function get_columns() { + return $this->columns; + } + + /** + * @param $item + * + * @return string + */ + public function column_template( $item ) { + $output = esc_html__( 'Core path - ', 'ultimate-member' ); + $output .= $item['core_file'] . '
'; + $output .= esc_html__( 'Theme path - ', 'ultimate-member' ); + $output .= $item['theme_file']; + + return $output; + } + + /** + * @param $item + * + * @return string + */ + public function column_core_version( $item ) { + return $item['core_version']; + } + + /** + * @param $item + * + * @return string + */ + public function column_theme_version( $item ) { + return $item['theme_version'] ? $item['theme_version'] : '-'; + } + + /** + * @param $item + * + * @return string + */ + public function column_status( $item ) { + $icon = 1 === $item['status_code'] ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt'; + return $item['status'] . ' '; + } +} + +$list_table = new UM_Versions_List_Table( + array( + 'singular' => __( 'Template', 'ultimate-member' ), + 'plural' => __( 'Templates', 'ultimate-member' ), + 'ajax' => false, + ) +); + +/** + * UM hook + * + * @type filter + * @title um_versions_templates_columns + * @description Version Templates List Table columns + * @input_vars + * [{"var":"$columns","type":"array","desc":"Columns"}] + * @change_log + * ["Since: 2.0"] + * @usage add_filter( 'um_versions_templates_columns', 'function_name', 10, 1 ); + * @example + * + */ +$columns = apply_filters( + 'um_versions_templates_columns', + array( + 'template' => __( 'Template', 'ultimate-member' ), + 'core_version' => __( 'Core version', 'ultimate-member' ), + 'theme_version' => __( 'Theme version', 'ultimate-member' ), + 'status' => __( 'Status', 'ultimate-member' ), + ) +); + +$list_table->set_columns( $columns ); +$list_table->prepare_items(); +?> + +
+ + + display(); ?> +
diff --git a/includes/blocks/um-account/block.json b/includes/blocks/um-account/block.json new file mode 100644 index 00000000..2085aec7 --- /dev/null +++ b/includes/blocks/um-account/block.json @@ -0,0 +1,15 @@ +{ + "apiVersion": 2, + "name": "um-block/um-account", + "title": "Account", + "description": "Displaying the account page of the current user", + "icon": "id", + "category": "um-blocks", + "attributes": { + "tab": { + "type": "string" + } + }, + "editorScript": "file:./build/index.js", + "textdomain": "ultimate-member" +} diff --git a/includes/blocks/um-account/build/index.asset.php b/includes/blocks/um-account/build/index.asset.php new file mode 100644 index 00000000..cf48a0d1 --- /dev/null +++ b/includes/blocks/um-account/build/index.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-server-side-render'), 'version' => '98a99fd44cd9deb95734'); diff --git a/includes/blocks/um-account/build/index.js b/includes/blocks/um-account/build/index.js new file mode 100644 index 00000000..d8d1e5fe --- /dev/null +++ b/includes/blocks/um-account/build/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.wp.element,n=window.wp.blocks,a=window.wp.serverSideRender;var o=t.n(a);const u=window.wp.blockEditor,r=window.wp.components;(0,n.registerBlockType)("um-block/um-account",{edit:function(t){let{tab:n,setAttributes:a}=t.attributes;const c=(0,u.useBlockProps)();return(0,e.createElement)("div",c,(0,e.createElement)(o(),{block:"um-block/um-account",attributes:t.attributes}),(0,e.createElement)(u.InspectorControls,null,(0,e.createElement)(r.PanelBody,{title:wp.i18n.__("Account Tab","ultimate-member")},(0,e.createElement)(r.SelectControl,{label:wp.i18n.__("Select Tab","ultimate-member"),className:"um_select_account_tab",value:n,options:function(){var t=[];for(var e in t.push({label:wp.i18n.__("All","ultimate-member"),value:"all"}),um_account_settings)um_account_settings.hasOwnProperty(e)&&um_account_settings[e].enabled&&t.push({label:um_account_settings[e].label,value:e});return t}(),style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:e=>{t.setAttributes({tab:e}),function(e){var n="[ultimatemember_account";"all"!==e&&(n=n+' tab="'+e+'"'),n+="]",t.setAttributes({content:n})}(e)}}))))},save:function(t){return null}}),jQuery(window).on("load",(function(t){new MutationObserver((function(t){t.forEach((function(t){jQuery(t.addedNodes).find(".um.um-account").each((function(){var t=jQuery(this).find(".um-account-main").attr("data-current_tab");t&&(jQuery(this).find('.um-account-tab[data-tab="'+t+'"]').show(),jQuery(this).find(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),um_responsive(),um_modal_responsive())}))}))})).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})}))})(); \ No newline at end of file diff --git a/includes/blocks/um-account/src/index.js b/includes/blocks/um-account/src/index.js new file mode 100644 index 00000000..530cd789 --- /dev/null +++ b/includes/blocks/um-account/src/index.js @@ -0,0 +1,88 @@ +import { registerBlockType } from '@wordpress/blocks'; +import ServerSideRender from '@wordpress/server-side-render'; +import {InspectorControls, useBlockProps} from '@wordpress/block-editor'; +import {PanelBody, SelectControl} from "@wordpress/components"; + +registerBlockType('um-block/um-account', { + edit: function (props) { + let { tab, setAttributes } = props.attributes; + const blockProps = useBlockProps(); + + function get_options() { + var option = []; + + option.push( { label: wp.i18n.__( 'All', 'ultimate-member' ), value: 'all' } ); + + for ( var key in um_account_settings ) { + if ( um_account_settings.hasOwnProperty( key ) && um_account_settings[ key ]['enabled'] ) { + option.push( + { + label: um_account_settings[ key ]['label'], + value: key + } + ) + } + } + + return option; + } + + function umShortcode( value ) { + + var shortcode = '[ultimatemember_account'; + + if ( value !== 'all' ) { + shortcode = shortcode + ' tab="' + value + '"'; + } + + shortcode = shortcode + ']'; + + props.setAttributes({ content: shortcode }); + } + + return ( +
+ + + + { + props.setAttributes({ tab: value }); + umShortcode(value); + }} + /> + + +
+ ); + + }, + save: function save(props) { + return null; + } +}); + +jQuery(window).on( 'load', function($) { + var observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + + jQuery(mutation.addedNodes).find('.um.um-account').each(function() { + var current_tab = jQuery(this).find('.um-account-main').attr('data-current_tab'); + + if ( current_tab ) { + jQuery(this).find('.um-account-tab[data-tab="'+current_tab+'"]').show(); + jQuery(this).find('.um-account-tab:not(:visible)').find( 'input, select, textarea' ).not( ':disabled' ).addClass('um_account_inactive').prop( 'disabled', true ).attr( 'disabled', true ); + um_responsive(); + um_modal_responsive(); + } + }); + }); + }); + + observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true}); +}); diff --git a/includes/blocks/um-forms/block.json b/includes/blocks/um-forms/block.json new file mode 100644 index 00000000..563f7399 --- /dev/null +++ b/includes/blocks/um-forms/block.json @@ -0,0 +1,15 @@ +{ + "apiVersion": 2, + "name": "um-block/um-forms", + "title": "Form", + "description": "Choose display form", + "icon": "forms", + "category": "um-blocks", + "attributes": { + "form_id": { + "type": "integer" + } + }, + "editorScript": "file:./build/index.js", + "textdomain": "ultimate-member" +} diff --git a/includes/blocks/um-forms/build/index.asset.php b/includes/blocks/um-forms/build/index.asset.php new file mode 100644 index 00000000..6ef4166a --- /dev/null +++ b/includes/blocks/um-forms/build/index.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-server-side-render'), 'version' => '9dc130f3a0af7db5d679'); diff --git a/includes/blocks/um-forms/build/index.js b/includes/blocks/um-forms/build/index.js new file mode 100644 index 00000000..eaaac6a4 --- /dev/null +++ b/includes/blocks/um-forms/build/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,r=window.wp.data,n=window.wp.components,l=window.wp.blockEditor,o=window.wp.serverSideRender;var i=e.n(o);(0,window.wp.blocks.registerBlockType)("um-block/um-forms",{edit:function(e){let{form_id:o,setAttributes:a}=e.attributes;const s=(0,l.useBlockProps)(),m=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","um_form",{per_page:-1,_fields:["id","title"]})));if(!m)return(0,t.createElement)("p",null,(0,t.createElement)(n.Spinner,null),wp.i18n.__("Loading...","ultimate-member"));if(0===m.length)return"No forms found.";let c=[{id:"",title:""}].concat(m).map((e=>({label:e.title.rendered,value:e.id})));return(0,t.createElement)("div",s,(0,t.createElement)(i(),{block:"um-block/um-forms",attributes:e.attributes}),(0,t.createElement)(l.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:wp.i18n.__("Select Forms","ultimate-member")},(0,t.createElement)(n.SelectControl,{label:wp.i18n.__("Select Forms","ultimate-member"),className:"um_select_forms",value:o,options:c,style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:t=>{e.setAttributes({form_id:t})}}))))},save:function(e){return null}})})(); \ No newline at end of file diff --git a/includes/blocks/um-forms/src/index.js b/includes/blocks/um-forms/src/index.js new file mode 100644 index 00000000..27cc2418 --- /dev/null +++ b/includes/blocks/um-forms/src/index.js @@ -0,0 +1,91 @@ +import { useSelect } from '@wordpress/data'; +import { PanelBody, SelectControl, Spinner } from '@wordpress/components'; +import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; +import ServerSideRender from '@wordpress/server-side-render'; +import { registerBlockType } from "@wordpress/blocks"; + +registerBlockType('um-block/um-forms', { + edit: function (props) { + let { form_id, setAttributes } = props.attributes; + const blockProps = useBlockProps(); + const posts = useSelect((select) => { + return select('core').getEntityRecords('postType', 'um_form', { + per_page: -1, + _fields: ['id', 'title'] + }); + }); + + if (!posts) { + return ( +

+ + {wp.i18n.__('Loading...', 'ultimate-member')} +

+ ); + } + + if (posts.length === 0) { + return 'No forms found.'; + } + + function get_option( posts ) { + var option = []; + + posts.map( function( post ) { + option.push( + { + label: post.title.rendered, + value: post.id + } + ); + }); + + return option; + } + + function umShortcode( value ) { + + var shortcode = ''; + + if (value !== undefined && value !== '') { + shortcode = '[ultimatemember form_id="' + value + '"]'; + } + + return shortcode; + } + + let posts_data = [{ id: '', title: '' }].concat(posts); + + let get_post = posts_data.map((post) => { + return { + label: post.title.rendered, + value: post.id + }; + }); + + return ( +
+ + + + { + props.setAttributes({ form_id: value }); + umShortcode(value); + }} + /> + + +
+ ); + + }, + save: function save(props) { + return null; + } +}); diff --git a/includes/blocks/um-member-directories/block.json b/includes/blocks/um-member-directories/block.json new file mode 100644 index 00000000..ddaabf37 --- /dev/null +++ b/includes/blocks/um-member-directories/block.json @@ -0,0 +1,15 @@ +{ + "apiVersion": 2, + "name": "um-block/um-member-directories", + "title": "Member Directory", + "description": "Choose display directory", + "icon": "groups", + "category": "um-blocks", + "attributes": { + "member_id": { + "type": "integer" + } + }, + "editorScript": "file:./build/index.js", + "textdomain": "ultimate-member" +} diff --git a/includes/blocks/um-member-directories/build/index.asset.php b/includes/blocks/um-member-directories/build/index.asset.php new file mode 100644 index 00000000..8e85d2c6 --- /dev/null +++ b/includes/blocks/um-member-directories/build/index.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-server-side-render'), 'version' => '57ea4f619de4d752a4bb'); diff --git a/includes/blocks/um-member-directories/build/index.js b/includes/blocks/um-member-directories/build/index.js new file mode 100644 index 00000000..05bc85e3 --- /dev/null +++ b/includes/blocks/um-member-directories/build/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,r=window.wp.data,n=window.wp.components,i=window.wp.blockEditor,o=window.wp.serverSideRender;var l=e.n(o);(0,window.wp.blocks.registerBlockType)("um-block/um-member-directories",{edit:function(e){let{member_id:o,setAttributes:a}=e.attributes;const c=(0,i.useBlockProps)(),u=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","um_directory",{per_page:-1,_fields:["id","title"]})));if(!u)return(0,t.createElement)("p",null,(0,t.createElement)(n.Spinner,null),wp.i18n.__("Loading...","ultimate-member"));if(0===u.length)return"No posts found.";let d=[{id:"",title:""}].concat(u).map((e=>({label:e.title.rendered,value:e.id})));return(0,t.createElement)("div",c,(0,t.createElement)(l(),{block:"um-block/um-member-directories",attributes:e.attributes}),(0,t.createElement)(i.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:wp.i18n.__("Select Directories","ultimate-member")},(0,t.createElement)(n.SelectControl,{label:wp.i18n.__("Select Directories","ultimate-member"),className:"um_select_directory",value:o,options:d,style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:t=>{e.setAttributes({member_id:t})}}))))},save:function(e){return null}}),jQuery(window).on("load",(function(e){new MutationObserver((function(e){e.forEach((function(e){jQuery(e.addedNodes).find(".um.um-directory").each((function(){var e=jQuery(this);um_ajax_get_members(e)}))}))})).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})}))})(); \ No newline at end of file diff --git a/includes/blocks/um-member-directories/src/index.js b/includes/blocks/um-member-directories/src/index.js new file mode 100644 index 00000000..12ac4b6a --- /dev/null +++ b/includes/blocks/um-member-directories/src/index.js @@ -0,0 +1,105 @@ +import { useSelect } from '@wordpress/data'; +import { PanelBody, SelectControl, Spinner } from '@wordpress/components'; +import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; +import ServerSideRender from '@wordpress/server-side-render'; +import { registerBlockType } from "@wordpress/blocks"; + +registerBlockType('um-block/um-member-directories', { + edit: function (props) { + let { member_id, setAttributes } = props.attributes; + const blockProps = useBlockProps(); + const posts = useSelect((select) => { + return select('core').getEntityRecords('postType', 'um_directory', { + per_page: -1, + _fields: ['id', 'title'] + }); + }); + + if (!posts) { + return ( +

+ + {wp.i18n.__('Loading...', 'ultimate-member')} +

+ ); + } + + if (posts.length === 0) { + return 'No posts found.'; + } + + function get_option( posts ) { + var option = []; + + posts.map( function( post ) { + option.push( + { + label: post.title.rendered, + value: post.id + } + ); + }); + + return option; + } + + function umShortcode( value ) { + + var shortcode = ''; + + if (value !== undefined && value !== '') { + shortcode = '[ultimatemember form_id="' + value + '"]'; + } + + return shortcode; + } + + let posts_data = [{ id: '', title: '' }].concat(posts); + + let get_post = posts_data.map((post) => { + return { + label: post.title.rendered, + value: post.id + }; + }); + + return ( +
+ + + + { + props.setAttributes({ member_id: value }); + umShortcode(value); + }} + /> + + +
+ ); + + }, + save: function save(props) { + return null; + } +}); + +jQuery(window).on( 'load', function($) { + var observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + + jQuery(mutation.addedNodes).find('.um.um-directory').each(function() { + var directory = jQuery(this); + um_ajax_get_members( directory ); + }); + }); + }); + + observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true}); +}); diff --git a/includes/blocks/um-password-reset/block.json b/includes/blocks/um-password-reset/block.json new file mode 100644 index 00000000..f73a45ee --- /dev/null +++ b/includes/blocks/um-password-reset/block.json @@ -0,0 +1,10 @@ +{ + "apiVersion": 2, + "name": "um-block/um-password-reset", + "title": "Password Reset", + "description": "Displaying the password reset form", + "icon": "unlock", + "category": "um-blocks", + "editorScript": "file:./build/index.js", + "textdomain": "ultimate-member" +} diff --git a/includes/blocks/um-password-reset/build/index.asset.php b/includes/blocks/um-password-reset/build/index.asset.php new file mode 100644 index 00000000..75ba44e5 --- /dev/null +++ b/includes/blocks/um-password-reset/build/index.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-server-side-render'), 'version' => '95e8fe2695e681505871'); diff --git a/includes/blocks/um-password-reset/build/index.js b/includes/blocks/um-password-reset/build/index.js new file mode 100644 index 00000000..5f96959e --- /dev/null +++ b/includes/blocks/um-password-reset/build/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={n:r=>{var o=r&&r.__esModule?()=>r.default:()=>r;return e.d(o,{a:o}),o},d:(r,o)=>{for(var t in o)e.o(o,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:o[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};const r=window.wp.element,o=window.wp.blocks,t=window.wp.serverSideRender;var n=e.n(t);const s=window.wp.blockEditor;(0,o.registerBlockType)("um-block/um-password-reset",{edit:function(e){const o=(0,s.useBlockProps)();return(0,r.createElement)("div",o,(0,r.createElement)(n(),{block:"um-block/um-password-reset"}))},save:function(e){return null}})})(); \ No newline at end of file diff --git a/includes/blocks/um-password-reset/src/index.js b/includes/blocks/um-password-reset/src/index.js new file mode 100644 index 00000000..56ab795b --- /dev/null +++ b/includes/blocks/um-password-reset/src/index.js @@ -0,0 +1,19 @@ +import { registerBlockType } from '@wordpress/blocks'; +import ServerSideRender from '@wordpress/server-side-render'; +import { useBlockProps } from '@wordpress/block-editor'; + +registerBlockType('um-block/um-password-reset', { + edit: function (props) { + const blockProps = useBlockProps(); + + return ( +
+ +
+ ); + + }, + save: function save(props) { + return null; + } +}); diff --git a/includes/class-config.php b/includes/class-config.php index 296286d5..1892d6fe 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -17,83 +17,75 @@ if ( ! class_exists( 'um\Config' ) ) { */ class Config { + /** + * @var array + */ + public $core_forms; /** * @var array */ - var $core_forms; - - - /** - * @var array - */ - var $core_directories; - + public $core_directories; /** * @var mixed|void */ - var $core_pages; - + public $core_pages; /** * @var array */ - var $core_directory_meta = array(); - + public $core_directory_meta = array(); /** * @var array */ - var $core_global_meta_all; - + public $core_global_meta_all; /** * @var mixed|void */ - var $core_form_meta_all; - + public $core_form_meta_all; /** * @var array */ - var $core_form_meta = array(); - + public $core_form_meta = array(); /** * @var */ - var $perms; - + public $perms; /** * @var */ - var $nonadmin_perms; - + public $nonadmin_perms; /** * @var mixed|void */ - var $email_notifications; - + public $email_notifications; /** * @var mixed|void */ - var $settings_defaults; - + public $settings_defaults; /** * @var array */ - var $permalinks; + public $permalinks; + /** + * @var array|array[] + */ + public $default_roles_metadata = array(); /** * Config constructor. */ - function __construct() { + public function __construct() { $this->core_forms = array( 'register', 'login', @@ -457,7 +449,7 @@ if ( ! class_exists( 'um\Config' ) ) { 'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}

' . 'Thanks,
' . '{site_name}', - 'description' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)','ultimate-member'), + 'description' => __('Whether to send the user an email when he requests to reset password (Recommended, please keep on)','ultimate-member'), 'recipient' => 'user', 'default_active' => true ), diff --git a/includes/class-init.php b/includes/class-init.php index 1e64f3e3..9f6e01c5 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -71,6 +71,10 @@ if ( ! class_exists( 'UM' ) ) { */ public $is_permalinks; + /** + * @var null|string + */ + public $honeypot = null; /** * Main UM Instance @@ -82,7 +86,7 @@ if ( ! class_exists( 'UM' ) ) { * @see UM() * @return UM - Main instance */ - static public function instance() { + public static function instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); self::$instance->_um_construct(); @@ -602,6 +606,7 @@ if ( ! class_exists( 'UM' ) ) { $this->external_integrations(); $this->gdpr(); $this->member_directory(); + $this->blocks(); //if multisite networks active if ( is_multisite() ) { @@ -631,6 +636,20 @@ if ( ! class_exists( 'UM' ) ) { } + /** + * @since 2.6.1 + * + * @return um\core\Blocks() + */ + public function blocks() { + if ( empty( $this->classes['blocks'] ) ) { + $this->classes['blocks'] = new um\core\Blocks(); + } + + return $this->classes['blocks']; + } + + /** * Get extension API * diff --git a/includes/core/class-access.php b/includes/core/class-access.php index 9e445ac5..2be2b8a0 100644 --- a/includes/core/class-access.php +++ b/includes/core/class-access.php @@ -1196,7 +1196,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { if ( $block['attrs']['um_message_type'] == '1' ) { $block_content = $default_message; } elseif ( $block['attrs']['um_message_type'] == '2' ) { - $block_content = $block['attrs']['um_message_content']; + $block_content = isset( $block['attrs']['um_message_content'] ) ? esc_textarea( $block['attrs']['um_message_content'] ) : ''; } } } else { @@ -1220,7 +1220,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { if ( $block['attrs']['um_message_type'] == '1' ) { $block_content = $default_message; } elseif ( $block['attrs']['um_message_type'] == '2' ) { - $block_content = $block['attrs']['um_message_content']; + $block_content = isset( $block['attrs']['um_message_content'] ) ? esc_textarea( $block['attrs']['um_message_content'] ) : ''; } } } @@ -1234,7 +1234,7 @@ if ( ! class_exists( 'um\core\Access' ) ) { if ( $block['attrs']['um_message_type'] == '1' ) { $block_content = $default_message; } elseif ( $block['attrs']['um_message_type'] == '2' ) { - $block_content = $block['attrs']['um_message_content']; + $block_content = isset( $block['attrs']['um_message_content'] ) ? esc_textarea( $block['attrs']['um_message_content'] ) : ''; } } } diff --git a/includes/core/class-account.php b/includes/core/class-account.php index 95caa02c..446a5cb2 100644 --- a/includes/core/class-account.php +++ b/includes/core/class-account.php @@ -626,6 +626,9 @@ if ( ! class_exists( 'um\core\Account' ) ) { $this->init_displayed_fields( $fields, $id ); foreach ( $fields as $key => $data ) { + if ( isset( $shortcode_args['is_block'] ) && 1 === (int) $shortcode_args['is_block'] ) { + $data['is_block'] = 1; + } $output .= UM()->fields()->edit_field( $key, $data ); } break; @@ -666,6 +669,9 @@ if ( ! class_exists( 'um\core\Account' ) ) { $this->init_displayed_fields( $fields, $id ); foreach ( $fields as $key => $data ) { + if ( isset( $shortcode_args['is_block'] ) && 1 === (int) $shortcode_args['is_block'] ) { + $data['is_block'] = 1; + } $output .= UM()->fields()->edit_field( $key, $data ); } @@ -720,6 +726,9 @@ if ( ! class_exists( 'um\core\Account' ) ) { $this->init_displayed_fields( $fields, $id ); foreach ( $fields as $key => $data ) { + if ( isset( $shortcode_args['is_block'] ) && 1 === (int) $shortcode_args['is_block'] ) { + $data['is_block'] = 1; + } $output .= UM()->fields()->edit_field( $key, $data ); } @@ -758,6 +767,9 @@ if ( ! class_exists( 'um\core\Account' ) ) { $this->init_displayed_fields( $fields, $id ); foreach ( $fields as $key => $data ) { + if ( isset( $shortcode_args['is_block'] ) && 1 === (int) $shortcode_args['is_block'] ) { + $data['is_block'] = 1; + } $output .= UM()->fields()->edit_field( $key, $data ); } diff --git a/includes/core/class-blocks.php b/includes/core/class-blocks.php new file mode 100644 index 00000000..583743fb --- /dev/null +++ b/includes/core/class-blocks.php @@ -0,0 +1,162 @@ + 'boolean', + ); + } + if ( empty( $settings['attributes']['um_who_access'] ) ) { + $settings['attributes']['um_who_access'] = array( + 'type' => 'string', + ); + } + if ( empty( $settings['attributes']['um_roles_access'] ) ) { + $settings['attributes']['um_roles_access'] = array( + 'type' => 'array', + ); + } + if ( empty( $settings['attributes']['um_message_type'] ) ) { + $settings['attributes']['um_message_type'] = array( + 'type' => 'string', + ); + } + if ( empty( $settings['attributes']['um_message_content'] ) ) { + $settings['attributes']['um_message_content'] = array( + 'type' => 'string', + ); + } + + return $settings; + } + + + public function block_editor_render() { + //disable Gutenberg scripts to avoid the conflicts + $disable_script = apply_filters( 'um_disable_blocks_script', false ); + if ( $disable_script ) { + return; + } + + $enable_blocks = UM()->options()->get( 'enable_blocks' ); + if ( empty( $enable_blocks ) ) { + return; + } + + $blocks = array( + 'um-block/um-member-directories' => array( + 'render_callback' => array( $this, 'um_member_directories_render' ), + 'attributes' => array( + 'member_id' => array( + 'type' => 'string', + ), + ), + ), + 'um-block/um-forms' => array( + 'render_callback' => array( $this, 'um_forms_render' ), + 'attributes' => array( + 'form_id' => array( + 'type' => 'string', + ), + ), + ), + 'um-block/um-password-reset' => array( + 'render_callback' => array( $this, 'um_password_reset_render' ), + ), + 'um-block/um-account' => array( + 'render_callback' => array( $this, 'um_account_render' ), + 'attributes' => array( + 'tab' => array( + 'type' => 'string', + ), + ), + ), + ); + + foreach ( $blocks as $k => $block_data ) { + $block_type = str_replace( 'um-block/', '', $k ); + register_block_type_from_metadata( um_path . 'includes/blocks/' . $block_type, $block_data ); + } + } + + + public function um_member_directories_render( $atts ) { + $shortcode = '[ultimatemember'; + + if ( isset( $atts['member_id'] ) && '' !== $atts['member_id'] ) { + $shortcode .= ' form_id="' . $atts['member_id'] . '"'; + } + + $shortcode .= ']'; + + return apply_shortcodes( $shortcode ); + } + + + public function um_forms_render( $atts ) { + if ( isset( $atts['form_id'] ) && '' !== $atts['form_id'] ) { + $mode = get_post_meta( $atts['form_id'], '_um_mode', true ); + if ( 'profile' === $mode && ( um_is_core_page( 'account' ) || um_is_core_page( 'user' ) ) ) { + return ''; + } + } + $shortcode = '[ultimatemember is_block="1"'; + + if ( isset( $atts['form_id'] ) && '' !== $atts['form_id'] ) { + $shortcode .= ' form_id="' . $atts['form_id'] . '"'; + } + + $shortcode .= ']'; + + return apply_shortcodes( $shortcode ); + } + + + public function um_password_reset_render() { + $shortcode = '[ultimatemember_password]'; + + return apply_shortcodes( $shortcode ); + } + + + public function um_account_render( $atts ) { + if ( um_is_core_page( 'account' ) || um_is_core_page( 'user' ) ) { + return ''; + } + $shortcode = '[ultimatemember_account is_block="1"'; + + if ( isset( $atts['tab'] ) && 'all' !== $atts['tab'] ) { + $shortcode .= ' tab="' . $atts['tab'] . '"'; + } + + $shortcode .= ']'; + + return apply_shortcodes( $shortcode ); + } + } +} diff --git a/includes/core/class-builtin.php b/includes/core/class-builtin.php index 01655ba0..ea0b80fd 100644 --- a/includes/core/class-builtin.php +++ b/includes/core/class-builtin.php @@ -13,29 +13,40 @@ if ( ! class_exists( 'um\core\Builtin' ) ) { */ class Builtin { - /** * @var array */ public $predefined_fields = array(); + /** + * @var array + */ + public $all_user_fields = array(); /** * @var array */ - var $all_user_fields = array(); - + public $core_fields = array(); /** * @var array */ - var $core_fields = array(); + public $saved_fields = array(); + /** + * @var array + */ + public $custom_fields = array(); + + /** + * @var array + */ + public $fields_dropdown = array(); /** * Builtin constructor. */ - function __construct() { + public function __construct() { add_action( 'init', array( &$this, 'set_core_fields' ), 1 ); add_action( 'init', array( &$this, 'set_predefined_fields' ), 1 ); add_action( 'init', array( &$this, 'set_custom_fields' ), 1 ); diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index bede677e..596b9052 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -18,7 +18,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { /** * @var string */ - var $set_mode = ''; + public $set_mode = ''; /** @@ -26,17 +26,53 @@ if ( ! class_exists( 'um\core\Fields' ) ) { */ public $set_id = null; + /** + * @var bool + */ + public $editing = false; + + /** + * @var bool + */ + public $viewing = false; + + /** + * @var int + */ + public $timestamp = null; + + /** + * @var array + */ + public $global_args = array(); + + /** + * @var array + */ + public $field_icons = array(); + + /** + * @var array + */ + public $get_fields = array(); + + /** + * @var array + */ + public $rows = array(); + + /** + * @var array + */ + public $fields = array(); /** * Fields constructor. */ - function __construct() { - $this->editing = false; - $this->viewing = false; + public function __construct() { $this->timestamp = current_time( 'timestamp' ); } - /** * Standard checkbox field * @@ -2073,76 +2109,89 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return string|null * @throws \Exception */ - function edit_field( $key, $data, $rule = false, $args = array() ) { + public function edit_field( $key, $data, $rule = false, $args = array() ) { global $_um_profile_id; - $output = ''; + if ( isset( $data['is_block'] ) && 1 === (int) $data['is_block'] ) { + $form_suffix = ''; + } else { + $form_suffix = UM()->form()->form_suffix; + } + + $output = ''; $disabled = ''; if ( empty( $_um_profile_id ) ) { $_um_profile_id = um_user( 'ID' ); } + if ( ! is_user_logged_in() && isset( $data['is_block'] ) && 1 === (int) $data['is_block'] ) { + $_um_profile_id = 0; + } + // get whole field data if ( isset( $data ) && is_array( $data ) ) { - $data = $this->get_field( $key ); - if ( is_array( $data ) ) { - /** - * @var string $in_row - * @var boolean $in_sub_row - * @var boolean $in_column - * @var string $type - * @var string $metakey - * @var int $position - * @var string $title - * @var string $help - * @var array $options - * @var string $visibility - * @var string $label - * @var string $placeholder - * @var boolean $public - * @var boolean $editable - * @var string $icon - * @var boolean $in_group - * @var boolean $required - * @var string $validate - * @var string $default - * @var string $conditional - * @var string $input - * @var string $js_format - * @var string $date_max - * @var string $date_min - * @var string $disabled_weekdays - * @var string $years_x - * @var string $years - * @var string $range - * @var string $intervals - * @var string $height - * @var string $spacing - * @var string $borderwidth - * @var string $borderstyle - * @var string $bordercolor - * @var string $divider_text - * @var string $crop_class - * @var string $crop_data - * @var string $modal_size - * @var string $ratio - * @var string $min_width - * @var string $min_height - * @var string $button_text - * @var string $max_size - * @var string $max_size_error - * @var string $extension_error - * @var string $allowed_types - * @var string $upload_text - * @var string $max_files_error - * @var string $upload_help_text - * @var string $min_size_error - * @var string $filter - * @var string $content - * @var string $max_entries - */ - extract( $data ); + $origin_data = $this->get_field( $key ); + if ( is_array( $origin_data ) ) { + // Merge data passed with original field data. + $data = array_merge( $origin_data, $data ); } + + /** + * @var string $in_row + * @var boolean $in_sub_row + * @var boolean $in_column + * @var string $type + * @var string $metakey + * @var int $position + * @var string $title + * @var string $help + * @var array $options + * @var string $visibility + * @var string $label + * @var string $placeholder + * @var boolean $public + * @var boolean $editable + * @var string $icon + * @var boolean $in_group + * @var boolean $required + * @var string $validate + * @var string $default + * @var string $conditional + * @var string $input + * @var string $js_format + * @var string $date_max + * @var string $date_min + * @var string $disabled_weekdays + * @var string $years_x + * @var string $years + * @var string $range + * @var string $intervals + * @var string $height + * @var string $spacing + * @var string $borderwidth + * @var string $borderstyle + * @var string $bordercolor + * @var string $divider_text + * @var string $crop_class + * @var string $crop_data + * @var string $modal_size + * @var string $ratio + * @var string $min_width + * @var string $min_height + * @var string $button_text + * @var string $max_size + * @var string $max_size_error + * @var string $extension_error + * @var string $allowed_types + * @var string $upload_text + * @var string $max_files_error + * @var string $upload_help_text + * @var string $min_size_error + * @var string $filter + * @var string $content + * @var string $max_entries + */ + extract( $data ); } if ( ! isset( $data['type'] ) ) { @@ -2344,7 +2393,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $field_name = $key . UM()->form()->form_suffix; + $field_name = $key . $form_suffix; $field_value = htmlspecialchars( $this->field_value( $key, $default, $data ) ); $output .= ' @@ -2381,8 +2430,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $field_name = $key . UM()->form()->form_suffix; - $field_value = htmlspecialchars( $this->field_value( $key, $default, $data ) ); + $field_name = $key . $form_suffix; + $field_value = $this->field_value( $key, $default, $data ); + $field_value = ! is_null( $field_value ) ? htmlspecialchars( $field_value ) : null; $output .= ' @@ -2418,7 +2468,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $field_name = $key . UM()->form()->form_suffix; + $field_name = $key . $form_suffix; $field_value = htmlspecialchars( $this->field_value( $key, $default, $data ) ); $output .= ' @@ -2463,7 +2513,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $number_limit .= ' max="' . esc_attr( $max ) . '" '; } - $output .= ' + $output .= ' '; @@ -2499,7 +2549,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $output .= ' + $output .= ' '; @@ -2531,7 +2581,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $output .= ' + $output .= ' '; @@ -2567,7 +2617,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $name = $key . UM()->form()->form_suffix; + $name = $key . $form_suffix; if ( $this->set_mode == 'password' && um_is_core_page( 'password-reset' ) ) { $name = $key; } @@ -2605,7 +2655,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $name = $key . UM()->form()->form_suffix; + $name = $key . $form_suffix; if ( $this->set_mode == 'password' && um_is_core_page( 'password-reset' ) ) { $name = $key; } @@ -2655,7 +2705,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $output .= ' + $output .= ' '; @@ -2698,7 +2748,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $value = date( 'Y/m/d', $unixtimestamp ); } - $output .= ' + $output .= ' '; @@ -2728,7 +2778,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } - $output .= ' + $output .= ' '; @@ -2869,7 +2919,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } else { $field_value = $this->field_value( $key, $default, $data ); } - $output .= ''; + $output .= ''; if ( isset( $data['label'] ) ) { $output .= $this->field_label( $label, $key, $data ); } @@ -2954,7 +3004,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { /* Single File Upload */ case 'file': $output .= '
get_atts( $key, $classes, $conditional, $data ) . ' data-mode="' . esc_attr( $this->set_mode ) . '" data-upload-label="' . ( ! empty( $data['button_text'] ) ? esc_attr( $data['button_text'] ) : esc_attr__( 'Upload', 'ultimate-member' ) ) . '">'; - $output .= ''; + $output .= ''; if ( isset( $data['label'] ) ) { $output .= $this->field_label( $label, $key, $data ); } @@ -4188,6 +4238,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $col1_fields = $this->get_fields_in_column( $subrow_fields, 1 ); if ( $col1_fields ) { foreach ( $col1_fields as $key => $data ) { + if ( ! empty( $args['is_block'] ) ) { + $data['is_block'] = 1; + } $output .= $this->edit_field( $key, $data ); } } @@ -4199,6 +4252,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $col1_fields = $this->get_fields_in_column( $subrow_fields, 1 ); if ( $col1_fields ) { foreach ( $col1_fields as $key => $data ) { + if ( ! empty( $args['is_block'] ) ) { + $data['is_block'] = 1; + } $output .= $this->edit_field( $key, $data ); } } @@ -4208,6 +4264,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $col2_fields = $this->get_fields_in_column( $subrow_fields, 2 ); if ( $col2_fields ) { foreach ( $col2_fields as $key => $data ) { + if ( ! empty( $args['is_block'] ) ) { + $data['is_block'] = 1; + } $output .= $this->edit_field( $key, $data ); } } diff --git a/includes/core/class-files.php b/includes/core/class-files.php index d6460aad..8a702456 100644 --- a/includes/core/class-files.php +++ b/includes/core/class-files.php @@ -13,30 +13,45 @@ if ( ! class_exists( 'um\core\Files' ) ) { */ class Files { + /** + * @var + */ + public $upload_temp; /** * @var */ - var $upload_temp; - + public $upload_baseurl; /** * @var */ - var $upload_baseurl; - + public $upload_basedir; /** - * @var + * @var array|array[] */ - var $upload_basedir; + public $fonticon = array(); + /** + * @var null|string + */ + public $upload_dir = null; + + /** + * @var null + */ + public $upload_temp_url = null; + + /** + * @var string + */ + public $default_file_fonticon = 'um-faicon-file-o'; /** * Files constructor. */ - function __construct() { - + public function __construct() { $this->setup_paths(); add_action( 'template_redirect', array( &$this, 'download_routing' ), 1 ); @@ -63,8 +78,6 @@ if ( ! class_exists( 'um\core\Files' ) ) { 'tif' => array('icon' => 'um-icon-image' ), 'tiff' => array('icon' => 'um-icon-image' ), ); - - $this->default_file_fonticon = 'um-faicon-file-o'; } @@ -326,8 +339,8 @@ if ( ! class_exists( 'um\core\Files' ) ) { $user_id = empty( $_REQUEST['user_id'] ) ? get_current_user_id() : absint( $_REQUEST['user_id'] ); - UM()->fields()->set_id = filter_input( INPUT_POST, 'set_id', FILTER_SANITIZE_NUMBER_INT ); - UM()->fields()->set_mode = filter_input( INPUT_POST, 'set_mode', FILTER_SANITIZE_STRING ); + UM()->fields()->set_id = isset( $_POST['set_id'] ) ? absint( $_POST['set_id'] ) : null; + UM()->fields()->set_mode = isset( $_POST['set_mode'] ) ? sanitize_text_field( $_POST['set_mode'] ) : null; if ( UM()->fields()->set_mode != 'register' && ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) { $ret['error'] = esc_js( __( 'You have no permission to edit this user', 'ultimate-member' ) ); diff --git a/includes/core/class-form.php b/includes/core/class-form.php index 63b12717..1f958d90 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -13,43 +13,47 @@ if ( ! class_exists( 'um\core\Form' ) ) { */ class Form { - /** * @var null */ - public $form_suffix; - + public $form_suffix = null; /** * @var */ - var $form_id; - + public $form_id; /** * @var null */ - var $post_form = null; + public $post_form = null; + /** + * @var null + */ + public $nonce = null; - var $nonce = null; + /** + * @var null + */ + public $errors = null; + /** + * @var null + */ + public $processing = null; + + /** + * @var array + */ + public $all_fields = array(); /** * Form constructor. */ - function __construct() { - - $this->form_suffix = null; - - $this->errors = null; - - $this->processing = null; - + public function __construct() { add_action( 'template_redirect', array( &$this, 'form_init' ), 2 ); - add_action( 'init', array( &$this, 'field_declare' ), 10 ); - } diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php index e7c7b288..1474a316 100644 --- a/includes/core/class-mail.php +++ b/includes/core/class-mail.php @@ -1,43 +1,57 @@ options()->get( 'email_html' ) ) { $nl2br = true; @@ -54,11 +68,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) { return $nl2br; } - /** * Init paths for email notifications */ - function init_paths() { + public function init_paths() { /** * UM hook * @@ -83,13 +96,12 @@ if ( ! class_exists( 'um\core\Mail' ) ) { $this->path_by_slug = apply_filters( 'um_email_templates_path_by_slug', $this->path_by_slug ); } - /** * Check blog ID on multisite, return '' if single site * * @return string */ - function get_blog_id() { + public function get_blog_id() { $blog_id = ''; if ( is_multisite() ) { $blog_id = '/' . get_current_blog_id(); @@ -98,7 +110,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { return $blog_id; } - /** * Locate a template and return the path for inclusion. * @@ -106,25 +117,29 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * @param string $template_name * @return string */ - function locate_template( $template_name ) { + private function locate_template( $template_name ) { // check if there is template at theme folder $blog_id = $this->get_blog_id(); //get template file from current blog ID folder - $template = locate_template( array( - trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php' - ) ); + $template = locate_template( + array( + trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name . '.php', + ) + ); - //if there isn't template at theme folder for current blog ID get template file from theme folder + // If there isn't template at theme folder for current blog ID get template file from theme folder if ( is_multisite() && ! $template ) { - $template = locate_template( array( - trailingslashit( 'ultimate-member/email' ) . $template_name . '.php' - ) ); + $template = locate_template( + array( + trailingslashit( 'ultimate-member/email' ) . $template_name . '.php', + ) + ); } - //if there isn't template at theme folder get template file from plugin dir + // If there isn't template at theme folder, get template file from plugin dir if ( ! $template ) { - $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email'; + $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email'; $template = trailingslashit( $path ) . $template_name . '.php'; } @@ -154,13 +169,12 @@ if ( ! class_exists( 'um\core\Mail' ) ) { return apply_filters( 'um_locate_email_template', $template, $template_name ); } - /** * @param $slug * @param $args * @return bool|string */ - function get_email_template( $slug, $args = array() ) { + public function get_email_template( $slug, $args = array() ) { $located = $this->locate_template( $slug ); /** @@ -349,12 +363,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) { } echo $plain_email_template; - } $message = ob_get_clean(); - /** * UM hook * @@ -387,7 +399,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { return um_convert_tags( $message, $args ); } - /** * Send Email function * @@ -395,20 +406,39 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * @param null $template * @param array $args */ - function send( $email, $template, $args = array() ) { - + public function send( $email, $template, $args = array() ) { if ( ! is_email( $email ) ) { return; } - if ( UM()->options()->get( $template . '_on' ) != 1 ) { + if ( ! empty( UM()->options()->get( $template . '_on' ) ) ) { + return; + } + /** + * Filters for disabling email notifications programmatically. + * + * @since 2.6.1 + * @hook um_disable_email_notification_sending + * + * @param {bool} $disabled Does an email is disabled programmatically. By default it is false. + * @param {string} $email Email address for sending. + * @param {string} $template Email template key. + * @param {array} $args Arguments for sending email. + * + * @return {bool} `true` if email is disabled programmatically. + */ + $hook_disabled = apply_filters( 'um_disable_email_notification_sending', false, $email, $template, $args ); + if ( false !== $hook_disabled ) { return; } do_action( 'um_before_email_notification_sending', $email, $template, $args ); $this->attachments = array(); - $this->headers = 'From: '. stripslashes( UM()->options()->get('mail_from') ) .' <'. UM()->options()->get('mail_from_addr') .'>' . "\r\n"; + $this->headers = 'From: ' . stripslashes( UM()->options()->get( 'mail_from' ) ) . ' <' . UM()->options()->get( 'mail_from_addr' ) . '>' . "\r\n"; + + add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ), 10, 1 ); + add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ), 10, 1 ); /** * UM hook @@ -432,15 +462,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * } * ?> */ - - add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ), 10, 1 ); - add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ), 10, 1 ); - $subject = apply_filters( 'um_email_send_subject', UM()->options()->get( $template . '_sub' ), $template ); + $subject = wp_unslash( um_convert_tags( $subject, $args ) ); - $subject = wp_unslash( um_convert_tags( $subject , $args ) ); - - $this->subject = html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ); + $this->subject = html_entity_decode( $subject, ENT_QUOTES, 'UTF-8' ); $this->message = $this->prepare_template( $template, $args ); @@ -456,13 +481,12 @@ if ( ! class_exists( 'um\core\Mail' ) ) { do_action( 'um_after_email_notification_sending', $email, $template, $args ); } - /** * @param $template_name * * @return mixed|void */ - function get_template_filename( $template_name ) { + public function get_template_filename( $template_name ) { /** * UM hook * @@ -487,7 +511,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { return apply_filters( 'um_change_email_template_file', $template_name ); } - /** * Locate a template and return the path for inclusion. * @@ -495,15 +518,17 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * @param string $template_name * @return string */ - function template_in_theme( $template_name ) { + public function template_in_theme( $template_name ) { $template_name_file = $this->get_template_filename( $template_name ); $blog_id = $this->get_blog_id(); - // check if there is template at theme blog ID folder - $template = locate_template( array( - trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . '.php' - ) ); + // check if there is a template at theme blog ID folder + $template = locate_template( + array( + trailingslashit( 'ultimate-member/email' . $blog_id ) . $template_name_file . '.php', + ) + ); // Return what we found. if ( get_template_directory() === get_stylesheet_directory() ) { @@ -513,9 +538,8 @@ if ( ! class_exists( 'um\core\Mail' ) ) { } } - /** - * Method returns expected path for template + * Method returns an expected path for template * * @access public * @@ -524,34 +548,45 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * * @return string */ - function get_template_file( $location, $template_name ) { - $template_path = ''; + public function get_template_file( $location, $template_name ) { + $template_path = ''; $template_name_file = $this->get_template_filename( $template_name ); - switch( $location ) { + switch ( $location ) { case 'theme': //save email template in blog ID folder if we use multisite $blog_id = $this->get_blog_id(); - $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ). $template_name_file . '.php'; + $template_path = trailingslashit( get_stylesheet_directory() . '/ultimate-member/email' . $blog_id ) . $template_name_file . '.php'; break; case 'plugin': - $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email'; + $path = ! empty( $this->path_by_slug[ $template_name ] ) ? $this->path_by_slug[ $template_name ] : um_path . 'templates/email'; $template_path = trailingslashit( $path ) . $template_name . '.php'; break; } - return $template_path; + /** + * Filters an expected path for email template in theme or plugin. + * + * @since 2.6.1 + * @hook um_email_get_template_file_path + * + * @param {string} $template_path Expected template path. + * @param {string} $location Where to search 'theme||plugin'. + * @param {string} $template_name_file Expected filename. + * + * @return {string} Expected template path. + */ + return apply_filters( 'um_email_get_template_file_path', $template_path, $location, $template_name_file ); } - /** - * Ajax copy template to the theme + * Copy template to the theme * * @param string $template * @return bool */ - function copy_email_template( $template ) { + public function copy_email_template( $template ) { $in_theme = $this->template_in_theme( $template ); if ( $in_theme ) { return false; @@ -574,7 +609,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { } } - /** * UM Placeholders for site url, admin email, submit registration * @@ -582,7 +616,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * * @return array */ - function add_placeholder( $placeholders ) { + public function add_placeholder( $placeholders ) { $placeholders[] = '{user_profile_link}'; $placeholders[] = '{site_url}'; $placeholders[] = '{admin_email}'; @@ -593,7 +627,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) { return $placeholders; } - /** * UM Replace Placeholders for site url, admin email, submit registration * @@ -601,7 +634,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) { * * @return array */ - function add_replace_placeholder( $replace_placeholders ) { + public function add_replace_placeholder( $replace_placeholders ) { $replace_placeholders[] = um_user_profile_url(); $replace_placeholders[] = get_bloginfo( 'url' ); $replace_placeholders[] = um_admin_email(); diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 6c403722..b04cbca9 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -634,13 +634,16 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { if ( isset( $_GET[ 'filter_' . $attrs['parent_dropdown_relationship'] . '_' . $unique_hash ] ) ) { $_POST['parent_option_name'] = $attrs['parent_dropdown_relationship']; - $_POST['parent_option'] = explode( '||', filter_input( INPUT_GET, 'filter_' . $attrs['parent_dropdown_relationship'] . '_' . $unique_hash ) ); + + $parent_option_value = sanitize_text_field( $_GET[ 'filter_' . $attrs['parent_dropdown_relationship'] . '_' . $unique_hash ] ); + $_POST['parent_option'] = explode( '||', $parent_option_value ); } } $attrs['custom_dropdown_options_source'] = wp_unslash( $attrs['custom_dropdown_options_source'] ); $ajax_source = apply_filters( "um_custom_dropdown_options_source__{$filter}", $attrs['custom_dropdown_options_source'], $attrs ); + $custom_dropdown .= ' data-um-ajax-source="' . esc_attr( $ajax_source ) . '" '; $attrs['options'] = UM()->fields()->get_options_from_callback( $attrs, $attrs['type'] ); diff --git a/includes/core/class-profile.php b/includes/core/class-profile.php index 21d6196b..506973ca 100644 --- a/includes/core/class-profile.php +++ b/includes/core/class-profile.php @@ -31,6 +31,11 @@ if ( ! class_exists( 'um\core\Profile' ) ) { */ var $active_tab; + /** + * @var null + */ + public $active_subnav = null; + /** * Profile constructor. diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php index cd7fa823..c87ac86d 100644 --- a/includes/core/class-shortcodes.php +++ b/includes/core/class-shortcodes.php @@ -1,30 +1,62 @@ message_mode = false; - $this->custom_message = ''; - - $this->loop = array(); - + public function __construct() { add_shortcode( 'ultimatemember', array( &$this, 'ultimatemember' ) ); add_shortcode( 'ultimatemember_login', array( &$this, 'ultimatemember_login' ) ); @@ -123,10 +155,8 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { $this->emoji[':innocent:'] = $base_uri . '72x72/1f607.png'; $this->emoji[':smirk:'] = $base_uri . '72x72/1f60f.png'; $this->emoji[':expressionless:'] = $base_uri . '72x72/1f611.png'; - } - /** * Conditional logout form * @@ -430,11 +460,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { $args = ! empty( $args ) ? $args : array(); $default_login = $wpdb->get_var( - "SELECT pm.post_id - FROM {$wpdb->postmeta} pm + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) - WHERE pm.meta_key = '_um_mode' AND - pm.meta_value = 'login' AND + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'login' AND pm2.meta_value = '1'" ); @@ -463,11 +493,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { $args = ! empty( $args ) ? $args : array(); $default_register = $wpdb->get_var( - "SELECT pm.post_id - FROM {$wpdb->postmeta} pm + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) - WHERE pm.meta_key = '_um_mode' AND - pm.meta_value = 'register' AND + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'register' AND pm2.meta_value = '1'" ); @@ -496,11 +526,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { $args = ! empty( $args ) ? $args : array(); $default_profile = $wpdb->get_var( - "SELECT pm.post_id - FROM {$wpdb->postmeta} pm + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) - WHERE pm.meta_key = '_um_mode' AND - pm.meta_value = 'profile' AND + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'profile' AND pm2.meta_value = '1'" ); @@ -530,11 +560,11 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { $args = ! empty( $args ) ? $args : array(); $default_directory = $wpdb->get_var( - "SELECT pm.post_id - FROM {$wpdb->postmeta} pm + "SELECT pm.post_id + FROM {$wpdb->postmeta} pm LEFT JOIN {$wpdb->postmeta} pm2 ON( pm.post_id = pm2.post_id AND pm2.meta_key = '_um_is_default' ) - WHERE pm.meta_key = '_um_mode' AND - pm.meta_value = 'directory' AND + WHERE pm.meta_key = '_um_mode' AND + pm.meta_value = 'directory' AND pm2.meta_value = '1'" ); @@ -691,6 +721,10 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) { } } + if ( ! is_user_logged_in() && isset( $args['is_block'] ) && 1 === (int) $args['is_block'] && 'profile' === $mode ) { + return; + } + // for profiles only if ( $mode == 'profile' && um_profile_id() ) { diff --git a/includes/core/class-user.php b/includes/core/class-user.php index 572999a9..918708e7 100644 --- a/includes/core/class-user.php +++ b/includes/core/class-user.php @@ -22,35 +22,86 @@ if ( ! class_exists( 'um\core\User' ) ) { */ public $previous_data = null; + /** + * @var int + */ + public $id = 0; + + /** + * @var null + */ + public $usermeta = null; + + /** + * @var null + */ + public $data = null; + + /** + * @var null + */ + public $profile = null; + + /** + * @var null + */ + public $cannot_edit = null; + + /** + * @var null + */ + public $deleted_user_id = null; + + /** + * @var array|string[] + */ + public $banned_keys = array(); + + /** + * @var bool + */ + public $preview = false; + + /** + * @var bool + */ + public $send_mail_on_delete = true; + + /** + * A list of keys that should never be in wp_usermeta. + * @var array|string[] + */ + public $update_user_keys = array(); + + /** + * @var null + */ + public $target_id = null; /** * User constructor. */ - function __construct() { - - $this->id = 0; - $this->usermeta = null; - $this->data = null; - $this->profile = null; - $this->cannot_edit = null; - $this->deleted_user_id = null; - + public function __construct() { global $wpdb; $this->banned_keys = array( - 'metabox','postbox','meta-box', - 'dismissed_wp_pointers', 'session_tokens', - 'screen_layout', 'wp_user-', 'dismissed', - 'cap_key', $wpdb->get_blog_prefix(). 'capabilities', - 'managenav', 'nav_menu', 'user_activation_key', - 'level_', $wpdb->get_blog_prefix() . 'user_level' + 'metabox', + 'postbox', + 'meta-box', + 'dismissed_wp_pointers', + 'session_tokens', + 'screen_layout', + 'wp_user-', + 'dismissed', + 'cap_key', + $wpdb->get_blog_prefix() . 'capabilities', + 'managenav', + 'nav_menu', + 'user_activation_key', + 'level_', + $wpdb->get_blog_prefix() . 'user_level', ); - add_action( 'init', array( &$this, 'set' ), 1 ); - - $this->preview = false; - $this->send_mail_on_delete = true; - // a list of keys that should never be in wp_usermeta $this->update_user_keys = array( 'user_email', @@ -61,7 +112,7 @@ if ( ! class_exists( 'um\core\User' ) ) { 'role', ); - $this->target_id = null; + add_action( 'init', array( &$this, 'set' ), 1 ); // When the cache should be cleared add_action( 'um_delete_user', array( &$this, 'remove_cache' ), 10, 1 ); @@ -88,7 +139,6 @@ if ( ! class_exists( 'um\core\User' ) ) { add_action( 'user_register', array( &$this, 'user_register_via_admin' ), 10, 1 ); add_action( 'user_register', array( &$this, 'set_gravatar' ), 11, 1 ); - if ( is_multisite() ) { add_action( 'added_existing_user', array( &$this, 'add_um_role_existing_user' ), 10, 2 ); add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 ); @@ -102,13 +152,11 @@ if ( ! class_exists( 'um\core\User' ) ) { add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 ); } - add_action( 'updated_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 ); add_action( 'added_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 ); add_action( 'deleted_user_meta', array( &$this, 'on_delete_usermeta' ), 10, 4 ); - add_action( 'update_user_meta', array( &$this, 'flush_um_count_users_transient_update' ), 10, 4 ); add_action( 'added_user_meta', array( &$this, 'flush_um_count_users_transient_add' ), 10, 4 ); add_action( 'delete_user_meta', array( &$this, 'flush_um_count_users_transient_delete' ), 10, 4 ); diff --git a/includes/core/class-validation.php b/includes/core/class-validation.php index 4f98a5e7..9a5c54b2 100644 --- a/includes/core/class-validation.php +++ b/includes/core/class-validation.php @@ -13,16 +13,25 @@ if ( ! class_exists( 'um\core\Validation' ) ) { */ class Validation { + /** + * @var string + */ + public $regex_safe = '/\A[\w\-\.]+\z/'; + + /** + * @var string + */ + public $regex_username_safe = '|[^a-z0-9 _.\-@]|i'; + + /** + * @var string + */ + public $regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/'; /** * Validation constructor. */ - function __construct() { - $this->regex_safe = '/\A[\w\-\.]+\z/'; - $this->regex_username_safe = '|[^a-z0-9 _.\-@]|i'; - $this->regex_phone_number = '/\A[\d\-\.\+\(\)\ ]+\z/'; - - + public function __construct() { add_filter( 'um_user_pre_updating_files_array', array( $this, 'validate_files' ), 10, 1 ); add_filter( 'um_before_save_filter_submitted', array( $this, 'validate_fields_values' ), 10, 2 ); } @@ -91,7 +100,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) { } // Dropdown options source from callback function - if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) && + if ( in_array( $fields[ $key ]['type'], array( 'select','multiselect' ) ) && isset( $fields[ $key ]['custom_dropdown_options_source'] ) && ! empty( $fields[ $key ]['custom_dropdown_options_source'] ) && function_exists( $fields[ $key ]['custom_dropdown_options_source'] ) ) { @@ -100,7 +109,7 @@ if ( ! class_exists( 'um\core\Validation' ) ) { $fields[ $key ]['options'] = array_keys( $arr_options ); } } - + // Unset changed value that doesn't match the option list if ( in_array( $fields[ $key ]['type'], array( 'select' ) ) && ! empty( $stripslashes ) && ! empty( $fields[ $key ]['options'] ) && @@ -297,10 +306,10 @@ if ( ! class_exists( 'um\core\Validation' ) ) { if ( ! $string ) { return true; } - if ( substr_count( $string, '#' ) > 1 ) { + if ( strlen( $string ) < 2 || strlen( $string ) > 31 ) { return false; } - if ( ! preg_match( '/^(.+)#(\d+)$/', trim( $string ) ) ) { + if ( ! preg_match( '/^[a-z\d_]+(?:\.[a-z\d_]+)*(\.[a-z]*)?$/', trim( $string ) ) ) { return false; } return true; diff --git a/includes/core/um-actions-account.php b/includes/core/um-actions-account.php index 84e099fd..44ef426d 100644 --- a/includes/core/um-actions-account.php +++ b/includes/core/um-actions-account.php @@ -593,20 +593,20 @@ function um_after_account_privacy( $args ) {
get_row( - "SELECT ID - FROM $wpdb->posts - WHERE post_author = $user_id AND - post_type = 'user_request' AND - post_name = 'export_personal_data' AND - post_status = 'request-completed' - ORDER BY ID DESC + "SELECT ID + FROM $wpdb->posts + WHERE post_author = $user_id AND + post_type = 'user_request' AND + post_name = 'export_personal_data' AND + post_status = 'request-completed' + ORDER BY ID DESC LIMIT 1", ARRAY_A ); if ( ! empty( $completed ) ) { - + $exports_url = wp_privacy_exports_url(); - + echo '

' . esc_html__( 'You could download your previous data:', 'ultimate-member' ) . '

'; echo '' . esc_html__( 'Download Personal Data', 'ultimate-member' ) . ''; echo '

' . esc_html__( 'You could send a new request for an export of personal your data.', 'ultimate-member' ) . '

'; @@ -614,13 +614,13 @@ function um_after_account_privacy( $args ) { } $pending = $wpdb->get_row( - "SELECT ID, post_status - FROM $wpdb->posts - WHERE post_author = $user_id AND - post_type = 'user_request' AND - post_name = 'export_personal_data' AND - post_status != 'request-completed' - ORDER BY ID DESC + "SELECT ID, post_status + FROM $wpdb->posts + WHERE post_author = $user_id AND + post_type = 'user_request' AND + post_name = 'export_personal_data' AND + post_status != 'request-completed' + ORDER BY ID DESC LIMIT 1", ARRAY_A ); @@ -670,13 +670,13 @@ function um_after_account_privacy( $args ) { get_row( - "SELECT ID - FROM $wpdb->posts - WHERE post_author = $user_id AND - post_type = 'user_request' AND - post_name = 'remove_personal_data' AND - post_status = 'request-completed' - ORDER BY ID DESC + "SELECT ID + FROM $wpdb->posts + WHERE post_author = $user_id AND + post_type = 'user_request' AND + post_name = 'remove_personal_data' AND + post_status = 'request-completed' + ORDER BY ID DESC LIMIT 1", ARRAY_A ); @@ -688,13 +688,13 @@ function um_after_account_privacy( $args ) { } $pending = $wpdb->get_row( - "SELECT ID, post_status - FROM $wpdb->posts - WHERE post_author = $user_id AND - post_type = 'user_request' AND - post_name = 'remove_personal_data' AND - post_status != 'request-completed' - ORDER BY ID DESC + "SELECT ID, post_status + FROM $wpdb->posts + WHERE post_author = $user_id AND + post_type = 'user_request' AND + post_name = 'remove_personal_data' AND + post_status != 'request-completed' + ORDER BY ID DESC LIMIT 1", ARRAY_A ); diff --git a/includes/core/um-actions-login.php b/includes/core/um-actions-login.php index c960a81d..3c4ae9b7 100644 --- a/includes/core/um-actions-login.php +++ b/includes/core/um-actions-login.php @@ -71,7 +71,7 @@ function um_submit_form_errors_hook_login( $args ) { if ( ! empty( $third_party_codes ) && in_array( $user->get_error_code(), $third_party_codes ) ) { UM()->form()->add_error( $user->get_error_code(), $user->get_error_message() ); } else { - UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) ); + UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) ); } } @@ -80,7 +80,7 @@ function um_submit_form_errors_hook_login( $args ) { if ( ! empty( $third_party_codes ) && in_array( $user->get_error_code(), $third_party_codes ) ) { UM()->form()->add_error( $user->get_error_code(), $user->get_error_message() ); } else { - UM()->form()->add_error( $user->get_error_code(), __( 'Password is incorrect. Please try again.', 'ultimate-member' ) ); + UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) ); } } diff --git a/includes/core/um-filters-profile.php b/includes/core/um-filters-profile.php index f6b6d869..34a7f3d7 100644 --- a/includes/core/um-filters-profile.php +++ b/includes/core/um-filters-profile.php @@ -66,7 +66,7 @@ function um_dynamic_user_profile_title( $title, $id = '' ) { return $title; } - return ( strlen( $title ) !== mb_strlen( $title ) ) ? $title : utf8_encode( $title ); + return ( strlen( $title ) !== mb_strlen( $title ) ) ? $title : mb_convert_encoding( $title, 'UTF-8' ); } add_filter( 'the_title', 'um_dynamic_user_profile_title', 100000, 2 ); diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index fd99493e..9c181605 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -671,10 +671,10 @@ function um_get_snippet( $str, $wordCount = 10 ) { /** * Format submitted data for Info preview & Email template - * @param boolean $style + * @param boolean $style * @return string * - * @since 2.1.4 + * @since 2.1.4 */ function um_user_submitted_registration_formatted( $style = false ) { $output = null; @@ -839,7 +839,7 @@ function um_user_submitted_registration_formatted( $style = false ) { * @param boolean $style * @return string * - * @since 2.1.4 + * @since 2.1.4 */ function um_user_submited_display( $k, $title, $data = array(), $style = true ) { $output = ''; @@ -1142,8 +1142,8 @@ function um_is_file_owner( $url, $user_id = null, $image_path = false ) { /** * Check if file is temporary - * @param string $filename - * @return bool + * @param string $filename + * @return bool */ function um_is_temp_file( $filename ) { $user_basedir = UM()->uploader()->get_upload_user_base_dir( 'temp' ); @@ -2503,7 +2503,7 @@ function um_user( $data, $attrs = null ) { case 'profile_photo': $data = um_get_user_avatar_data( um_user( 'ID' ), $attrs ); - return sprintf( '%s', + return sprintf( '%s', esc_attr( $data['url'] ), esc_attr( $data['class'] ), esc_attr( $data['size'] ), @@ -2553,7 +2553,7 @@ function um_user( $data, $attrs = null ) { $alt = um_profile( 'nickname' ); - $cover_html = $cover_uri ? '' . esc_attr( $alt ) . '' : ''; + $cover_html = $cover_uri ? '' . esc_attr( $alt ) . '' : ''; $cover_html = apply_filters( 'um_user_cover_photo_html__filter', $cover_html, $cover_uri, $alt, $is_default, $attrs ); return $cover_html; diff --git a/package.json b/package.json index faa58dc5..ce1525b8 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,13 @@ } ], "scripts": { - "postinstall": "node node_modules/bower/bin/bower install && grunt dev" + "postinstall": "node node_modules/bower/bin/bower install && grunt dev", + "build": "npm-run-all build:*", + "build:all-blocks": "npm-run-all --parallel build-block-*", + "build-block-um-member-directories": "cd includes/blocks/um-member-directories && wp-scripts build src/index.js", + "build-block-um-forms": "cd includes/blocks/um-forms && wp-scripts build src/index.js", + "build-block-um-password-reset": "cd includes/blocks/um-password-reset && wp-scripts build src/index.js", + "build-block-um-account": "cd includes/blocks/um-account && wp-scripts build src/index.js" }, "engines": { "node": ">= 0.10.0" @@ -27,10 +33,18 @@ "gulp-cli": "^2.3.0", "gulp-concat": "2.6.1", "gulp-rename": "^2.0.0", - "gulp-sass": "^4.1.0", + "gulp-sass": "^5.1.0", "gulp-uglify": "^3.0.2", - "gulp-clean-css": "^4.3.0" + "gulp-clean-css": "^4.3.0", + "npm-run-all": "^4.1.5", + "@wordpress/block-editor": "^11.5.0", + "@wordpress/blocks": "^12.5.0", + "@wordpress/components": "^23.5.0", + "@wordpress/i18n": "^4.28.0", + "@wordpress/scripts": "^25.5.1", + "@wordpress/server-side-render": "^4.5.0" }, "dependencies": { + "react": "^18.2.0" } } diff --git a/readme.txt b/readme.txt index 642a02a5..9440cc54 100644 --- a/readme.txt +++ b/readme.txt @@ -2,12 +2,12 @@ Author URI: https://ultimatemember.com/ Plugin URI: https://ultimatemember.com/ Contributors: ultimatemember, champsupertramp, nsinelnikov -Donate link: +Donate link: Tags: community, member, membership, user-profile, user-registration Requires PHP: 5.6 -Requires at least: 5.0 +Requires at least: 5.5 Tested up to: 6.2 -Stable tag: 2.6.0 +Stable tag: 2.6.1 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-3.0.txt @@ -119,7 +119,7 @@ No, we have built Ultimate Member to be extremely easy to use and does not requi = Is Ultimate Member mobile responsive? = -Yes. Ultimate Member is designed to adapt nicely to any screen resolution. It includes specific designs for phones, tablets and desktops. +Yes. Ultimate Member is designed to adapt nicely to any screen resolution. It includes specific designs for phones, tablets and desktops. = Is Ultimate Member multi-site compatible? = @@ -131,7 +131,7 @@ Yes. Ultimate Member will work with any properly coded theme. However, some them = Does the plugin work with caching plugins? = -The plugin works with popular caching plugins by automatically excluding Ultimate Member pages from being cached. This ensures other visitors to a page will not see the private information of another user. However, if you add features of Ultimate Member to other pages you have to exclude those pages from being cached through your cache plugin settings panel. +The plugin works with popular caching plugins by automatically excluding Ultimate Member pages from being cached. This ensures other visitors to a page will not see the private information of another user. However, if you add features of Ultimate Member to other pages you have to exclude those pages from being cached through your cache plugin settings panel. = Does Ultimate Member restrict access to wp-login.php when the plugin is active? = @@ -163,6 +163,32 @@ No, you do not need to use our plugin’s login or registration pages and can us * To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0) * UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin += 2.6.1: May 25, 2023 = + +* Enhancements: + + - Added: Override templates versioning utility for wp-admin + - Added: Style and class attributes to `info_text` field type in settings + - Added: Emails to install info + - Added: 'um_email_get_template_file_path' hook + - Added: Merging data passed with original field data when `edit_field()` function running + - Added: loading="lazy" for avatars and cover photos + - Tweak: Changed Discord account validation + - Tweak: Changes the structure for the Gutenberg blocks' scripts and way of registration + - Tweak: Removed `filter_input` function using + +* Bugfixes: + + - Fixed: Removed the hidden in UI taxonomies from the Access > Enable the "Content Restriction" settings for taxonomies setting + - Fixed: Dynamically declared variables inside the classes for PHP8 installations + - Fixed: Added wpnonce attribute for duplicate UM Form link + - Fixed: Sanitize restriction messages when Gutenberg block is restricted + - Fixed: Login form error class vulnerability + +* All templates required update. Please add the version comments to your custom templates in themes + +* Cached and optimized/minified assets(JS/CSS) must be flushed/re-generated after upgrade + = 2.6.0: March 29, 2023 = * Enhancements: @@ -1494,7 +1520,7 @@ No, you do not need to use our plugin’s login or registration pages and can us - Add class for member tagline in directory grid `um-member-tagline-` - Add recaptcha support and submit button id - Update extensions page layout - + * Bugfixes: - Fix Conditional Logic fields - Fix required field with specific roles in privacy @@ -1510,7 +1536,7 @@ No, you do not need to use our plugin’s login or registration pages and can us * Enhancements: - Update readme.txt - + = 1.3.85: June 19, 2017 = @@ -1540,12 +1566,12 @@ No, you do not need to use our plugin’s login or registration pages and can us * Fix png image upload with transparency * Fix extra slashes in form edit view when invalid input fields occur * Remove notices - - + + = 1.3.84: April 18, 2017 = * Enhancements: - * Adds new action hooks before and after WP_User_Query. + * Adds new action hooks before and after WP_User_Query. * `um_user_before_query` * `um_user_after_query` * Adds a dismiss link in locale / language translation notices @@ -1561,7 +1587,7 @@ No, you do not need to use our plugin’s login or registration pages and can us * Bugfixes * Fix image url cache filter - * Fix PHP 7.1+ compatibility issues + * Fix PHP 7.1+ compatibility issues * Fix UTF8 encoding in form fields * Fix hide member directory option. * Fix conditional logic fields. @@ -1576,7 +1602,7 @@ No, you do not need to use our plugin’s login or registration pages and can us * Enhancements: * Adds user avatar's alternate text. The default text is set to `display_name` - * Adds new filter hook to modif the user avatar's alternate text. + * Adds new filter hook to modif the user avatar's alternate text. * `um_avatar_image_alternate_text` * Set gravatar for newly registered users * Adds Tag archive page access settings @@ -1674,11 +1700,11 @@ No, you do not need to use our plugin’s login or registration pages and can us * Bugfixes: * Fix 'Invalid user ID' on profile update - + = 1.3.74: November 29, 2016 = * Enhancements: - * Improves clear users cache. + * Improves clear users cache. * Removes user id from redirect URL on registration process for pending review and email activation statuses. * Bugfixes: @@ -1723,10 +1749,10 @@ No, you do not need to use our plugin’s login or registration pages and can us * Enhancements: * Improves the bulk filters, actions and redirection in `User Screens` - * Adds new access options to disallow access on homepage and category pages. + * Adds new access options to disallow access on homepage and category pages. * Adds Textarea to show in profile tagline on Member Directory * Adds a filter hook `um_allow_frontend_image_uploads` to allow profile and cover photo uploads on front-end pages. - * Adds new filter hooks to modify image field data on upload: + * Adds new filter hooks to modify image field data on upload: * `um_image_handle_global__option` * `um_image_handle_{$field}__option` * Adds a new filter hook to modify the redirection of non logged in users who visit the parent user page. @@ -1745,7 +1771,7 @@ No, you do not need to use our plugin’s login or registration pages and can us * Fixes a typo in Password Reset Email option's description * Fixes a bug where conditional fields 'equals to' validation on registration process * Fixes a bug to disable the query with hiding account on member directory - * Fixes a bug to retrieve specific number of members + * Fixes a bug to retrieve specific number of members * Fixes a bug to retrieve all members with `get_members` new parameter `number` * Fixes a typo in Welcome Email template. * Fixes a bug where login form redirection is set to `wp-admin/admin-ajax.php` instead of the current page when loaded via ajax. @@ -1754,20 +1780,20 @@ No, you do not need to use our plugin’s login or registration pages and can us * Fixes a bug where non-logged in users are not able to access the profile page when `Global Site Access` is set to `Site accessible to Logged In Users`. * Fixes a bug to modify the login redirection url especially when DOING_AJAX is defined. * Fixes a bug to retrieve correct community roles per site in a Multisite Network setup. - + = 1.3.71: September 12, 2016 = -* Enhancements: +* Enhancements: * Adds a new filter hook to modify the `cover photo` uri. * `um_user_cover_photo_uri__filter` * Bugfixes: * Fixes a bug to allow users change their password in account form - * Fixes a bug to allow role validation and assigning of roles to users on registration process + * Fixes a bug to allow role validation and assigning of roles to users on registration process * Fixes a bug to avoid blank admin footer text all around WordPress = 1.3.70: September 09, 2016 = -* Enhancements: +* Enhancements: * Adds a new filter hook to modify the profile `cover photo` uri. * `um_user_cover_photo_uri__filter` * Bugfixes: @@ -1783,10 +1809,10 @@ No, you do not need to use our plugin’s login or registration pages and can us * This improves the performance when loading profiles in directories. It generates profile slug on Profile Update ( front and back-end ), Registration Process and viewing the Users in the back-end. * Adds new filter hook `um_activate_url` to modify the account activation url. * Adds new filter hooks to modify first and last name cases - * `um_user_first_name_case` + * `um_user_first_name_case` * `um_user_last_name_case` * Adds new filter hooks to modify nonces of image and file uploads - * `um_file_upload_nonce` + * `um_file_upload_nonce` * `um_image_upload_nonce` * Improves search member filters and keyword sensitivity * Improves generation of profile slugs @@ -1913,13 +1939,13 @@ No, you do not need to use our plugin’s login or registration pages and can us * Fixed: select fields with accented characters * Fixed: select fields with accented text values * Fixed: select fields in overlay -* Fixed: admin front-end access restriction +* Fixed: admin front-end access restriction * Fixed: pages query = 1.3.54: June 02, 2016 = * Fixed: remove quick edit from Built-in roles row actions * Fixed: remove notices -* Fixed: dropdown/select fields +* Fixed: dropdown/select fields * Fixed: upload file extension's case sensitive issue * Fixed: reset and change password @@ -1954,7 +1980,7 @@ No, you do not need to use our plugin’s login or registration pages and can us * Added: option to force display name to be capitlized * Fixed: remove notices * Fixed: redirect url on login -* Fixed: optimize query and object caching +* Fixed: optimize query and object caching * Fixed: profile photo as required field * Fixed: admin access in front-end login * Fixed: typos in tooltips @@ -2442,7 +2468,7 @@ No, you do not need to use our plugin’s login or registration pages and can us * New: user profiles are cached to speed up load time * New: emoji support added to bio / user descriptions -* Fixed: issues with bio field HTML +* Fixed: issues with bio field HTML * Fixed: WP-admin PHP warning * Fixed: bug with localization of en_US.po file diff --git a/templates/account.php b/templates/account.php index 143dc14d..a6ee074c 100644 --- a/templates/account.php +++ b/templates/account.php @@ -1,11 +1,27 @@ - +
- +
- +
- + \ No newline at end of file +
diff --git a/templates/email/approved_email.php b/templates/email/approved_email.php index 1365f197..d5276526 100644 --- a/templates/email/approved_email.php +++ b/templates/email/approved_email.php @@ -1,37 +1,47 @@ - - - +
{site_name}
- +
- +
Thank you for signing up!Your account is now approved.
- +
- +
Account Information
- +
Your account e-mail: {email}
Your account username: {username}
Set your password: {password_reset_link}
- +
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/changedaccount_email.php b/templates/email/changedaccount_email.php index 03b3907a..80bb1738 100644 --- a/templates/email/changedaccount_email.php +++ b/templates/email/changedaccount_email.php @@ -1,28 +1,40 @@ - +
{site_name}
- +
- +
You recently updated your account.
- +
If you did not make this change and believe your account has been compromised, please contact us ASAP.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/changedpw_email.php b/templates/email/changedpw_email.php index 63c8b305..0f7db9c2 100644 --- a/templates/email/changedpw_email.php +++ b/templates/email/changedpw_email.php @@ -1,28 +1,39 @@ - - +
{site_name}
- +
- +
You recently changed the password associated with your account.
- +
If you did not make this change and believe your account has been compromised, please contact us ASAP.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/checkmail_email.php b/templates/email/checkmail_email.php index 5cf88f99..92cb56fc 100644 --- a/templates/email/checkmail_email.php +++ b/templates/email/checkmail_email.php @@ -1,28 +1,39 @@ - - +
{site_name}
- +
- +
Thank you for signing up!Please click the following link to activate your account.
- +
Need help? contact us today.
- +
- +
- +
Thank you!
The {site_name} Team
- +
diff --git a/templates/email/deletion_email.php b/templates/email/deletion_email.php index 41fa1f04..fe2e7bfe 100644 --- a/templates/email/deletion_email.php +++ b/templates/email/deletion_email.php @@ -1,26 +1,38 @@ - +
{site_name}
- +
- +
Your account has been deleted.All your personal details and any uploads have been permanently removed.
- +
If your account has been deleted by accident please contact us.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/inactive_email.php b/templates/email/inactive_email.php index 65df7c32..14748311 100644 --- a/templates/email/inactive_email.php +++ b/templates/email/inactive_email.php @@ -1,26 +1,37 @@ - - +
{site_name}
- +
- +
Your account is now deactivated.
- +
If you want your account to be re-activated, please contact us.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/notification_deletion.php b/templates/email/notification_deletion.php index 17c4f6d4..6d58d35b 100644 --- a/templates/email/notification_deletion.php +++ b/templates/email/notification_deletion.php @@ -1,25 +1,35 @@ - - - +
{site_name}
- +
- +
{display_name} has just deleted their {site_name} account.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/notification_new_user.php b/templates/email/notification_new_user.php index 0bb89392..59be08f7 100644 --- a/templates/email/notification_new_user.php +++ b/templates/email/notification_new_user.php @@ -1,34 +1,45 @@ - +
{site_name}
- +
- +
{display_name} has just created an account on {site_name}.
To view their profile click here: {user_profile_link}
- +
- +
Here is the submitted registration form:

{submitted_registration}
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/notification_review.php b/templates/email/notification_review.php index 0f53b7f3..cab18131 100644 --- a/templates/email/notification_review.php +++ b/templates/email/notification_review.php @@ -1,34 +1,45 @@ - +
{site_name}
- +
- +
{display_name} has just applied for membership to {site_name} and is waiting to be reviewed.
To review this member please click the following link: {user_profile_link}
- +
- +
Here is the submitted registration form:

{submitted_registration}
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/pending_email.php b/templates/email/pending_email.php index 7dc70554..b8cd6f58 100644 --- a/templates/email/pending_email.php +++ b/templates/email/pending_email.php @@ -1,27 +1,38 @@ - +
{site_name}
- +
- +
Thank you for signing up!Your account has to be manually reviewed.
- +
Please allow us some time to process your request and review your information.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/rejected_email.php b/templates/email/rejected_email.php index 5861d29f..e1343bd2 100644 --- a/templates/email/rejected_email.php +++ b/templates/email/rejected_email.php @@ -1,26 +1,37 @@ - +
{site_name}
- +
- +
Your registration request has been rejected.
- +
Please feel free to apply at a future date or contact us If you want your information to be reviewed again.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/resetpw_email.php b/templates/email/resetpw_email.php index a4d999a9..6f688ddd 100644 --- a/templates/email/resetpw_email.php +++ b/templates/email/resetpw_email.php @@ -1,28 +1,39 @@ - +
{site_name}
- +
- +
We received a request to reset the password for your account. If you made this request, click the link below to change your password:
- +
If you didn't make this request, ignore this email or report it to us.
- -
- -
- -
Thank you!
-
The {site_name} Team
- +
-
\ No newline at end of file +
+ +
Thank you!
+
The {site_name} Team
+ +
+ + diff --git a/templates/email/welcome_email.php b/templates/email/welcome_email.php index 58a57428..b9807834 100644 --- a/templates/email/welcome_email.php +++ b/templates/email/welcome_email.php @@ -1,29 +1,40 @@ - - +
{site_name}
- +
- +
Thank you for signing up!Your account is now active.
- +
If you have any problems, please contact us at {admin_email}
- - + +
- +
Thank you!
The {site_name} Team
- +
-
\ No newline at end of file + diff --git a/templates/gdpr-register.php b/templates/gdpr-register.php index 2b175fe1..786d1a8f 100644 --- a/templates/gdpr-register.php +++ b/templates/gdpr-register.php @@ -1,4 +1,18 @@ - +
@@ -48,4 +62,4 @@
- \ No newline at end of file + diff --git a/templates/login-to-view.php b/templates/login-to-view.php index 432f1b82..aaf5e87b 100644 --- a/templates/login-to-view.php +++ b/templates/login-to-view.php @@ -1,7 +1,21 @@ - +
-
\ No newline at end of file + diff --git a/templates/login.php b/templates/login.php index a72c1620..bc148c77 100644 --- a/templates/login.php +++ b/templates/login.php @@ -1,4 +1,20 @@ - +
@@ -137,4 +153,4 @@
- \ No newline at end of file + diff --git a/templates/logout.php b/templates/logout.php index 6239943f..243aea8e 100644 --- a/templates/logout.php +++ b/templates/logout.php @@ -1,4 +1,20 @@ - +
@@ -11,9 +27,9 @@
- +
- + */ do_action( 'um_logout_after_user_welcome', $args ); ?> - + - +
    - + */ do_action( 'um_logout_user_links', $args ); ?> - +
diff --git a/templates/members-grid.php b/templates/members-grid.php index 125e1564..0b326965 100644 --- a/templates/members-grid.php +++ b/templates/members-grid.php @@ -1,4 +1,27 @@ - diff --git a/templates/members-header.php b/templates/members-header.php index a7b186ea..4e0b1875 100644 --- a/templates/members-header.php +++ b/templates/members-header.php @@ -1,4 +1,16 @@ - + \ No newline at end of file + diff --git a/templates/members-list.php b/templates/members-list.php index 09ab2d75..78f2f6b7 100644 --- a/templates/members-list.php +++ b/templates/members-list.php @@ -1,4 +1,25 @@ - diff --git a/templates/members-pagination.php b/templates/members-pagination.php index b719824c..f1664b5f 100644 --- a/templates/members-pagination.php +++ b/templates/members-pagination.php @@ -1,4 +1,16 @@ - + \ No newline at end of file + diff --git a/templates/members.php b/templates/members.php index 3a215ade..ae295981 100644 --- a/templates/members.php +++ b/templates/members.php @@ -1,4 +1,18 @@ - +} + +$postid = ! empty( $post->ID ) ? $post->ID : ''; +?>
diff --git a/templates/message.php b/templates/message.php index 58572f36..271d89c7 100644 --- a/templates/message.php +++ b/templates/message.php @@ -1,4 +1,19 @@ - +
@@ -8,4 +23,4 @@ printf( __( '%s', 'ultimate-member' ), $this->custom_message ); ?>
-
\ No newline at end of file + diff --git a/templates/modal/um_upload_single.php b/templates/modal/um_upload_single.php index 5fe2bc35..00257bec 100644 --- a/templates/modal/um_upload_single.php +++ b/templates/modal/um_upload_single.php @@ -1,3 +1,13 @@ - + - \ No newline at end of file + diff --git a/templates/modal/um_view_photo.php b/templates/modal/um_view_photo.php index d24dbc23..d926409f 100644 --- a/templates/modal/um_view_photo.php +++ b/templates/modal/um_view_photo.php @@ -1,4 +1,14 @@ - + - \ No newline at end of file + diff --git a/templates/password-change.php b/templates/password-change.php index 414cb6e0..d3e178ac 100644 --- a/templates/password-change.php +++ b/templates/password-change.php @@ -1,4 +1,21 @@ - +
diff --git a/templates/password-reset.php b/templates/password-reset.php index 9b706317..57bf1686 100644 --- a/templates/password-reset.php +++ b/templates/password-reset.php @@ -1,4 +1,18 @@ - diff --git a/templates/profile.php b/templates/profile.php index 7ca2fb9e..32fe460f 100644 --- a/templates/profile.php +++ b/templates/profile.php @@ -1,4 +1,20 @@ - +
diff --git a/templates/profile/comments-single.php b/templates/profile/comments-single.php index a2b0a395..f3c5818b 100644 --- a/templates/profile/comments-single.php +++ b/templates/profile/comments-single.php @@ -1,4 +1,18 @@ -comment_post_ID ), $comment ); $link = apply_filters( 'um_user_profile_comment_url', get_permalink( $comment->comment_post_ID ), $comment ); ?> @@ -13,4 +27,4 @@ $link = apply_filters( 'um_user_profile_comment_url', get_permalink( $comment->c
%2$s','ultimate-member' ), $link, $comment_title ); ?>
-
\ No newline at end of file +
diff --git a/templates/profile/comments.php b/templates/profile/comments.php index 4b8b3aaa..7535a0ad 100644 --- a/templates/profile/comments.php +++ b/templates/profile/comments.php @@ -1,4 +1,20 @@ - +
-
\ No newline at end of file + diff --git a/templates/restricted-blog.php b/templates/restricted-blog.php index 5f682323..8fe0168f 100644 --- a/templates/restricted-blog.php +++ b/templates/restricted-blog.php @@ -1,4 +1,13 @@ @@ -51,4 +63,4 @@ get_header(); ?> - +
@@ -9,4 +25,4 @@
- \ No newline at end of file + diff --git a/ultimate-member.php b/ultimate-member.php index 28d9b9c7..3cdb44cb 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress -Version: 2.6.0 +Version: 2.6.1 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member