WordPress Download Manager - Version 3.1.11

Version Description

  • Improved asset manager
  • Fixed the issue with displaying download count
  • Fixed the date format issue with download history
Download this release

Release Info

Developer codename065
Plugin Icon 128x128 WordPress Download Manager
Version 3.1.11
Comparing to
See all releases

Code changes from version 3.1.08 to 3.1.11

admin/class.WordPressDownloadManagerAdmin.php CHANGED
@@ -46,7 +46,7 @@ class WordPressDownloadManagerAdmin
46
  function enqueueScripts($hook){
47
 
48
 
49
- if(get_post_type()=='wpdmpro' || wpdm_query_var('post_type') == 'wpdmpro' || $hook == 'index.php'){
50
  wp_enqueue_script('jquery');
51
  wp_enqueue_script('jquery-form');
52
  wp_enqueue_script('jquery-ui-core');
46
  function enqueueScripts($hook){
47
 
48
 
49
+ if(get_post_type()=='wpdmpro' || wpdm_query_var('post_type') == 'wpdmpro' || in_array($hook, ['index.php', 'profile.php', 'user-edit.php'])){
50
  wp_enqueue_script('jquery');
51
  wp_enqueue_script('jquery-form');
52
  wp_enqueue_script('jquery-ui-core');
admin/menus/class.Settings.php CHANGED
@@ -304,7 +304,7 @@ class Settings
304
  if(get_option('__wpdm_suname') != '') {
305
  $purchased_items = get_option('__wpdm_purchased_items', false);
306
  if(!$purchased_items || wpdm_query_var('newpurchase') != '' ) {
307
- $purchased_items = remote_get('https://www.wpdownloadmanager.com/?wpdmppaction=getpurchaseditems&wpdm_access_token=' . wpdm_access_token());
308
  update_option('__wpdm_purchased_items', $purchased_items);
309
  }
310
  $purchased_items = json_decode($purchased_items);
304
  if(get_option('__wpdm_suname') != '') {
305
  $purchased_items = get_option('__wpdm_purchased_items', false);
306
  if(!$purchased_items || wpdm_query_var('newpurchase') != '' ) {
307
+ $purchased_items = wpdm_remote_get('https://www.wpdownloadmanager.com/?wpdmppaction=getpurchaseditems&wpdm_access_token=' . wpdm_access_token());
308
  update_option('__wpdm_purchased_items', $purchased_items);
309
  }
310
  $purchased_items = json_decode($purchased_items);
admin/tpls/stats/history.php CHANGED
@@ -22,7 +22,7 @@
22
  ?>
23
  <tr>
24
  <td><a href="<?php echo get_permalink($stat->pid); ?>"><?php echo $stat->post_title; ?></a> | <a href="edit.php?post_type=wpdmpro&page=wpdm-stats&pid=<?php echo $stat->pid; ?>"><i class="far fa-chart-bar"></i></a></td>
25
- <td><?php echo date(get_option('date_format')." h:i a",($stat->timestamp + (get_option('gmt_offset') * 3600))); ?></td>
26
  <td><?php echo $stat->uid > 0?"<a href='edit.php?post_type=wpdmpro&page=wpdm-stats&uid={$stat->uid}'>".get_user_by('id', $stat->uid)->display_name . "</a> ".((get_option('__wpdm_noip') == 0)?' / ':''):''; ?><?php if(get_option('__wpdm_noip') == 0) { ?> <a href='edit.php?post_type=wpdmpro&page=wpdm-stats&ip=<?php echo $stat->ip; ?>'><?php echo $stat->ip; ?></a><?php } ?></td>
27
  </tr>
28
  <?php
22
  ?>
23
  <tr>
24
  <td><a href="<?php echo get_permalink($stat->pid); ?>"><?php echo $stat->post_title; ?></a> | <a href="edit.php?post_type=wpdmpro&page=wpdm-stats&pid=<?php echo $stat->pid; ?>"><i class="far fa-chart-bar"></i></a></td>
25
+ <td><?php echo date(get_option('date_format')." ".get_option('time_format'),($stat->timestamp + (get_option('gmt_offset') * 3600))); ?></td>
26
  <td><?php echo $stat->uid > 0?"<a href='edit.php?post_type=wpdmpro&page=wpdm-stats&uid={$stat->uid}'>".get_user_by('id', $stat->uid)->display_name . "</a> ".((get_option('__wpdm_noip') == 0)?' / ':''):''; ?><?php if(get_option('__wpdm_noip') == 0) { ?> <a href='edit.php?post_type=wpdmpro&page=wpdm-stats&ip=<?php echo $stat->ip; ?>'><?php echo $stat->ip; ?></a><?php } ?></td>
27
  </tr>
28
  <?php
assets/bootstrap/js/bootstrap.bundle.min.js CHANGED
@@ -4,4 +4,3 @@
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
  */
6
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],t):t((e=e||self).bootstrap={},e.jQuery)}(this,function(e,p){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function l(o){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?t(Object(r),!0).forEach(function(e){var t,n,i;t=o,i=r[n=e],n in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))})}return o}p=p&&p.hasOwnProperty("default")?p.default:p;var n="transitionend";function o(e){var t=this,n=!1;return p(this).one(m.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||m.triggerTransitionEnd(t)},e),this}var m={TRANSITION_END:"bsTransitionEnd",getUID:function(e){for(;e+=~~(1e6*Math.random()),document.getElementById(e););return e},getSelectorFromElement:function(e){var t=e.getAttribute("data-target");if(!t||"#"===t){var n=e.getAttribute("href");t=n&&"#"!==n?n.trim():""}try{return document.querySelector(t)?t:null}catch(e){return null}},getTransitionDurationFromElement:function(e){if(!e)return 0;var t=p(e).css("transition-duration"),n=p(e).css("transition-delay"),i=parseFloat(t),o=parseFloat(n);return i||o?(t=t.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(t)+parseFloat(n))):0},reflow:function(e){return e.offsetHeight},triggerTransitionEnd:function(e){p(e).trigger(n)},supportsTransitionEnd:function(){return Boolean(n)},isElement:function(e){return(e[0]||e).nodeType},typeCheckConfig:function(e,t,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=t[i],s=r&&m.isElement(r)?"element":(a=r,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(e.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+o+'".')}var a},findShadowRoot:function(e){if(!document.documentElement.attachShadow)return null;if("function"!=typeof e.getRootNode)return e instanceof ShadowRoot?e:e.parentNode?m.findShadowRoot(e.parentNode):null;var t=e.getRootNode();return t instanceof ShadowRoot?t:null},jQueryDetection:function(){if("undefined"==typeof p)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var e=p.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1===e[0]&&9===e[1]&&e[2]<1||4<=e[0])throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};m.jQueryDetection(),p.fn.emulateTransitionEnd=o,p.event.special[m.TRANSITION_END]={bindType:n,delegateType:n,handle:function(e){if(p(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}};var r="alert",a="bs.alert",c="."+a,h=p.fn[r],u={CLOSE:"close"+c,CLOSED:"closed"+c,CLICK_DATA_API:"click"+c+".data-api"},f="alert",d="fade",g="show",_=function(){function i(e){this._element=e}var e=i.prototype;return e.close=function(e){var t=this._element;e&&(t=this._getRootElement(e)),this._triggerCloseEvent(t).isDefaultPrevented()||this._removeElement(t)},e.dispose=function(){p.removeData(this._element,a),this._element=null},e._getRootElement=function(e){var t=m.getSelectorFromElement(e),n=!1;return t&&(n=document.querySelector(t)),n=n||p(e).closest("."+f)[0]},e._triggerCloseEvent=function(e){var t=p.Event(u.CLOSE);return p(e).trigger(t),t},e._removeElement=function(t){var n=this;if(p(t).removeClass(g),p(t).hasClass(d)){var e=m.getTransitionDurationFromElement(t);p(t).one(m.TRANSITION_END,function(e){return n._destroyElement(t,e)}).emulateTransitionEnd(e)}else this._destroyElement(t)},e._destroyElement=function(e){p(e).detach().trigger(u.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var e=p(this),t=e.data(a);t||(t=new i(this),e.data(a,t)),"close"===n&&t[n](this)})},i._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}}]),i}();p(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',_._handleDismiss(new _)),p.fn[r]=_._jQueryInterface,p.fn[r].Constructor=_,p.fn[r].noConflict=function(){return p.fn[r]=h,_._jQueryInterface};var v="button",y="bs.button",E="."+y,b=".data-api",w=p.fn[v],T="active",C="btn",S="focus",D='[data-toggle^="button"]',I='[data-toggle="buttons"]',A='[data-toggle="button"]',O='[data-toggle="buttons"] .btn',N='input:not([type="hidden"])',k=".active",L=".btn",P={CLICK_DATA_API:"click"+E+b,FOCUS_BLUR_DATA_API:"focus"+E+b+" blur"+E+b,LOAD_DATA_API:"load"+E+b},x=function(){function n(e){this._element=e}var e=n.prototype;return e.toggle=function(){var e=!0,t=!0,n=p(this._element).closest(I)[0];if(n){var i=this._element.querySelector(N);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(T))e=!1;else{var o=n.querySelector(k);o&&p(o).removeClass(T)}else"checkbox"===i.type?"LABEL"===this._element.tagName&&i.checked===this._element.classList.contains(T)&&(e=!1):e=!1;e&&(i.checked=!this._element.classList.contains(T),p(i).trigger("change")),i.focus(),t=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(t&&this._element.setAttribute("aria-pressed",!this._element.classList.contains(T)),e&&p(this._element).toggleClass(T))},e.dispose=function(){p.removeData(this._element,y),this._element=null},n._jQueryInterface=function(t){return this.each(function(){var e=p(this).data(y);e||(e=new n(this),p(this).data(y,e)),"toggle"===t&&e[t]()})},s(n,null,[{key:"VERSION",get:function(){return"4.4.1"}}]),n}();p(document).on(P.CLICK_DATA_API,D,function(e){var t=e.target;if(p(t).hasClass(C)||(t=p(t).closest(L)[0]),!t||t.hasAttribute("disabled")||t.classList.contains("disabled"))e.preventDefault();else{var n=t.querySelector(N);if(n&&(n.hasAttribute("disabled")||n.classList.contains("disabled")))return void e.preventDefault();x._jQueryInterface.call(p(t),"toggle")}}).on(P.FOCUS_BLUR_DATA_API,D,function(e){var t=p(e.target).closest(L)[0];p(t).toggleClass(S,/^focus(in)?$/.test(e.type))}),p(window).on(P.LOAD_DATA_API,function(){for(var e=[].slice.call(document.querySelectorAll(O)),t=0,n=e.length;t<n;t++){var i=e[t],o=i.querySelector(N);o.checked||o.hasAttribute("checked")?i.classList.add(T):i.classList.remove(T)}for(var r=0,s=(e=[].slice.call(document.querySelectorAll(A))).length;r<s;r++){var a=e[r];"true"===a.getAttribute("aria-pressed")?a.classList.add(T):a.classList.remove(T)}}),p.fn[v]=x._jQueryInterface,p.fn[v].Constructor=x,p.fn[v].noConflict=function(){return p.fn[v]=w,x._jQueryInterface};var j="carousel",H="bs.carousel",R="."+H,F=".data-api",M=p.fn[j],W={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},U={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},B="next",q="prev",K="left",Q="right",V={SLIDE:"slide"+R,SLID:"slid"+R,KEYDOWN:"keydown"+R,MOUSEENTER:"mouseenter"+R,MOUSELEAVE:"mouseleave"+R,TOUCHSTART:"touchstart"+R,TOUCHMOVE:"touchmove"+R,TOUCHEND:"touchend"+R,POINTERDOWN:"pointerdown"+R,POINTERUP:"pointerup"+R,DRAG_START:"dragstart"+R,LOAD_DATA_API:"load"+R+F,CLICK_DATA_API:"click"+R+F},Y="carousel",z="active",X="slide",G="carousel-item-right",$="carousel-item-left",J="carousel-item-next",Z="carousel-item-prev",ee="pointer-event",te=".active",ne=".active.carousel-item",ie=".carousel-item",oe=".carousel-item img",re=".carousel-item-next, .carousel-item-prev",se=".carousel-indicators",ae="[data-slide], [data-slide-to]",le='[data-ride="carousel"]',ce={TOUCH:"touch",PEN:"pen"},he=function(){function r(e,t){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(t),this._element=e,this._indicatorsElement=this._element.querySelector(se),this._touchSupported="ontouchstart"in document.documentElement||0<navigator.maxTouchPoints,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var e=r.prototype;return e.next=function(){this._isSliding||this._slide(B)},e.nextWhenVisible=function(){!document.hidden&&p(this._element).is(":visible")&&"hidden"!==p(this._element).css("visibility")&&this.next()},e.prev=function(){this._isSliding||this._slide(q)},e.pause=function(e){e||(this._isPaused=!0),this._element.querySelector(re)&&(m.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},e.cycle=function(e){e||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},e.to=function(e){var t=this;this._activeElement=this._element.querySelector(ne);var n=this._getItemIndex(this._activeElement);if(!(e>this._items.length-1||e<0))if(this._isSliding)p(this._element).one(V.SLID,function(){return t.to(e)});else{if(n===e)return this.pause(),void this.cycle();var i=n<e?B:q;this._slide(i,this._items[e])}},e.dispose=function(){p(this._element).off(R),p.removeData(this._element,H),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},e._getConfig=function(e){return e=l({},W,{},e),m.typeCheckConfig(j,e,U),e},e._handleSwipe=function(){var e=Math.abs(this.touchDeltaX);if(!(e<=40)){var t=e/this.touchDeltaX;(this.touchDeltaX=0)<t&&this.prev(),t<0&&this.next()}},e._addEventListeners=function(){var t=this;this._config.keyboard&&p(this._element).on(V.KEYDOWN,function(e){return t._keydown(e)}),"hover"===this._config.pause&&p(this._element).on(V.MOUSEENTER,function(e){return t.pause(e)}).on(V.MOUSELEAVE,function(e){return t.cycle(e)}),this._config.touch&&this._addTouchEventListeners()},e._addTouchEventListeners=function(){var t=this;if(this._touchSupported){var n=function(e){t._pointerEvent&&ce[e.originalEvent.pointerType.toUpperCase()]?t.touchStartX=e.originalEvent.clientX:t._pointerEvent||(t.touchStartX=e.originalEvent.touches[0].clientX)},i=function(e){t._pointerEvent&&ce[e.originalEvent.pointerType.toUpperCase()]&&(t.touchDeltaX=e.originalEvent.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout(function(e){return t.cycle(e)},500+t._config.interval))};p(this._element.querySelectorAll(oe)).on(V.DRAG_START,function(e){return e.preventDefault()}),this._pointerEvent?(p(this._element).on(V.POINTERDOWN,function(e){return n(e)}),p(this._element).on(V.POINTERUP,function(e){return i(e)}),this._element.classList.add(ee)):(p(this._element).on(V.TOUCHSTART,function(e){return n(e)}),p(this._element).on(V.TOUCHMOVE,function(e){return function(e){e.originalEvent.touches&&1<e.originalEvent.touches.length?t.touchDeltaX=0:t.touchDeltaX=e.originalEvent.touches[0].clientX-t.touchStartX}(e)}),p(this._element).on(V.TOUCHEND,function(e){return i(e)}))}},e._keydown=function(e){if(!/input|textarea/i.test(e.target.tagName))switch(e.which){case 37:e.preventDefault(),this.prev();break;case 39:e.preventDefault(),this.next()}},e._getItemIndex=function(e){return this._items=e&&e.parentNode?[].slice.call(e.parentNode.querySelectorAll(ie)):[],this._items.indexOf(e)},e._getItemByDirection=function(e,t){var n=e===B,i=e===q,o=this._getItemIndex(t),r=this._items.length-1;if((i&&0===o||n&&o===r)&&!this._config.wrap)return t;var s=(o+(e===q?-1:1))%this._items.length;return-1==s?this._items[this._items.length-1]:this._items[s]},e._triggerSlideEvent=function(e,t){var n=this._getItemIndex(e),i=this._getItemIndex(this._element.querySelector(ne)),o=p.Event(V.SLIDE,{relatedTarget:e,direction:t,from:i,to:n});return p(this._element).trigger(o),o},e._setActiveIndicatorElement=function(e){if(this._indicatorsElement){var t=[].slice.call(this._indicatorsElement.querySelectorAll(te));p(t).removeClass(z);var n=this._indicatorsElement.children[this._getItemIndex(e)];n&&p(n).addClass(z)}},e._slide=function(e,t){var n,i,o,r=this,s=this._element.querySelector(ne),a=this._getItemIndex(s),l=t||s&&this._getItemByDirection(e,s),c=this._getItemIndex(l),h=Boolean(this._interval);if(o=e===B?(n=$,i=J,K):(n=G,i=Z,Q),l&&p(l).hasClass(z))this._isSliding=!1;else if(!this._triggerSlideEvent(l,o).isDefaultPrevented()&&s&&l){this._isSliding=!0,h&&this.pause(),this._setActiveIndicatorElement(l);var u=p.Event(V.SLID,{relatedTarget:l,direction:o,from:a,to:c});if(p(this._element).hasClass(X)){p(l).addClass(i),m.reflow(l),p(s).addClass(n),p(l).addClass(n);var f=parseInt(l.getAttribute("data-interval"),10);f?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=f):this._config.interval=this._config.defaultInterval||this._config.interval;var d=m.getTransitionDurationFromElement(s);p(s).one(m.TRANSITION_END,function(){p(l).removeClass(n+" "+i).addClass(z),p(s).removeClass(z+" "+i+" "+n),r._isSliding=!1,setTimeout(function(){return p(r._element).trigger(u)},0)}).emulateTransitionEnd(d)}else p(s).removeClass(z),p(l).addClass(z),this._isSliding=!1,p(this._element).trigger(u);h&&this.cycle()}},r._jQueryInterface=function(i){return this.each(function(){var e=p(this).data(H),t=l({},W,{},p(this).data());"object"==typeof i&&(t=l({},t,{},i));var n="string"==typeof i?i:t.slide;if(e||(e=new r(this,t),p(this).data(H,e)),"number"==typeof i)e.to(i);else if("string"==typeof n){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}else t.interval&&t.ride&&(e.pause(),e.cycle())})},r._dataApiClickHandler=function(e){var t=m.getSelectorFromElement(this);if(t){var n=p(t)[0];if(n&&p(n).hasClass(Y)){var i=l({},p(n).data(),{},p(this).data()),o=this.getAttribute("data-slide-to");o&&(i.interval=!1),r._jQueryInterface.call(p(n),i),o&&p(n).data(H).to(o),e.preventDefault()}}},s(r,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return W}}]),r}();p(document).on(V.CLICK_DATA_API,ae,he._dataApiClickHandler),p(window).on(V.LOAD_DATA_API,function(){for(var e=[].slice.call(document.querySelectorAll(le)),t=0,n=e.length;t<n;t++){var i=p(e[t]);he._jQueryInterface.call(i,i.data())}}),p.fn[j]=he._jQueryInterface,p.fn[j].Constructor=he,p.fn[j].noConflict=function(){return p.fn[j]=M,he._jQueryInterface};var ue="collapse",fe="bs.collapse",de="."+fe,pe=p.fn[ue],me={toggle:!0,parent:""},ge={toggle:"boolean",parent:"(string|element)"},_e={SHOW:"show"+de,SHOWN:"shown"+de,HIDE:"hide"+de,HIDDEN:"hidden"+de,CLICK_DATA_API:"click"+de+".data-api"},ve="show",ye="collapse",Ee="collapsing",be="collapsed",we="width",Te="height",Ce=".show, .collapsing",Se='[data-toggle="collapse"]',De=function(){function a(t,e){this._isTransitioning=!1,this._element=t,this._config=this._getConfig(e),this._triggerArray=[].slice.call(document.querySelectorAll('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'));for(var n=[].slice.call(document.querySelectorAll(Se)),i=0,o=n.length;i<o;i++){var r=n[i],s=m.getSelectorFromElement(r),a=[].slice.call(document.querySelectorAll(s)).filter(function(e){return e===t});null!==s&&0<a.length&&(this._selector=s,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var e=a.prototype;return e.toggle=function(){p(this._element).hasClass(ve)?this.hide():this.show()},e.show=function(){var e,t,n=this;if(!this._isTransitioning&&!p(this._element).hasClass(ve)&&(this._parent&&0===(e=[].slice.call(this._parent.querySelectorAll(Ce)).filter(function(e){return"string"==typeof n._config.parent?e.getAttribute("data-parent")===n._config.parent:e.classList.contains(ye)})).length&&(e=null),!(e&&(t=p(e).not(this._selector).data(fe))&&t._isTransitioning))){var i=p.Event(_e.SHOW);if(p(this._element).trigger(i),!i.isDefaultPrevented()){e&&(a._jQueryInterface.call(p(e).not(this._selector),"hide"),t||p(e).data(fe,null));var o=this._getDimension();p(this._element).removeClass(ye).addClass(Ee),this._element.style[o]=0,this._triggerArray.length&&p(this._triggerArray).removeClass(be).attr("aria-expanded",!0),this.setTransitioning(!0);var r="scroll"+(o[0].toUpperCase()+o.slice(1)),s=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(){p(n._element).removeClass(Ee).addClass(ye).addClass(ve),n._element.style[o]="",n.setTransitioning(!1),p(n._element).trigger(_e.SHOWN)}).emulateTransitionEnd(s),this._element.style[o]=this._element[r]+"px"}}},e.hide=function(){var e=this;if(!this._isTransitioning&&p(this._element).hasClass(ve)){var t=p.Event(_e.HIDE);if(p(this._element).trigger(t),!t.isDefaultPrevented()){var n=this._getDimension();this._element.style[n]=this._element.getBoundingClientRect()[n]+"px",m.reflow(this._element),p(this._element).addClass(Ee).removeClass(ye).removeClass(ve);var i=this._triggerArray.length;if(0<i)for(var o=0;o<i;o++){var r=this._triggerArray[o],s=m.getSelectorFromElement(r);if(null!==s)p([].slice.call(document.querySelectorAll(s))).hasClass(ve)||p(r).addClass(be).attr("aria-expanded",!1)}this.setTransitioning(!0);this._element.style[n]="";var a=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(){e.setTransitioning(!1),p(e._element).removeClass(Ee).addClass(ye).trigger(_e.HIDDEN)}).emulateTransitionEnd(a)}}},e.setTransitioning=function(e){this._isTransitioning=e},e.dispose=function(){p.removeData(this._element,fe),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},e._getConfig=function(e){return(e=l({},me,{},e)).toggle=Boolean(e.toggle),m.typeCheckConfig(ue,e,ge),e},e._getDimension=function(){return p(this._element).hasClass(we)?we:Te},e._getParent=function(){var e,n=this;m.isElement(this._config.parent)?(e=this._config.parent,"undefined"!=typeof this._config.parent.jquery&&(e=this._config.parent[0])):e=document.querySelector(this._config.parent);var t='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]',i=[].slice.call(e.querySelectorAll(t));return p(i).each(function(e,t){n._addAriaAndCollapsedClass(a._getTargetFromElement(t),[t])}),e},e._addAriaAndCollapsedClass=function(e,t){var n=p(e).hasClass(ve);t.length&&p(t).toggleClass(be,!n).attr("aria-expanded",n)},a._getTargetFromElement=function(e){var t=m.getSelectorFromElement(e);return t?document.querySelector(t):null},a._jQueryInterface=function(i){return this.each(function(){var e=p(this),t=e.data(fe),n=l({},me,{},e.data(),{},"object"==typeof i&&i?i:{});if(!t&&n.toggle&&/show|hide/.test(i)&&(n.toggle=!1),t||(t=new a(this,n),e.data(fe,t)),"string"==typeof i){if("undefined"==typeof t[i])throw new TypeError('No method named "'+i+'"');t[i]()}})},s(a,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return me}}]),a}();p(document).on(_e.CLICK_DATA_API,Se,function(e){"A"===e.currentTarget.tagName&&e.preventDefault();var n=p(this),t=m.getSelectorFromElement(this),i=[].slice.call(document.querySelectorAll(t));p(i).each(function(){var e=p(this),t=e.data(fe)?"toggle":n.data();De._jQueryInterface.call(e,t)})}),p.fn[ue]=De._jQueryInterface,p.fn[ue].Constructor=De,p.fn[ue].noConflict=function(){return p.fn[ue]=pe,De._jQueryInterface};var Ie="undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator,Ae=function(){for(var e=["Edge","Trident","Firefox"],t=0;t<e.length;t+=1)if(Ie&&0<=navigator.userAgent.indexOf(e[t]))return 1;return 0}();var Oe=Ie&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Ae))}};function Ne(e){return e&&"[object Function]"==={}.toString.call(e)}function ke(e,t){if(1!==e.nodeType)return[];var n=e.ownerDocument.defaultView.getComputedStyle(e,null);return t?n[t]:n}function Le(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function Pe(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=ke(e),n=t.overflow,i=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+i)?e:Pe(Le(e))}function xe(e){return e&&e.referenceNode?e.referenceNode:e}var je=Ie&&!(!window.MSInputMethodContext||!document.documentMode),He=Ie&&/MSIE 10/.test(navigator.userAgent);function Re(e){return 11===e?je:10===e?He:je||He}function Fe(e){if(!e)return document.documentElement;for(var t=Re(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===ke(n,"position")?Fe(n):n:e?e.ownerDocument.documentElement:document.documentElement}function Me(e){return null!==e.parentNode?Me(e.parentNode):e}function We(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?e:t,o=n?t:e,r=document.createRange();r.setStart(i,0),r.setEnd(o,0);var s=r.commonAncestorContainer;if(e!==s&&t!==s||i.contains(o))return function(e){var t=e.nodeName;return"BODY"!==t&&("HTML"===t||Fe(e.firstElementChild)===e)}(s)?s:Fe(s);var a=Me(e);return a.host?We(a.host,t):We(e,Me(t).host)}function Ue(e,t){var n="top"===(1<arguments.length&&void 0!==t?t:"top")?"scrollTop":"scrollLeft",i=e.nodeName;if("BODY"!==i&&"HTML"!==i)return e[n];var o=e.ownerDocument.documentElement;return(e.ownerDocument.scrollingElement||o)[n]}function Be(e,t){var n="x"===t?"Left":"Top",i="Left"==n?"Right":"Bottom";return parseFloat(e["border"+n+"Width"],10)+parseFloat(e["border"+i+"Width"],10)}function qe(e,t,n,i){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],Re(10)?parseInt(n["offset"+e])+parseInt(i["margin"+("Height"===e?"Top":"Left")])+parseInt(i["margin"+("Height"===e?"Bottom":"Right")]):0)}function Ke(e){var t=e.body,n=e.documentElement,i=Re(10)&&getComputedStyle(n);return{height:qe("Height",t,n,i),width:qe("Width",t,n,i)}}var Qe=function(e,t,n){return t&&Ve(e.prototype,t),n&&Ve(e,n),e};function Ve(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ze=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};function Xe(e){return ze({},e,{right:e.left+e.width,bottom:e.top+e.height})}function Ge(e){var t={};try{if(Re(10)){t=e.getBoundingClientRect();var n=Ue(e,"top"),i=Ue(e,"left");t.top+=n,t.left+=i,t.bottom+=n,t.right+=i}else t=e.getBoundingClientRect()}catch(e){}var o={left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top},r="HTML"===e.nodeName?Ke(e.ownerDocument):{},s=r.width||e.clientWidth||o.width,a=r.height||e.clientHeight||o.height,l=e.offsetWidth-s,c=e.offsetHeight-a;if(l||c){var h=ke(e);l-=Be(h,"x"),c-=Be(h,"y"),o.width-=l,o.height-=c}return Xe(o)}function $e(e,t,n){var i=2<arguments.length&&void 0!==n&&n,o=Re(10),r="HTML"===t.nodeName,s=Ge(e),a=Ge(t),l=Pe(e),c=ke(t),h=parseFloat(c.borderTopWidth,10),u=parseFloat(c.borderLeftWidth,10);i&&r&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var f=Xe({top:s.top-a.top-h,left:s.left-a.left-u,width:s.width,height:s.height});if(f.marginTop=0,f.marginLeft=0,!o&&r){var d=parseFloat(c.marginTop,10),p=parseFloat(c.marginLeft,10);f.top-=h-d,f.bottom-=h-d,f.left-=u-p,f.right-=u-p,f.marginTop=d,f.marginLeft=p}return(o&&!i?t.contains(l):t===l&&"BODY"!==l.nodeName)&&(f=function(e,t,n){var i=2<arguments.length&&void 0!==n&&n,o=Ue(t,"top"),r=Ue(t,"left"),s=i?-1:1;return e.top+=o*s,e.bottom+=o*s,e.left+=r*s,e.right+=r*s,e}(f,t)),f}function Je(e){if(!e||!e.parentElement||Re())return document.documentElement;for(var t=e.parentElement;t&&"none"===ke(t,"transform");)t=t.parentElement;return t||document.documentElement}function Ze(e,t,n,i,o){var r=4<arguments.length&&void 0!==o&&o,s={top:0,left:0},a=r?Je(e):We(e,xe(t));if("viewport"===i)s=function(e,t){var n=1<arguments.length&&void 0!==t&&t,i=e.ownerDocument.documentElement,o=$e(e,i),r=Math.max(i.clientWidth,window.innerWidth||0),s=Math.max(i.clientHeight,window.innerHeight||0),a=n?0:Ue(i),l=n?0:Ue(i,"left");return Xe({top:a-o.top+o.marginTop,left:l-o.left+o.marginLeft,width:r,height:s})}(a,r);else{var l=void 0;"scrollParent"===i?"BODY"===(l=Pe(Le(t))).nodeName&&(l=e.ownerDocument.documentElement):l="window"===i?e.ownerDocument.documentElement:i;var c=$e(l,a,r);if("HTML"!==l.nodeName||function e(t){var n=t.nodeName;if("BODY"===n||"HTML"===n)return!1;if("fixed"===ke(t,"position"))return!0;var i=Le(t);return!!i&&e(i)}(a))s=c;else{var h=Ke(e.ownerDocument),u=h.height,f=h.width;s.top+=c.top-c.marginTop,s.bottom=u+c.top,s.left+=c.left-c.marginLeft,s.right=f+c.left}}var d="number"==typeof(n=n||0);return s.left+=d?n:n.left||0,s.top+=d?n:n.top||0,s.right-=d?n:n.right||0,s.bottom-=d?n:n.bottom||0,s}function et(e,t,i,n,o,r){var s=5<arguments.length&&void 0!==r?r:0;if(-1===e.indexOf("auto"))return e;var a=Ze(i,n,s,o),l={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},c=Object.keys(l).map(function(e){return ze({key:e},l[e],{area:function(e){return e.width*e.height}(l[e])})}).sort(function(e,t){return t.area-e.area}),h=c.filter(function(e){var t=e.width,n=e.height;return t>=i.clientWidth&&n>=i.clientHeight}),u=0<h.length?h[0].key:c[0].key,f=e.split("-")[1];return u+(f?"-"+f:"")}function tt(e,t,n,i){var o=3<arguments.length&&void 0!==i?i:null;return $e(n,o?Je(t):We(t,xe(n)),o)}function nt(e){var t=e.ownerDocument.defaultView.getComputedStyle(e),n=parseFloat(t.marginTop||0)+parseFloat(t.marginBottom||0),i=parseFloat(t.marginLeft||0)+parseFloat(t.marginRight||0);return{width:e.offsetWidth+i,height:e.offsetHeight+n}}function it(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function ot(e,t,n){n=n.split("-")[0];var i=nt(e),o={width:i.width,height:i.height},r=-1!==["right","left"].indexOf(n),s=r?"top":"left",a=r?"left":"top",l=r?"height":"width",c=r?"width":"height";return o[s]=t[s]+t[l]/2-i[l]/2,o[a]=n===a?t[a]-i[c]:t[it(a)],o}function rt(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function st(e,n,t){return(void 0===t?e:e.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===n});var i=rt(e,function(e){return e[t]===n});return e.indexOf(i)}(e,"name",t))).forEach(function(e){e.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var t=e.function||e.fn;e.enabled&&Ne(t)&&(n.offsets.popper=Xe(n.offsets.popper),n.offsets.reference=Xe(n.offsets.reference),n=t(n,e))}),n}function at(e,n){return e.some(function(e){var t=e.name;return e.enabled&&t===n})}function lt(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),i=0;i<t.length;i++){var o=t[i],r=o?""+o+n:e;if("undefined"!=typeof document.body.style[r])return r}return null}function ct(e){var t=e.ownerDocument;return t?t.defaultView:window}function ht(e,t,n,i){n.updateBound=i,ct(e).addEventListener("resize",n.updateBound,{passive:!0});var o=Pe(e);return function e(t,n,i,o){var r="BODY"===t.nodeName,s=r?t.ownerDocument.defaultView:t;s.addEventListener(n,i,{passive:!0}),r||e(Pe(s.parentNode),n,i,o),o.push(s)}(o,"scroll",n.updateBound,n.scrollParents),n.scrollElement=o,n.eventsEnabled=!0,n}function ut(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=function(e,t){return ct(e).removeEventListener("resize",t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener("scroll",t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}(this.reference,this.state))}function ft(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function dt(n,i){Object.keys(i).forEach(function(e){var t="";-1!==["width","height","top","right","bottom","left"].indexOf(e)&&ft(i[e])&&(t="px"),n.style[e]=i[e]+t})}function pt(e,t){function n(e){return e}var i=e.offsets,o=i.popper,r=i.reference,s=Math.round,a=Math.floor,l=s(r.width),c=s(o.width),h=-1!==["left","right"].indexOf(e.placement),u=-1!==e.placement.indexOf("-"),f=t?h||u||l%2==c%2?s:a:n,d=t?s:n;return{left:f(l%2==1&&c%2==1&&!u&&t?o.left-1:o.left),top:d(o.top),bottom:d(o.bottom),right:f(o.right)}}var mt=Ie&&/Firefox/i.test(navigator.userAgent);function gt(e,t,n){var i=rt(e,function(e){return e.name===t}),o=!!i&&e.some(function(e){return e.name===n&&e.enabled&&e.order<i.order});if(!o){var r="`"+t+"`",s="`"+n+"`";console.warn(s+" modifier is required by "+r+" modifier in order to work, be sure to include it before "+r+"!")}return o}var _t=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],vt=_t.slice(3);function yt(e,t){var n=1<arguments.length&&void 0!==t&&t,i=vt.indexOf(e),o=vt.slice(i+1).concat(vt.slice(0,i));return n?o.reverse():o}var Et="flip",bt="clockwise",wt="counterclockwise";function Tt(e,o,r,t){var s=[0,0],a=-1!==["right","left"].indexOf(t),n=e.split(/(\+|\-)/).map(function(e){return e.trim()}),i=n.indexOf(rt(n,function(e){return-1!==e.search(/,|\s/)}));n[i]&&-1===n[i].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,c=-1!==i?[n.slice(0,i).concat([n[i].split(l)[0]]),[n[i].split(l)[1]].concat(n.slice(i+1))]:[n];return(c=c.map(function(e,t){var n=(1===t?!a:a)?"height":"width",i=!1;return e.reduce(function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,i=!0,e):i?(e[e.length-1]+=t,i=!1,e):e.concat(t)},[]).map(function(e){return function(e,t,n,i){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+o[1],s=o[2];if(!r)return e;if(0!==s.indexOf("%"))return"vh"!==s&&"vw"!==s?r:("vh"===s?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*r;var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=i}return Xe(a)[t]/100*r}(e,n,o,r)})})).forEach(function(n,i){n.forEach(function(e,t){ft(e)&&(s[i]+=e*("-"===n[t-1]?-1:1))})}),s}var Ct={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,n=t.split("-")[0],i=t.split("-")[1];if(i){var o=e.offsets,r=o.reference,s=o.popper,a=-1!==["bottom","top"].indexOf(n),l=a?"left":"top",c=a?"width":"height",h={start:Ye({},l,r[l]),end:Ye({},l,r[l]+r[c]-s[c])};e.offsets.popper=ze({},s,h[i])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var n=t.offset,i=e.placement,o=e.offsets,r=o.popper,s=o.reference,a=i.split("-")[0],l=void 0;return l=ft(+n)?[+n,0]:Tt(n,r,s,a),"left"===a?(r.top+=l[0],r.left-=l[1]):"right"===a?(r.top+=l[0],r.left+=l[1]):"top"===a?(r.left+=l[0],r.top-=l[1]):"bottom"===a&&(r.left+=l[0],r.top+=l[1]),e.popper=r,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,i){var t=i.boundariesElement||Fe(e.instance.popper);e.instance.reference===t&&(t=Fe(t));var n=lt("transform"),o=e.instance.popper.style,r=o.top,s=o.left,a=o[n];o.top="",o.left="",o[n]="";var l=Ze(e.instance.popper,e.instance.reference,i.padding,t,e.positionFixed);o.top=r,o.left=s,o[n]=a,i.boundaries=l;var c=i.priority,h=e.offsets.popper,u={primary:function(e){var t=h[e];return h[e]<l[e]&&!i.escapeWithReference&&(t=Math.max(h[e],l[e])),Ye({},e,t)},secondary:function(e){var t="right"===e?"left":"top",n=h[t];return h[e]>l[e]&&!i.escapeWithReference&&(n=Math.min(h[t],l[e]-("right"===e?h.width:h.height))),Ye({},t,n)}};return c.forEach(function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";h=ze({},h,u[t](e))}),e.offsets.popper=h,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,i=t.reference,o=e.placement.split("-")[0],r=Math.floor,s=-1!==["top","bottom"].indexOf(o),a=s?"right":"bottom",l=s?"left":"top",c=s?"width":"height";return n[a]<r(i[l])&&(e.offsets.popper[l]=r(i[l])-n[c]),n[l]>r(i[a])&&(e.offsets.popper[l]=r(i[a])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){var n;if(!gt(e.instance.modifiers,"arrow","keepTogether"))return e;var i=t.element;if("string"==typeof i){if(!(i=e.instance.popper.querySelector(i)))return e}else if(!e.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var o=e.placement.split("-")[0],r=e.offsets,s=r.popper,a=r.reference,l=-1!==["left","right"].indexOf(o),c=l?"height":"width",h=l?"Top":"Left",u=h.toLowerCase(),f=l?"left":"top",d=l?"bottom":"right",p=nt(i)[c];a[d]-p<s[u]&&(e.offsets.popper[u]-=s[u]-(a[d]-p)),a[u]+p>s[d]&&(e.offsets.popper[u]+=a[u]+p-s[d]),e.offsets.popper=Xe(e.offsets.popper);var m=a[u]+a[c]/2-p/2,g=ke(e.instance.popper),_=parseFloat(g["margin"+h],10),v=parseFloat(g["border"+h+"Width"],10),y=m-e.offsets.popper[u]-_-v;return y=Math.max(Math.min(s[c]-p,y),0),e.arrowElement=i,e.offsets.arrow=(Ye(n={},u,Math.round(y)),Ye(n,f,""),n),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(m,g){if(at(m.instance.modifiers,"inner"))return m;if(m.flipped&&m.placement===m.originalPlacement)return m;var _=Ze(m.instance.popper,m.instance.reference,g.padding,g.boundariesElement,m.positionFixed),v=m.placement.split("-")[0],y=it(v),E=m.placement.split("-")[1]||"",b=[];switch(g.behavior){case Et:b=[v,y];break;case bt:b=yt(v);break;case wt:b=yt(v,!0);break;default:b=g.behavior}return b.forEach(function(e,t){if(v!==e||b.length===t+1)return m;v=m.placement.split("-")[0],y=it(v);var n=m.offsets.popper,i=m.offsets.reference,o=Math.floor,r="left"===v&&o(n.right)>o(i.left)||"right"===v&&o(n.left)<o(i.right)||"top"===v&&o(n.bottom)>o(i.top)||"bottom"===v&&o(n.top)<o(i.bottom),s=o(n.left)<o(_.left),a=o(n.right)>o(_.right),l=o(n.top)<o(_.top),c=o(n.bottom)>o(_.bottom),h="left"===v&&s||"right"===v&&a||"top"===v&&l||"bottom"===v&&c,u=-1!==["top","bottom"].indexOf(v),f=!!g.flipVariations&&(u&&"start"===E&&s||u&&"end"===E&&a||!u&&"start"===E&&l||!u&&"end"===E&&c),d=!!g.flipVariationsByContent&&(u&&"start"===E&&a||u&&"end"===E&&s||!u&&"start"===E&&c||!u&&"end"===E&&l),p=f||d;(r||h||p)&&(m.flipped=!0,(r||h)&&(v=b[t+1]),p&&(E=function(e){return"end"===e?"start":"start"===e?"end":e}(E)),m.placement=v+(E?"-"+E:""),m.offsets.popper=ze({},m.offsets.popper,ot(m.instance.popper,m.offsets.reference,m.placement)),m=st(m.instance.modifiers,m,"flip"))}),m},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],i=e.offsets,o=i.popper,r=i.reference,s=-1!==["left","right"].indexOf(n),a=-1===["top","left"].indexOf(n);return o[s?"left":"top"]=r[n]-(a?o[s?"width":"height"]:0),e.placement=it(t),e.offsets.popper=Xe(o),e}},hide:{order:800,enabled:!0,fn:function(e){if(!gt(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=rt(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottom<n.top||t.left>n.right||t.top>n.bottom||t.right<n.left){if(!0===e.hide)return e;e.hide=!0,e.attributes["x-out-of-boundaries"]=""}else{if(!1===e.hide)return e;e.hide=!1,e.attributes["x-out-of-boundaries"]=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var n=t.x,i=t.y,o=e.offsets.popper,r=rt(e.instance.modifiers,function(e){return"applyStyle"===e.name}).gpuAcceleration;void 0!==r&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var s=void 0!==r?r:t.gpuAcceleration,a=Fe(e.instance.popper),l=Ge(a),c={position:o.position},h=pt(e,window.devicePixelRatio<2||!mt),u="bottom"===n?"top":"bottom",f="right"===i?"left":"right",d=lt("transform"),p=void 0,m=void 0;if(m="bottom"==u?"HTML"===a.nodeName?-a.clientHeight+h.bottom:-l.height+h.bottom:h.top,p="right"==f?"HTML"===a.nodeName?-a.clientWidth+h.right:-l.width+h.right:h.left,s&&d)c[d]="translate3d("+p+"px, "+m+"px, 0)",c[u]=0,c[f]=0,c.willChange="transform";else{var g="bottom"==u?-1:1,_="right"==f?-1:1;c[u]=m*g,c[f]=p*_,c.willChange=u+", "+f}var v={"x-placement":e.placement};return e.attributes=ze({},v,e.attributes),e.styles=ze({},c,e.styles),e.arrowStyles=ze({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){return dt(e.instance.popper,e.styles),function(t,n){Object.keys(n).forEach(function(e){!1!==n[e]?t.setAttribute(e,n[e]):t.removeAttribute(e)})}(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&dt(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,n,i,o){var r=tt(o,t,e,n.positionFixed),s=et(n.placement,r,t,e,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return t.setAttribute("x-placement",s),dt(t,{position:n.positionFixed?"fixed":"absolute"}),n},gpuAcceleration:void 0}}},St=(Qe(Dt,[{key:"update",value:function(){return function(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=tt(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=et(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=ot(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=st(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}.call(this)}},{key:"destroy",value:function(){return function(){return this.state.isDestroyed=!0,at(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[lt("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}.call(this)}},{key:"enableEventListeners",value:function(){return function(){this.state.eventsEnabled||(this.state=ht(this.reference,this.options,this.state,this.scheduleUpdate))}.call(this)}},{key:"disableEventListeners",value:function(){return ut.call(this)}}]),Dt);function Dt(e,t){var n=this,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Dt),this.scheduleUpdate=function(){return requestAnimationFrame(n.update)},this.update=Oe(this.update.bind(this)),this.options=ze({},Dt.Defaults,i),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=t&&t.jquery?t[0]:t,this.options.modifiers={},Object.keys(ze({},Dt.Defaults.modifiers,i.modifiers)).forEach(function(e){n.options.modifiers[e]=ze({},Dt.Defaults.modifiers[e]||{},i.modifiers?i.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return ze({name:e},n.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(e){e.enabled&&Ne(e.onLoad)&&e.onLoad(n.reference,n.popper,n.options,e,n.state)}),this.update();var o=this.options.eventsEnabled;o&&this.enableEventListeners(),this.state.eventsEnabled=o}St.Utils=("undefined"!=typeof window?window:global).PopperUtils,St.placements=_t,St.Defaults=Ct;var It="dropdown",At="bs.dropdown",Ot="."+At,Nt=".data-api",kt=p.fn[It],Lt=new RegExp("38|40|27"),Pt={HIDE:"hide"+Ot,HIDDEN:"hidden"+Ot,SHOW:"show"+Ot,SHOWN:"shown"+Ot,CLICK:"click"+Ot,CLICK_DATA_API:"click"+Ot+Nt,KEYDOWN_DATA_API:"keydown"+Ot+Nt,KEYUP_DATA_API:"keyup"+Ot+Nt},xt="disabled",jt="show",Ht="dropup",Rt="dropright",Ft="dropleft",Mt="dropdown-menu-right",Wt="position-static",Ut='[data-toggle="dropdown"]',Bt=".dropdown form",qt=".dropdown-menu",Kt=".navbar-nav",Qt=".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",Vt="top-start",Yt="top-end",zt="bottom-start",Xt="bottom-end",Gt="right-start",$t="left-start",Jt={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic",popperConfig:null},Zt={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"},en=function(){function c(e,t){this._element=e,this._popper=null,this._config=this._getConfig(t),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var e=c.prototype;return e.toggle=function(){if(!this._element.disabled&&!p(this._element).hasClass(xt)){var e=p(this._menu).hasClass(jt);c._clearMenus(),e||this.show(!0)}},e.show=function(e){if(void 0===e&&(e=!1),!(this._element.disabled||p(this._element).hasClass(xt)||p(this._menu).hasClass(jt))){var t={relatedTarget:this._element},n=p.Event(Pt.SHOW,t),i=c._getParentFromElement(this._element);if(p(i).trigger(n),!n.isDefaultPrevented()){if(!this._inNavbar&&e){if("undefined"==typeof St)throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org/)");var o=this._element;"parent"===this._config.reference?o=i:m.isElement(this._config.reference)&&(o=this._config.reference,"undefined"!=typeof this._config.reference.jquery&&(o=this._config.reference[0])),"scrollParent"!==this._config.boundary&&p(i).addClass(Wt),this._popper=new St(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===p(i).closest(Kt).length&&p(document.body).children().on("mouseover",null,p.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),p(this._menu).toggleClass(jt),p(i).toggleClass(jt).trigger(p.Event(Pt.SHOWN,t))}}},e.hide=function(){if(!this._element.disabled&&!p(this._element).hasClass(xt)&&p(this._menu).hasClass(jt)){var e={relatedTarget:this._element},t=p.Event(Pt.HIDE,e),n=c._getParentFromElement(this._element);p(n).trigger(t),t.isDefaultPrevented()||(this._popper&&this._popper.destroy(),p(this._menu).toggleClass(jt),p(n).toggleClass(jt).trigger(p.Event(Pt.HIDDEN,e)))}},e.dispose=function(){p.removeData(this._element,At),p(this._element).off(Ot),this._element=null,(this._menu=null)!==this._popper&&(this._popper.destroy(),this._popper=null)},e.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},e._addEventListeners=function(){var t=this;p(this._element).on(Pt.CLICK,function(e){e.preventDefault(),e.stopPropagation(),t.toggle()})},e._getConfig=function(e){return e=l({},this.constructor.Default,{},p(this._element).data(),{},e),m.typeCheckConfig(It,e,this.constructor.DefaultType),e},e._getMenuElement=function(){if(!this._menu){var e=c._getParentFromElement(this._element);e&&(this._menu=e.querySelector(qt))}return this._menu},e._getPlacement=function(){var e=p(this._element.parentNode),t=zt;return e.hasClass(Ht)?(t=Vt,p(this._menu).hasClass(Mt)&&(t=Yt)):e.hasClass(Rt)?t=Gt:e.hasClass(Ft)?t=$t:p(this._menu).hasClass(Mt)&&(t=Xt),t},e._detectNavbar=function(){return 0<p(this._element).closest(".navbar").length},e._getOffset=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=l({},e.offsets,{},t._config.offset(e.offsets,t._element)||{}),e}:e.offset=this._config.offset,e},e._getPopperConfig=function(){var e={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(e.modifiers.applyStyle={enabled:!1}),l({},e,{},this._config.popperConfig)},c._jQueryInterface=function(t){return this.each(function(){var e=p(this).data(At);if(e||(e=new c(this,"object"==typeof t?t:null),p(this).data(At,e)),"string"==typeof t){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}})},c._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var t=[].slice.call(document.querySelectorAll(Ut)),n=0,i=t.length;n<i;n++){var o=c._getParentFromElement(t[n]),r=p(t[n]).data(At),s={relatedTarget:t[n]};if(e&&"click"===e.type&&(s.clickEvent=e),r){var a=r._menu;if(p(o).hasClass(jt)&&!(e&&("click"===e.type&&/input|textarea/i.test(e.target.tagName)||"keyup"===e.type&&9===e.which)&&p.contains(o,e.target))){var l=p.Event(Pt.HIDE,s);p(o).trigger(l),l.isDefaultPrevented()||("ontouchstart"in document.documentElement&&p(document.body).children().off("mouseover",null,p.noop),t[n].setAttribute("aria-expanded","false"),r._popper&&r._popper.destroy(),p(a).removeClass(jt),p(o).removeClass(jt).trigger(p.Event(Pt.HIDDEN,s)))}}}},c._getParentFromElement=function(e){var t,n=m.getSelectorFromElement(e);return n&&(t=document.querySelector(n)),t||e.parentNode},c._dataApiKeydownHandler=function(e){if((/input|textarea/i.test(e.target.tagName)?!(32===e.which||27!==e.which&&(40!==e.which&&38!==e.which||p(e.target).closest(qt).length)):Lt.test(e.which))&&(e.preventDefault(),e.stopPropagation(),!this.disabled&&!p(this).hasClass(xt))){var t=c._getParentFromElement(this),n=p(t).hasClass(jt);if(n||27!==e.which)if(n&&(!n||27!==e.which&&32!==e.which)){var i=[].slice.call(t.querySelectorAll(Qt)).filter(function(e){return p(e).is(":visible")});if(0!==i.length){var o=i.indexOf(e.target);38===e.which&&0<o&&o--,40===e.which&&o<i.length-1&&o++,o<0&&(o=0),i[o].focus()}}else{if(27===e.which){var r=t.querySelector(Ut);p(r).trigger("focus")}p(this).trigger("click")}}},s(c,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return Jt}},{key:"DefaultType",get:function(){return Zt}}]),c}();p(document).on(Pt.KEYDOWN_DATA_API,Ut,en._dataApiKeydownHandler).on(Pt.KEYDOWN_DATA_API,qt,en._dataApiKeydownHandler).on(Pt.CLICK_DATA_API+" "+Pt.KEYUP_DATA_API,en._clearMenus).on(Pt.CLICK_DATA_API,Ut,function(e){e.preventDefault(),e.stopPropagation(),en._jQueryInterface.call(p(this),"toggle")}).on(Pt.CLICK_DATA_API,Bt,function(e){e.stopPropagation()}),p.fn[It]=en._jQueryInterface,p.fn[It].Constructor=en,p.fn[It].noConflict=function(){return p.fn[It]=kt,en._jQueryInterface};var tn="modal",nn="bs.modal",on="."+nn,rn=p.fn[tn],sn={backdrop:!0,keyboard:!0,focus:!0,show:!0},an={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},ln={HIDE:"hide"+on,HIDE_PREVENTED:"hidePrevented"+on,HIDDEN:"hidden"+on,SHOW:"show"+on,SHOWN:"shown"+on,FOCUSIN:"focusin"+on,RESIZE:"resize"+on,CLICK_DISMISS:"click.dismiss"+on,KEYDOWN_DISMISS:"keydown.dismiss"+on,MOUSEUP_DISMISS:"mouseup.dismiss"+on,MOUSEDOWN_DISMISS:"mousedown.dismiss"+on,CLICK_DATA_API:"click"+on+".data-api"},cn="modal-dialog-scrollable",hn="modal-scrollbar-measure",un="modal-backdrop",fn="modal-open",dn="fade",pn="show",mn="modal-static",gn=".modal-dialog",_n=".modal-body",vn='[data-toggle="modal"]',yn='[data-dismiss="modal"]',En=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",bn=".sticky-top",wn=function(){function o(e,t){this._config=this._getConfig(t),this._element=e,this._dialog=e.querySelector(gn),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollbarWidth=0}var e=o.prototype;return e.toggle=function(e){return this._isShown?this.hide():this.show(e)},e.show=function(e){var t=this;if(!this._isShown&&!this._isTransitioning){p(this._element).hasClass(dn)&&(this._isTransitioning=!0);var n=p.Event(ln.SHOW,{relatedTarget:e});p(this._element).trigger(n),this._isShown||n.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),p(this._element).on(ln.CLICK_DISMISS,yn,function(e){return t.hide(e)}),p(this._dialog).on(ln.MOUSEDOWN_DISMISS,function(){p(t._element).one(ln.MOUSEUP_DISMISS,function(e){p(e.target).is(t._element)&&(t._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return t._showElement(e)}))}},e.hide=function(e){var t=this;if(e&&e.preventDefault(),this._isShown&&!this._isTransitioning){var n=p.Event(ln.HIDE);if(p(this._element).trigger(n),this._isShown&&!n.isDefaultPrevented()){this._isShown=!1;var i=p(this._element).hasClass(dn);if(i&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),p(document).off(ln.FOCUSIN),p(this._element).removeClass(pn),p(this._element).off(ln.CLICK_DISMISS),p(this._dialog).off(ln.MOUSEDOWN_DISMISS),i){var o=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(e){return t._hideModal(e)}).emulateTransitionEnd(o)}else this._hideModal()}}},e.dispose=function(){[window,this._element,this._dialog].forEach(function(e){return p(e).off(on)}),p(document).off(ln.FOCUSIN),p.removeData(this._element,nn),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null},e.handleUpdate=function(){this._adjustDialog()},e._getConfig=function(e){return e=l({},sn,{},e),m.typeCheckConfig(tn,e,an),e},e._triggerBackdropTransition=function(){var e=this;if("static"===this._config.backdrop){var t=p.Event(ln.HIDE_PREVENTED);if(p(this._element).trigger(t),t.defaultPrevented)return;this._element.classList.add(mn);var n=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(){e._element.classList.remove(mn)}).emulateTransitionEnd(n),this._element.focus()}else this.hide()},e._showElement=function(e){var t=this,n=p(this._element).hasClass(dn),i=this._dialog?this._dialog.querySelector(_n):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),p(this._dialog).hasClass(cn)&&i?i.scrollTop=0:this._element.scrollTop=0,n&&m.reflow(this._element),p(this._element).addClass(pn),this._config.focus&&this._enforceFocus();function o(){t._config.focus&&t._element.focus(),t._isTransitioning=!1,p(t._element).trigger(r)}var r=p.Event(ln.SHOWN,{relatedTarget:e});if(n){var s=m.getTransitionDurationFromElement(this._dialog);p(this._dialog).one(m.TRANSITION_END,o).emulateTransitionEnd(s)}else o()},e._enforceFocus=function(){var t=this;p(document).off(ln.FOCUSIN).on(ln.FOCUSIN,function(e){document!==e.target&&t._element!==e.target&&0===p(t._element).has(e.target).length&&t._element.focus()})},e._setEscapeEvent=function(){var t=this;this._isShown&&this._config.keyboard?p(this._element).on(ln.KEYDOWN_DISMISS,function(e){27===e.which&&t._triggerBackdropTransition()}):this._isShown||p(this._element).off(ln.KEYDOWN_DISMISS)},e._setResizeEvent=function(){var t=this;this._isShown?p(window).on(ln.RESIZE,function(e){return t.handleUpdate(e)}):p(window).off(ln.RESIZE)},e._hideModal=function(){var e=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._isTransitioning=!1,this._showBackdrop(function(){p(document.body).removeClass(fn),e._resetAdjustments(),e._resetScrollbar(),p(e._element).trigger(ln.HIDDEN)})},e._removeBackdrop=function(){this._backdrop&&(p(this._backdrop).remove(),this._backdrop=null)},e._showBackdrop=function(e){var t=this,n=p(this._element).hasClass(dn)?dn:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className=un,n&&this._backdrop.classList.add(n),p(this._backdrop).appendTo(document.body),p(this._element).on(ln.CLICK_DISMISS,function(e){t._ignoreBackdropClick?t._ignoreBackdropClick=!1:e.target===e.currentTarget&&t._triggerBackdropTransition()}),n&&m.reflow(this._backdrop),p(this._backdrop).addClass(pn),!e)return;if(!n)return void e();var i=m.getTransitionDurationFromElement(this._backdrop);p(this._backdrop).one(m.TRANSITION_END,e).emulateTransitionEnd(i)}else if(!this._isShown&&this._backdrop){p(this._backdrop).removeClass(pn);var o=function(){t._removeBackdrop(),e&&e()};if(p(this._element).hasClass(dn)){var r=m.getTransitionDurationFromElement(this._backdrop);p(this._backdrop).one(m.TRANSITION_END,o).emulateTransitionEnd(r)}else o()}else e&&e()},e._adjustDialog=function(){var e=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},e._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},e._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=e.left+e.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},e._setScrollbar=function(){var o=this;if(this._isBodyOverflowing){var e=[].slice.call(document.querySelectorAll(En)),t=[].slice.call(document.querySelectorAll(bn));p(e).each(function(e,t){var n=t.style.paddingRight,i=p(t).css("padding-right");p(t).data("padding-right",n).css("padding-right",parseFloat(i)+o._scrollbarWidth+"px")}),p(t).each(function(e,t){var n=t.style.marginRight,i=p(t).css("margin-right");p(t).data("margin-right",n).css("margin-right",parseFloat(i)-o._scrollbarWidth+"px")});var n=document.body.style.paddingRight,i=p(document.body).css("padding-right");p(document.body).data("padding-right",n).css("padding-right",parseFloat(i)+this._scrollbarWidth+"px")}p(document.body).addClass(fn)},e._resetScrollbar=function(){var e=[].slice.call(document.querySelectorAll(En));p(e).each(function(e,t){var n=p(t).data("padding-right");p(t).removeData("padding-right"),t.style.paddingRight=n||""});var t=[].slice.call(document.querySelectorAll(""+bn));p(t).each(function(e,t){var n=p(t).data("margin-right");"undefined"!=typeof n&&p(t).css("margin-right",n).removeData("margin-right")});var n=p(document.body).data("padding-right");p(document.body).removeData("padding-right"),document.body.style.paddingRight=n||""},e._getScrollbarWidth=function(){var e=document.createElement("div");e.className=hn,document.body.appendChild(e);var t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},o._jQueryInterface=function(n,i){return this.each(function(){var e=p(this).data(nn),t=l({},sn,{},p(this).data(),{},"object"==typeof n&&n?n:{});if(e||(e=new o(this,t),p(this).data(nn,e)),"string"==typeof n){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n](i)}else t.show&&e.show(i)})},s(o,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return sn}}]),o}();p(document).on(ln.CLICK_DATA_API,vn,function(e){var t,n=this,i=m.getSelectorFromElement(this);i&&(t=document.querySelector(i));var o=p(t).data(nn)?"toggle":l({},p(t).data(),{},p(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||e.preventDefault();var r=p(t).one(ln.SHOW,function(e){e.isDefaultPrevented()||r.one(ln.HIDDEN,function(){p(n).is(":visible")&&n.focus()})});wn._jQueryInterface.call(p(t),o,this)}),p.fn[tn]=wn._jQueryInterface,p.fn[tn].Constructor=wn,p.fn[tn].noConflict=function(){return p.fn[tn]=rn,wn._jQueryInterface};var Tn=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],Cn={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},Sn=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,Dn=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function In(e,r,t){if(0===e.length)return e;if(t&&"function"==typeof t)return t(e);for(var n=(new window.DOMParser).parseFromString(e,"text/html"),s=Object.keys(r),a=[].slice.call(n.body.querySelectorAll("*")),i=function(e){var t=a[e],n=t.nodeName.toLowerCase();if(-1===s.indexOf(t.nodeName.toLowerCase()))return t.parentNode.removeChild(t),"continue";var i=[].slice.call(t.attributes),o=[].concat(r["*"]||[],r[n]||[]);i.forEach(function(e){!function(e,t){var n=e.nodeName.toLowerCase();if(-1!==t.indexOf(n))return-1===Tn.indexOf(n)||Boolean(e.nodeValue.match(Sn)||e.nodeValue.match(Dn));for(var i=t.filter(function(e){return e instanceof RegExp}),o=0,r=i.length;o<r;o++)if(n.match(i[o]))return!0;return!1}(e,o)&&t.removeAttribute(e.nodeName)})},o=0,l=a.length;o<l;o++)i(o);return n.body.innerHTML}var An="tooltip",On="bs.tooltip",Nn="."+On,kn=p.fn[An],Ln="bs-tooltip",Pn=new RegExp("(^|\\s)"+Ln+"\\S+","g"),xn=["sanitize","whiteList","sanitizeFn"],jn={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object",popperConfig:"(null|object)"},Hn={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},Rn={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:Cn,popperConfig:null},Fn="show",Mn="out",Wn={HIDE:"hide"+Nn,HIDDEN:"hidden"+Nn,SHOW:"show"+Nn,SHOWN:"shown"+Nn,INSERTED:"inserted"+Nn,CLICK:"click"+Nn,FOCUSIN:"focusin"+Nn,FOCUSOUT:"focusout"+Nn,MOUSEENTER:"mouseenter"+Nn,MOUSELEAVE:"mouseleave"+Nn},Un="fade",Bn="show",qn=".tooltip-inner",Kn=".arrow",Qn="hover",Vn="focus",Yn="click",zn="manual",Xn=function(){function i(e,t){if("undefined"==typeof St)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=e,this.config=this._getConfig(t),this.tip=null,this._setListeners()}var e=i.prototype;return e.enable=function(){this._isEnabled=!0},e.disable=function(){this._isEnabled=!1},e.toggleEnabled=function(){this._isEnabled=!this._isEnabled},e.toggle=function(e){if(this._isEnabled)if(e){var t=this.constructor.DATA_KEY,n=p(e.currentTarget).data(t);n||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),p(e.currentTarget).data(t,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(p(this.getTipElement()).hasClass(Bn))return void this._leave(null,this);this._enter(null,this)}},e.dispose=function(){clearTimeout(this._timeout),p.removeData(this.element,this.constructor.DATA_KEY),p(this.element).off(this.constructor.EVENT_KEY),p(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&p(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},e.show=function(){var t=this;if("none"===p(this.element).css("display"))throw new Error("Please use show on visible elements");var e=p.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){p(this.element).trigger(e);var n=m.findShadowRoot(this.element),i=p.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(e.isDefaultPrevented()||!i)return;var o=this.getTipElement(),r=m.getUID(this.constructor.NAME);o.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&p(o).addClass(Un);var s="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,a=this._getAttachment(s);this.addAttachmentClass(a);var l=this._getContainer();p(o).data(this.constructor.DATA_KEY,this),p.contains(this.element.ownerDocument.documentElement,this.tip)||p(o).appendTo(l),p(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new St(this.element,o,this._getPopperConfig(a)),p(o).addClass(Bn),"ontouchstart"in document.documentElement&&p(document.body).children().on("mouseover",null,p.noop);var c=function(){t.config.animation&&t._fixTransition();var e=t._hoverState;t._hoverState=null,p(t.element).trigger(t.constructor.Event.SHOWN),e===Mn&&t._leave(null,t)};if(p(this.tip).hasClass(Un)){var h=m.getTransitionDurationFromElement(this.tip);p(this.tip).one(m.TRANSITION_END,c).emulateTransitionEnd(h)}else c()}},e.hide=function(e){function t(){n._hoverState!==Fn&&i.parentNode&&i.parentNode.removeChild(i),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),p(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),e&&e()}var n=this,i=this.getTipElement(),o=p.Event(this.constructor.Event.HIDE);if(p(this.element).trigger(o),!o.isDefaultPrevented()){if(p(i).removeClass(Bn),"ontouchstart"in document.documentElement&&p(document.body).children().off("mouseover",null,p.noop),this._activeTrigger[Yn]=!1,this._activeTrigger[Vn]=!1,this._activeTrigger[Qn]=!1,p(this.tip).hasClass(Un)){var r=m.getTransitionDurationFromElement(i);p(i).one(m.TRANSITION_END,t).emulateTransitionEnd(r)}else t();this._hoverState=""}},e.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},e.isWithContent=function(){return Boolean(this.getTitle())},e.addAttachmentClass=function(e){p(this.getTipElement()).addClass(Ln+"-"+e)},e.getTipElement=function(){return this.tip=this.tip||p(this.config.template)[0],this.tip},e.setContent=function(){var e=this.getTipElement();this.setElementContent(p(e.querySelectorAll(qn)),this.getTitle()),p(e).removeClass(Un+" "+Bn)},e.setElementContent=function(e,t){"object"!=typeof t||!t.nodeType&&!t.jquery?this.config.html?(this.config.sanitize&&(t=In(t,this.config.whiteList,this.config.sanitizeFn)),e.html(t)):e.text(t):this.config.html?p(t).parent().is(e)||e.empty().append(t):e.text(p(t).text())},e.getTitle=function(){var e=this.element.getAttribute("data-original-title");return e=e||("function"==typeof this.config.title?this.config.title.call(this.element):this.config.title)},e._getPopperConfig=function(e){var t=this;return l({},{placement:e,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:Kn},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(e){e.originalPlacement!==e.placement&&t._handlePopperPlacementChange(e)},onUpdate:function(e){return t._handlePopperPlacementChange(e)}},{},this.config.popperConfig)},e._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=l({},e.offsets,{},t.config.offset(e.offsets,t.element)||{}),e}:e.offset=this.config.offset,e},e._getContainer=function(){return!1===this.config.container?document.body:m.isElement(this.config.container)?p(this.config.container):p(document).find(this.config.container)},e._getAttachment=function(e){return Hn[e.toUpperCase()]},e._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(e){if("click"===e)p(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(e){return i.toggle(e)});else if(e!==zn){var t=e===Qn?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=e===Qn?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;p(i.element).on(t,i.config.selector,function(e){return i._enter(e)}).on(n,i.config.selector,function(e){return i._leave(e)})}}),this._hideModalHandler=function(){i.element&&i.hide()},p(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},e._fixTitle=function(){var e=typeof this.element.getAttribute("data-original-title");!this.element.getAttribute("title")&&"string"==e||(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},e._enter=function(e,t){var n=this.constructor.DATA_KEY;(t=t||p(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),p(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusin"===e.type?Vn:Qn]=!0),p(t.getTipElement()).hasClass(Bn)||t._hoverState===Fn?t._hoverState=Fn:(clearTimeout(t._timeout),t._hoverState=Fn,t.config.delay&&t.config.delay.show?t._timeout=setTimeout(function(){t._hoverState===Fn&&t.show()},t.config.delay.show):t.show())},e._leave=function(e,t){var n=this.constructor.DATA_KEY;(t=t||p(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),p(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusout"===e.type?Vn:Qn]=!1),t._isWithActiveTrigger()||(clearTimeout(t._timeout),t._hoverState=Mn,t.config.delay&&t.config.delay.hide?t._timeout=setTimeout(function(){t._hoverState===Mn&&t.hide()},t.config.delay.hide):t.hide())},e._isWithActiveTrigger=function(){for(var e in this._activeTrigger)if(this._activeTrigger[e])return!0;return!1},e._getConfig=function(e){var t=p(this.element).data();return Object.keys(t).forEach(function(e){-1!==xn.indexOf(e)&&delete t[e]}),"number"==typeof(e=l({},this.constructor.Default,{},t,{},"object"==typeof e&&e?e:{})).delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),m.typeCheckConfig(An,e,this.constructor.DefaultType),e.sanitize&&(e.template=In(e.template,e.whiteList,e.sanitizeFn)),e},e._getDelegateConfig=function(){var e={};if(this.config)for(var t in this.config)this.constructor.Default[t]!==this.config[t]&&(e[t]=this.config[t]);return e},e._cleanTipClass=function(){var e=p(this.getTipElement()),t=e.attr("class").match(Pn);null!==t&&t.length&&e.removeClass(t.join(""))},e._handlePopperPlacementChange=function(e){var t=e.instance;this.tip=t.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(e.placement))},e._fixTransition=function(){var e=this.getTipElement(),t=this.config.animation;null===e.getAttribute("x-placement")&&(p(e).removeClass(Un),this.config.animation=!1,this.hide(),this.show(),this.config.animation=t)},i._jQueryInterface=function(n){return this.each(function(){var e=p(this).data(On),t="object"==typeof n&&n;if((e||!/dispose|hide/.test(n))&&(e||(e=new i(this,t),p(this).data(On,e)),"string"==typeof n)){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return Rn}},{key:"NAME",get:function(){return An}},{key:"DATA_KEY",get:function(){return On}},{key:"Event",get:function(){return Wn}},{key:"EVENT_KEY",get:function(){return Nn}},{key:"DefaultType",get:function(){return jn}}]),i}();p.fn[An]=Xn._jQueryInterface,p.fn[An].Constructor=Xn,p.fn[An].noConflict=function(){return p.fn[An]=kn,Xn._jQueryInterface};var Gn="popover",$n="bs.popover",Jn="."+$n,Zn=p.fn[Gn],ei="bs-popover",ti=new RegExp("(^|\\s)"+ei+"\\S+","g"),ni=l({},Xn.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),ii=l({},Xn.DefaultType,{content:"(string|element|function)"}),oi="fade",ri="show",si=".popover-header",ai=".popover-body",li={HIDE:"hide"+Jn,HIDDEN:"hidden"+Jn,SHOW:"show"+Jn,SHOWN:"shown"+Jn,INSERTED:"inserted"+Jn,CLICK:"click"+Jn,FOCUSIN:"focusin"+Jn,FOCUSOUT:"focusout"+Jn,MOUSEENTER:"mouseenter"+Jn,MOUSELEAVE:"mouseleave"+Jn},ci=function(e){function i(){return e.apply(this,arguments)||this}!function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}(i,e);var t=i.prototype;return t.isWithContent=function(){return this.getTitle()||this._getContent()},t.addAttachmentClass=function(e){p(this.getTipElement()).addClass(ei+"-"+e)},t.getTipElement=function(){return this.tip=this.tip||p(this.config.template)[0],this.tip},t.setContent=function(){var e=p(this.getTipElement());this.setElementContent(e.find(si),this.getTitle());var t=this._getContent();"function"==typeof t&&(t=t.call(this.element)),this.setElementContent(e.find(ai),t),e.removeClass(oi+" "+ri)},t._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},t._cleanTipClass=function(){var e=p(this.getTipElement()),t=e.attr("class").match(ti);null!==t&&0<t.length&&e.removeClass(t.join(""))},i._jQueryInterface=function(n){return this.each(function(){var e=p(this).data($n),t="object"==typeof n?n:null;if((e||!/dispose|hide/.test(n))&&(e||(e=new i(this,t),p(this).data($n,e)),"string"==typeof n)){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return ni}},{key:"NAME",get:function(){return Gn}},{key:"DATA_KEY",get:function(){return $n}},{key:"Event",get:function(){return li}},{key:"EVENT_KEY",get:function(){return Jn}},{key:"DefaultType",get:function(){return ii}}]),i}(Xn);p.fn[Gn]=ci._jQueryInterface,p.fn[Gn].Constructor=ci,p.fn[Gn].noConflict=function(){return p.fn[Gn]=Zn,ci._jQueryInterface};var hi="scrollspy",ui="bs.scrollspy",fi="."+ui,di=p.fn[hi],pi={offset:10,method:"auto",target:""},mi={offset:"number",method:"string",target:"(string|element)"},gi={ACTIVATE:"activate"+fi,SCROLL:"scroll"+fi,LOAD_DATA_API:"load"+fi+".data-api"},_i="dropdown-item",vi="active",yi='[data-spy="scroll"]',Ei=".nav, .list-group",bi=".nav-link",wi=".nav-item",Ti=".list-group-item",Ci=".dropdown",Si=".dropdown-item",Di=".dropdown-toggle",Ii="offset",Ai="position",Oi=function(){function n(e,t){var n=this;this._element=e,this._scrollElement="BODY"===e.tagName?window:e,this._config=this._getConfig(t),this._selector=this._config.target+" "+bi+","+this._config.target+" "+Ti+","+this._config.target+" "+Si,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,p(this._scrollElement).on(gi.SCROLL,function(e){return n._process(e)}),this.refresh(),this._process()}var e=n.prototype;return e.refresh=function(){var t=this,e=this._scrollElement===this._scrollElement.window?Ii:Ai,o="auto"===this._config.method?e:this._config.method,r=o===Ai?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map(function(e){var t,n=m.getSelectorFromElement(e);if(n&&(t=document.querySelector(n)),t){var i=t.getBoundingClientRect();if(i.width||i.height)return[p(t)[o]().top+r,n]}return null}).filter(function(e){return e}).sort(function(e,t){return e[0]-t[0]}).forEach(function(e){t._offsets.push(e[0]),t._targets.push(e[1])})},e.dispose=function(){p.removeData(this._element,ui),p(this._scrollElement).off(fi),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},e._getConfig=function(e){if("string"!=typeof(e=l({},pi,{},"object"==typeof e&&e?e:{})).target){var t=p(e.target).attr("id");t||(t=m.getUID(hi),p(e.target).attr("id",t)),e.target="#"+t}return m.typeCheckConfig(hi,e,mi),e},e._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},e._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},e._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},e._process=function(){var e=this._getScrollTop()+this._config.offset,t=this._getScrollHeight(),n=this._config.offset+t-this._getOffsetHeight();if(this._scrollHeight!==t&&this.refresh(),n<=e){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&e<this._offsets[0]&&0<this._offsets[0])return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;){this._activeTarget!==this._targets[o]&&e>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||e<this._offsets[o+1])&&this._activate(this._targets[o])}}},e._activate=function(t){this._activeTarget=t,this._clear();var e=this._selector.split(",").map(function(e){return e+'[data-target="'+t+'"],'+e+'[href="'+t+'"]'}),n=p([].slice.call(document.querySelectorAll(e.join(","))));n.hasClass(_i)?(n.closest(Ci).find(Di).addClass(vi),n.addClass(vi)):(n.addClass(vi),n.parents(Ei).prev(bi+", "+Ti).addClass(vi),n.parents(Ei).prev(wi).children(bi).addClass(vi)),p(this._scrollElement).trigger(gi.ACTIVATE,{relatedTarget:t})},e._clear=function(){[].slice.call(document.querySelectorAll(this._selector)).filter(function(e){return e.classList.contains(vi)}).forEach(function(e){return e.classList.remove(vi)})},n._jQueryInterface=function(t){return this.each(function(){var e=p(this).data(ui);if(e||(e=new n(this,"object"==typeof t&&t),p(this).data(ui,e)),"string"==typeof t){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}})},s(n,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return pi}}]),n}();p(window).on(gi.LOAD_DATA_API,function(){for(var e=[].slice.call(document.querySelectorAll(yi)),t=e.length;t--;){var n=p(e[t]);Oi._jQueryInterface.call(n,n.data())}}),p.fn[hi]=Oi._jQueryInterface,p.fn[hi].Constructor=Oi,p.fn[hi].noConflict=function(){return p.fn[hi]=di,Oi._jQueryInterface};var Ni="bs.tab",ki="."+Ni,Li=p.fn.tab,Pi={HIDE:"hide"+ki,HIDDEN:"hidden"+ki,SHOW:"show"+ki,SHOWN:"shown"+ki,CLICK_DATA_API:"click"+ki+".data-api"},xi="dropdown-menu",ji="active",Hi="disabled",Ri="fade",Fi="show",Mi=".dropdown",Wi=".nav, .list-group",Ui=".active",Bi="> li > .active",qi='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',Ki=".dropdown-toggle",Qi="> .dropdown-menu .active",Vi=function(){function i(e){this._element=e}var e=i.prototype;return e.show=function(){var n=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&p(this._element).hasClass(ji)||p(this._element).hasClass(Hi))){var e,i,t=p(this._element).closest(Wi)[0],o=m.getSelectorFromElement(this._element);if(t){var r="UL"===t.nodeName||"OL"===t.nodeName?Bi:Ui;i=(i=p.makeArray(p(t).find(r)))[i.length-1]}var s=p.Event(Pi.HIDE,{relatedTarget:this._element}),a=p.Event(Pi.SHOW,{relatedTarget:i});if(i&&p(i).trigger(s),p(this._element).trigger(a),!a.isDefaultPrevented()&&!s.isDefaultPrevented()){o&&(e=document.querySelector(o)),this._activate(this._element,t);var l=function(){var e=p.Event(Pi.HIDDEN,{relatedTarget:n._element}),t=p.Event(Pi.SHOWN,{relatedTarget:i});p(i).trigger(e),p(n._element).trigger(t)};e?this._activate(e,e.parentNode,l):l()}}},e.dispose=function(){p.removeData(this._element,Ni),this._element=null},e._activate=function(e,t,n){function i(){return o._transitionComplete(e,r,n)}var o=this,r=(!t||"UL"!==t.nodeName&&"OL"!==t.nodeName?p(t).children(Ui):p(t).find(Bi))[0],s=n&&r&&p(r).hasClass(Ri);if(r&&s){var a=m.getTransitionDurationFromElement(r);p(r).removeClass(Fi).one(m.TRANSITION_END,i).emulateTransitionEnd(a)}else i()},e._transitionComplete=function(e,t,n){if(t){p(t).removeClass(ji);var i=p(t.parentNode).find(Qi)[0];i&&p(i).removeClass(ji),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!1)}if(p(e).addClass(ji),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!0),m.reflow(e),e.classList.contains(Ri)&&e.classList.add(Fi),e.parentNode&&p(e.parentNode).hasClass(xi)){var o=p(e).closest(Mi)[0];if(o){var r=[].slice.call(o.querySelectorAll(Ki));p(r).addClass(ji)}e.setAttribute("aria-expanded",!0)}n&&n()},i._jQueryInterface=function(n){return this.each(function(){var e=p(this),t=e.data(Ni);if(t||(t=new i(this),e.data(Ni,t)),"string"==typeof n){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}}]),i}();p(document).on(Pi.CLICK_DATA_API,qi,function(e){e.preventDefault(),Vi._jQueryInterface.call(p(this),"show")}),p.fn.tab=Vi._jQueryInterface,p.fn.tab.Constructor=Vi,p.fn.tab.noConflict=function(){return p.fn.tab=Li,Vi._jQueryInterface};var Yi="toast",zi="bs.toast",Xi="."+zi,Gi=p.fn[Yi],$i={CLICK_DISMISS:"click.dismiss"+Xi,HIDE:"hide"+Xi,HIDDEN:"hidden"+Xi,SHOW:"show"+Xi,SHOWN:"shown"+Xi},Ji="fade",Zi="hide",eo="show",to="showing",no={animation:"boolean",autohide:"boolean",delay:"number"},io={animation:!0,autohide:!0,delay:500},oo='[data-dismiss="toast"]',ro=function(){function i(e,t){this._element=e,this._config=this._getConfig(t),this._timeout=null,this._setListeners()}var e=i.prototype;return e.show=function(){var e=this,t=p.Event($i.SHOW);if(p(this._element).trigger(t),!t.isDefaultPrevented()){this._config.animation&&this._element.classList.add(Ji);var n=function(){e._element.classList.remove(to),e._element.classList.add(eo),p(e._element).trigger($i.SHOWN),e._config.autohide&&(e._timeout=setTimeout(function(){e.hide()},e._config.delay))};if(this._element.classList.remove(Zi),m.reflow(this._element),this._element.classList.add(to),this._config.animation){var i=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,n).emulateTransitionEnd(i)}else n()}},e.hide=function(){if(this._element.classList.contains(eo)){var e=p.Event($i.HIDE);p(this._element).trigger(e),e.isDefaultPrevented()||this._close()}},e.dispose=function(){clearTimeout(this._timeout),this._timeout=null,this._element.classList.contains(eo)&&this._element.classList.remove(eo),p(this._element).off($i.CLICK_DISMISS),p.removeData(this._element,zi),this._element=null,this._config=null},e._getConfig=function(e){return e=l({},io,{},p(this._element).data(),{},"object"==typeof e&&e?e:{}),m.typeCheckConfig(Yi,e,this.constructor.DefaultType),e},e._setListeners=function(){var e=this;p(this._element).on($i.CLICK_DISMISS,oo,function(){return e.hide()})},e._close=function(){function e(){t._element.classList.add(Zi),p(t._element).trigger($i.HIDDEN)}var t=this;if(this._element.classList.remove(eo),this._config.animation){var n=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},i._jQueryInterface=function(n){return this.each(function(){var e=p(this),t=e.data(zi);if(t||(t=new i(this,"object"==typeof n&&n),e.data(zi,t)),"string"==typeof n){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n](this)}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"DefaultType",get:function(){return no}},{key:"Default",get:function(){return io}}]),i}();p.fn[Yi]=ro._jQueryInterface,p.fn[Yi].Constructor=ro,p.fn[Yi].noConflict=function(){return p.fn[Yi]=Gi,ro._jQueryInterface},e.Alert=_,e.Button=x,e.Carousel=he,e.Collapse=De,e.Dropdown=en,e.Modal=wn,e.Popover=ci,e.Scrollspy=Oi,e.Tab=Vi,e.Toast=ro,e.Tooltip=Xn,e.Util=m,Object.defineProperty(e,"__esModule",{value:!0})});
7
- //# sourceMappingURL=bootstrap.bundle.min.js.map
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
  */
6
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],t):t((e=e||self).bootstrap={},e.jQuery)}(this,function(e,p){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function l(o){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?t(Object(r),!0).forEach(function(e){var t,n,i;t=o,i=r[n=e],n in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))})}return o}p=p&&p.hasOwnProperty("default")?p.default:p;var n="transitionend";function o(e){var t=this,n=!1;return p(this).one(m.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||m.triggerTransitionEnd(t)},e),this}var m={TRANSITION_END:"bsTransitionEnd",getUID:function(e){for(;e+=~~(1e6*Math.random()),document.getElementById(e););return e},getSelectorFromElement:function(e){var t=e.getAttribute("data-target");if(!t||"#"===t){var n=e.getAttribute("href");t=n&&"#"!==n?n.trim():""}try{return document.querySelector(t)?t:null}catch(e){return null}},getTransitionDurationFromElement:function(e){if(!e)return 0;var t=p(e).css("transition-duration"),n=p(e).css("transition-delay"),i=parseFloat(t),o=parseFloat(n);return i||o?(t=t.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(t)+parseFloat(n))):0},reflow:function(e){return e.offsetHeight},triggerTransitionEnd:function(e){p(e).trigger(n)},supportsTransitionEnd:function(){return Boolean(n)},isElement:function(e){return(e[0]||e).nodeType},typeCheckConfig:function(e,t,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=t[i],s=r&&m.isElement(r)?"element":(a=r,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(e.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+o+'".')}var a},findShadowRoot:function(e){if(!document.documentElement.attachShadow)return null;if("function"!=typeof e.getRootNode)return e instanceof ShadowRoot?e:e.parentNode?m.findShadowRoot(e.parentNode):null;var t=e.getRootNode();return t instanceof ShadowRoot?t:null},jQueryDetection:function(){if("undefined"==typeof p)throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.");var e=p.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1===e[0]&&9===e[1]&&e[2]<1||4<=e[0])throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};m.jQueryDetection(),p.fn.emulateTransitionEnd=o,p.event.special[m.TRANSITION_END]={bindType:n,delegateType:n,handle:function(e){if(p(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}};var r="alert",a="bs.alert",c="."+a,h=p.fn[r],u={CLOSE:"close"+c,CLOSED:"closed"+c,CLICK_DATA_API:"click"+c+".data-api"},f="alert",d="fade",g="show",_=function(){function i(e){this._element=e}var e=i.prototype;return e.close=function(e){var t=this._element;e&&(t=this._getRootElement(e)),this._triggerCloseEvent(t).isDefaultPrevented()||this._removeElement(t)},e.dispose=function(){p.removeData(this._element,a),this._element=null},e._getRootElement=function(e){var t=m.getSelectorFromElement(e),n=!1;return t&&(n=document.querySelector(t)),n=n||p(e).closest("."+f)[0]},e._triggerCloseEvent=function(e){var t=p.Event(u.CLOSE);return p(e).trigger(t),t},e._removeElement=function(t){var n=this;if(p(t).removeClass(g),p(t).hasClass(d)){var e=m.getTransitionDurationFromElement(t);p(t).one(m.TRANSITION_END,function(e){return n._destroyElement(t,e)}).emulateTransitionEnd(e)}else this._destroyElement(t)},e._destroyElement=function(e){p(e).detach().trigger(u.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var e=p(this),t=e.data(a);t||(t=new i(this),e.data(a,t)),"close"===n&&t[n](this)})},i._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}}]),i}();p(document).on(u.CLICK_DATA_API,'[data-dismiss="alert"]',_._handleDismiss(new _)),p.fn[r]=_._jQueryInterface,p.fn[r].Constructor=_,p.fn[r].noConflict=function(){return p.fn[r]=h,_._jQueryInterface};var v="button",y="bs.button",E="."+y,b=".data-api",w=p.fn[v],T="active",C="btn",S="focus",D='[data-toggle^="button"]',I='[data-toggle="buttons"]',A='[data-toggle="button"]',O='[data-toggle="buttons"] .btn',N='input:not([type="hidden"])',k=".active",L=".btn",P={CLICK_DATA_API:"click"+E+b,FOCUS_BLUR_DATA_API:"focus"+E+b+" blur"+E+b,LOAD_DATA_API:"load"+E+b},x=function(){function n(e){this._element=e}var e=n.prototype;return e.toggle=function(){var e=!0,t=!0,n=p(this._element).closest(I)[0];if(n){var i=this._element.querySelector(N);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(T))e=!1;else{var o=n.querySelector(k);o&&p(o).removeClass(T)}else"checkbox"===i.type?"LABEL"===this._element.tagName&&i.checked===this._element.classList.contains(T)&&(e=!1):e=!1;e&&(i.checked=!this._element.classList.contains(T),p(i).trigger("change")),i.focus(),t=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(t&&this._element.setAttribute("aria-pressed",!this._element.classList.contains(T)),e&&p(this._element).toggleClass(T))},e.dispose=function(){p.removeData(this._element,y),this._element=null},n._jQueryInterface=function(t){return this.each(function(){var e=p(this).data(y);e||(e=new n(this),p(this).data(y,e)),"toggle"===t&&e[t]()})},s(n,null,[{key:"VERSION",get:function(){return"4.4.1"}}]),n}();p(document).on(P.CLICK_DATA_API,D,function(e){var t=e.target;if(p(t).hasClass(C)||(t=p(t).closest(L)[0]),!t||t.hasAttribute("disabled")||t.classList.contains("disabled"))e.preventDefault();else{var n=t.querySelector(N);if(n&&(n.hasAttribute("disabled")||n.classList.contains("disabled")))return void e.preventDefault();x._jQueryInterface.call(p(t),"toggle")}}).on(P.FOCUS_BLUR_DATA_API,D,function(e){var t=p(e.target).closest(L)[0];p(t).toggleClass(S,/^focus(in)?$/.test(e.type))}),p(window).on(P.LOAD_DATA_API,function(){for(var e=[].slice.call(document.querySelectorAll(O)),t=0,n=e.length;t<n;t++){var i=e[t],o=i.querySelector(N);o.checked||o.hasAttribute("checked")?i.classList.add(T):i.classList.remove(T)}for(var r=0,s=(e=[].slice.call(document.querySelectorAll(A))).length;r<s;r++){var a=e[r];"true"===a.getAttribute("aria-pressed")?a.classList.add(T):a.classList.remove(T)}}),p.fn[v]=x._jQueryInterface,p.fn[v].Constructor=x,p.fn[v].noConflict=function(){return p.fn[v]=w,x._jQueryInterface};var j="carousel",H="bs.carousel",R="."+H,F=".data-api",M=p.fn[j],W={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},U={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},B="next",q="prev",K="left",Q="right",V={SLIDE:"slide"+R,SLID:"slid"+R,KEYDOWN:"keydown"+R,MOUSEENTER:"mouseenter"+R,MOUSELEAVE:"mouseleave"+R,TOUCHSTART:"touchstart"+R,TOUCHMOVE:"touchmove"+R,TOUCHEND:"touchend"+R,POINTERDOWN:"pointerdown"+R,POINTERUP:"pointerup"+R,DRAG_START:"dragstart"+R,LOAD_DATA_API:"load"+R+F,CLICK_DATA_API:"click"+R+F},Y="carousel",z="active",X="slide",G="carousel-item-right",$="carousel-item-left",J="carousel-item-next",Z="carousel-item-prev",ee="pointer-event",te=".active",ne=".active.carousel-item",ie=".carousel-item",oe=".carousel-item img",re=".carousel-item-next, .carousel-item-prev",se=".carousel-indicators",ae="[data-slide], [data-slide-to]",le='[data-ride="carousel"]',ce={TOUCH:"touch",PEN:"pen"},he=function(){function r(e,t){this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(t),this._element=e,this._indicatorsElement=this._element.querySelector(se),this._touchSupported="ontouchstart"in document.documentElement||0<navigator.maxTouchPoints,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var e=r.prototype;return e.next=function(){this._isSliding||this._slide(B)},e.nextWhenVisible=function(){!document.hidden&&p(this._element).is(":visible")&&"hidden"!==p(this._element).css("visibility")&&this.next()},e.prev=function(){this._isSliding||this._slide(q)},e.pause=function(e){e||(this._isPaused=!0),this._element.querySelector(re)&&(m.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},e.cycle=function(e){e||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},e.to=function(e){var t=this;this._activeElement=this._element.querySelector(ne);var n=this._getItemIndex(this._activeElement);if(!(e>this._items.length-1||e<0))if(this._isSliding)p(this._element).one(V.SLID,function(){return t.to(e)});else{if(n===e)return this.pause(),void this.cycle();var i=n<e?B:q;this._slide(i,this._items[e])}},e.dispose=function(){p(this._element).off(R),p.removeData(this._element,H),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},e._getConfig=function(e){return e=l({},W,{},e),m.typeCheckConfig(j,e,U),e},e._handleSwipe=function(){var e=Math.abs(this.touchDeltaX);if(!(e<=40)){var t=e/this.touchDeltaX;(this.touchDeltaX=0)<t&&this.prev(),t<0&&this.next()}},e._addEventListeners=function(){var t=this;this._config.keyboard&&p(this._element).on(V.KEYDOWN,function(e){return t._keydown(e)}),"hover"===this._config.pause&&p(this._element).on(V.MOUSEENTER,function(e){return t.pause(e)}).on(V.MOUSELEAVE,function(e){return t.cycle(e)}),this._config.touch&&this._addTouchEventListeners()},e._addTouchEventListeners=function(){var t=this;if(this._touchSupported){var n=function(e){t._pointerEvent&&ce[e.originalEvent.pointerType.toUpperCase()]?t.touchStartX=e.originalEvent.clientX:t._pointerEvent||(t.touchStartX=e.originalEvent.touches[0].clientX)},i=function(e){t._pointerEvent&&ce[e.originalEvent.pointerType.toUpperCase()]&&(t.touchDeltaX=e.originalEvent.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout(function(e){return t.cycle(e)},500+t._config.interval))};p(this._element.querySelectorAll(oe)).on(V.DRAG_START,function(e){return e.preventDefault()}),this._pointerEvent?(p(this._element).on(V.POINTERDOWN,function(e){return n(e)}),p(this._element).on(V.POINTERUP,function(e){return i(e)}),this._element.classList.add(ee)):(p(this._element).on(V.TOUCHSTART,function(e){return n(e)}),p(this._element).on(V.TOUCHMOVE,function(e){return function(e){e.originalEvent.touches&&1<e.originalEvent.touches.length?t.touchDeltaX=0:t.touchDeltaX=e.originalEvent.touches[0].clientX-t.touchStartX}(e)}),p(this._element).on(V.TOUCHEND,function(e){return i(e)}))}},e._keydown=function(e){if(!/input|textarea/i.test(e.target.tagName))switch(e.which){case 37:e.preventDefault(),this.prev();break;case 39:e.preventDefault(),this.next()}},e._getItemIndex=function(e){return this._items=e&&e.parentNode?[].slice.call(e.parentNode.querySelectorAll(ie)):[],this._items.indexOf(e)},e._getItemByDirection=function(e,t){var n=e===B,i=e===q,o=this._getItemIndex(t),r=this._items.length-1;if((i&&0===o||n&&o===r)&&!this._config.wrap)return t;var s=(o+(e===q?-1:1))%this._items.length;return-1==s?this._items[this._items.length-1]:this._items[s]},e._triggerSlideEvent=function(e,t){var n=this._getItemIndex(e),i=this._getItemIndex(this._element.querySelector(ne)),o=p.Event(V.SLIDE,{relatedTarget:e,direction:t,from:i,to:n});return p(this._element).trigger(o),o},e._setActiveIndicatorElement=function(e){if(this._indicatorsElement){var t=[].slice.call(this._indicatorsElement.querySelectorAll(te));p(t).removeClass(z);var n=this._indicatorsElement.children[this._getItemIndex(e)];n&&p(n).addClass(z)}},e._slide=function(e,t){var n,i,o,r=this,s=this._element.querySelector(ne),a=this._getItemIndex(s),l=t||s&&this._getItemByDirection(e,s),c=this._getItemIndex(l),h=Boolean(this._interval);if(o=e===B?(n=$,i=J,K):(n=G,i=Z,Q),l&&p(l).hasClass(z))this._isSliding=!1;else if(!this._triggerSlideEvent(l,o).isDefaultPrevented()&&s&&l){this._isSliding=!0,h&&this.pause(),this._setActiveIndicatorElement(l);var u=p.Event(V.SLID,{relatedTarget:l,direction:o,from:a,to:c});if(p(this._element).hasClass(X)){p(l).addClass(i),m.reflow(l),p(s).addClass(n),p(l).addClass(n);var f=parseInt(l.getAttribute("data-interval"),10);f?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=f):this._config.interval=this._config.defaultInterval||this._config.interval;var d=m.getTransitionDurationFromElement(s);p(s).one(m.TRANSITION_END,function(){p(l).removeClass(n+" "+i).addClass(z),p(s).removeClass(z+" "+i+" "+n),r._isSliding=!1,setTimeout(function(){return p(r._element).trigger(u)},0)}).emulateTransitionEnd(d)}else p(s).removeClass(z),p(l).addClass(z),this._isSliding=!1,p(this._element).trigger(u);h&&this.cycle()}},r._jQueryInterface=function(i){return this.each(function(){var e=p(this).data(H),t=l({},W,{},p(this).data());"object"==typeof i&&(t=l({},t,{},i));var n="string"==typeof i?i:t.slide;if(e||(e=new r(this,t),p(this).data(H,e)),"number"==typeof i)e.to(i);else if("string"==typeof n){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}else t.interval&&t.ride&&(e.pause(),e.cycle())})},r._dataApiClickHandler=function(e){var t=m.getSelectorFromElement(this);if(t){var n=p(t)[0];if(n&&p(n).hasClass(Y)){var i=l({},p(n).data(),{},p(this).data()),o=this.getAttribute("data-slide-to");o&&(i.interval=!1),r._jQueryInterface.call(p(n),i),o&&p(n).data(H).to(o),e.preventDefault()}}},s(r,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return W}}]),r}();p(document).on(V.CLICK_DATA_API,ae,he._dataApiClickHandler),p(window).on(V.LOAD_DATA_API,function(){for(var e=[].slice.call(document.querySelectorAll(le)),t=0,n=e.length;t<n;t++){var i=p(e[t]);he._jQueryInterface.call(i,i.data())}}),p.fn[j]=he._jQueryInterface,p.fn[j].Constructor=he,p.fn[j].noConflict=function(){return p.fn[j]=M,he._jQueryInterface};var ue="collapse",fe="bs.collapse",de="."+fe,pe=p.fn[ue],me={toggle:!0,parent:""},ge={toggle:"boolean",parent:"(string|element)"},_e={SHOW:"show"+de,SHOWN:"shown"+de,HIDE:"hide"+de,HIDDEN:"hidden"+de,CLICK_DATA_API:"click"+de+".data-api"},ve="show",ye="collapse",Ee="collapsing",be="collapsed",we="width",Te="height",Ce=".show, .collapsing",Se='[data-toggle="collapse"]',De=function(){function a(t,e){this._isTransitioning=!1,this._element=t,this._config=this._getConfig(e),this._triggerArray=[].slice.call(document.querySelectorAll('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'));for(var n=[].slice.call(document.querySelectorAll(Se)),i=0,o=n.length;i<o;i++){var r=n[i],s=m.getSelectorFromElement(r),a=[].slice.call(document.querySelectorAll(s)).filter(function(e){return e===t});null!==s&&0<a.length&&(this._selector=s,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var e=a.prototype;return e.toggle=function(){p(this._element).hasClass(ve)?this.hide():this.show()},e.show=function(){var e,t,n=this;if(!this._isTransitioning&&!p(this._element).hasClass(ve)&&(this._parent&&0===(e=[].slice.call(this._parent.querySelectorAll(Ce)).filter(function(e){return"string"==typeof n._config.parent?e.getAttribute("data-parent")===n._config.parent:e.classList.contains(ye)})).length&&(e=null),!(e&&(t=p(e).not(this._selector).data(fe))&&t._isTransitioning))){var i=p.Event(_e.SHOW);if(p(this._element).trigger(i),!i.isDefaultPrevented()){e&&(a._jQueryInterface.call(p(e).not(this._selector),"hide"),t||p(e).data(fe,null));var o=this._getDimension();p(this._element).removeClass(ye).addClass(Ee),this._element.style[o]=0,this._triggerArray.length&&p(this._triggerArray).removeClass(be).attr("aria-expanded",!0),this.setTransitioning(!0);var r="scroll"+(o[0].toUpperCase()+o.slice(1)),s=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(){p(n._element).removeClass(Ee).addClass(ye).addClass(ve),n._element.style[o]="",n.setTransitioning(!1),p(n._element).trigger(_e.SHOWN)}).emulateTransitionEnd(s),this._element.style[o]=this._element[r]+"px"}}},e.hide=function(){var e=this;if(!this._isTransitioning&&p(this._element).hasClass(ve)){var t=p.Event(_e.HIDE);if(p(this._element).trigger(t),!t.isDefaultPrevented()){var n=this._getDimension();this._element.style[n]=this._element.getBoundingClientRect()[n]+"px",m.reflow(this._element),p(this._element).addClass(Ee).removeClass(ye).removeClass(ve);var i=this._triggerArray.length;if(0<i)for(var o=0;o<i;o++){var r=this._triggerArray[o],s=m.getSelectorFromElement(r);if(null!==s)p([].slice.call(document.querySelectorAll(s))).hasClass(ve)||p(r).addClass(be).attr("aria-expanded",!1)}this.setTransitioning(!0);this._element.style[n]="";var a=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(){e.setTransitioning(!1),p(e._element).removeClass(Ee).addClass(ye).trigger(_e.HIDDEN)}).emulateTransitionEnd(a)}}},e.setTransitioning=function(e){this._isTransitioning=e},e.dispose=function(){p.removeData(this._element,fe),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},e._getConfig=function(e){return(e=l({},me,{},e)).toggle=Boolean(e.toggle),m.typeCheckConfig(ue,e,ge),e},e._getDimension=function(){return p(this._element).hasClass(we)?we:Te},e._getParent=function(){var e,n=this;m.isElement(this._config.parent)?(e=this._config.parent,"undefined"!=typeof this._config.parent.jquery&&(e=this._config.parent[0])):e=document.querySelector(this._config.parent);var t='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]',i=[].slice.call(e.querySelectorAll(t));return p(i).each(function(e,t){n._addAriaAndCollapsedClass(a._getTargetFromElement(t),[t])}),e},e._addAriaAndCollapsedClass=function(e,t){var n=p(e).hasClass(ve);t.length&&p(t).toggleClass(be,!n).attr("aria-expanded",n)},a._getTargetFromElement=function(e){var t=m.getSelectorFromElement(e);return t?document.querySelector(t):null},a._jQueryInterface=function(i){return this.each(function(){var e=p(this),t=e.data(fe),n=l({},me,{},e.data(),{},"object"==typeof i&&i?i:{});if(!t&&n.toggle&&/show|hide/.test(i)&&(n.toggle=!1),t||(t=new a(this,n),e.data(fe,t)),"string"==typeof i){if("undefined"==typeof t[i])throw new TypeError('No method named "'+i+'"');t[i]()}})},s(a,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return me}}]),a}();p(document).on(_e.CLICK_DATA_API,Se,function(e){"A"===e.currentTarget.tagName&&e.preventDefault();var n=p(this),t=m.getSelectorFromElement(this),i=[].slice.call(document.querySelectorAll(t));p(i).each(function(){var e=p(this),t=e.data(fe)?"toggle":n.data();De._jQueryInterface.call(e,t)})}),p.fn[ue]=De._jQueryInterface,p.fn[ue].Constructor=De,p.fn[ue].noConflict=function(){return p.fn[ue]=pe,De._jQueryInterface};var Ie="undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator,Ae=function(){for(var e=["Edge","Trident","Firefox"],t=0;t<e.length;t+=1)if(Ie&&0<=navigator.userAgent.indexOf(e[t]))return 1;return 0}();var Oe=Ie&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Ae))}};function Ne(e){return e&&"[object Function]"==={}.toString.call(e)}function ke(e,t){if(1!==e.nodeType)return[];var n=e.ownerDocument.defaultView.getComputedStyle(e,null);return t?n[t]:n}function Le(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function Pe(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=ke(e),n=t.overflow,i=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+i)?e:Pe(Le(e))}function xe(e){return e&&e.referenceNode?e.referenceNode:e}var je=Ie&&!(!window.MSInputMethodContext||!document.documentMode),He=Ie&&/MSIE 10/.test(navigator.userAgent);function Re(e){return 11===e?je:10===e?He:je||He}function Fe(e){if(!e)return document.documentElement;for(var t=Re(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===ke(n,"position")?Fe(n):n:e?e.ownerDocument.documentElement:document.documentElement}function Me(e){return null!==e.parentNode?Me(e.parentNode):e}function We(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?e:t,o=n?t:e,r=document.createRange();r.setStart(i,0),r.setEnd(o,0);var s=r.commonAncestorContainer;if(e!==s&&t!==s||i.contains(o))return function(e){var t=e.nodeName;return"BODY"!==t&&("HTML"===t||Fe(e.firstElementChild)===e)}(s)?s:Fe(s);var a=Me(e);return a.host?We(a.host,t):We(e,Me(t).host)}function Ue(e,t){var n="top"===(1<arguments.length&&void 0!==t?t:"top")?"scrollTop":"scrollLeft",i=e.nodeName;if("BODY"!==i&&"HTML"!==i)return e[n];var o=e.ownerDocument.documentElement;return(e.ownerDocument.scrollingElement||o)[n]}function Be(e,t){var n="x"===t?"Left":"Top",i="Left"==n?"Right":"Bottom";return parseFloat(e["border"+n+"Width"],10)+parseFloat(e["border"+i+"Width"],10)}function qe(e,t,n,i){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],Re(10)?parseInt(n["offset"+e])+parseInt(i["margin"+("Height"===e?"Top":"Left")])+parseInt(i["margin"+("Height"===e?"Bottom":"Right")]):0)}function Ke(e){var t=e.body,n=e.documentElement,i=Re(10)&&getComputedStyle(n);return{height:qe("Height",t,n,i),width:qe("Width",t,n,i)}}var Qe=function(e,t,n){return t&&Ve(e.prototype,t),n&&Ve(e,n),e};function Ve(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Ye(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ze=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};function Xe(e){return ze({},e,{right:e.left+e.width,bottom:e.top+e.height})}function Ge(e){var t={};try{if(Re(10)){t=e.getBoundingClientRect();var n=Ue(e,"top"),i=Ue(e,"left");t.top+=n,t.left+=i,t.bottom+=n,t.right+=i}else t=e.getBoundingClientRect()}catch(e){}var o={left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top},r="HTML"===e.nodeName?Ke(e.ownerDocument):{},s=r.width||e.clientWidth||o.width,a=r.height||e.clientHeight||o.height,l=e.offsetWidth-s,c=e.offsetHeight-a;if(l||c){var h=ke(e);l-=Be(h,"x"),c-=Be(h,"y"),o.width-=l,o.height-=c}return Xe(o)}function $e(e,t,n){var i=2<arguments.length&&void 0!==n&&n,o=Re(10),r="HTML"===t.nodeName,s=Ge(e),a=Ge(t),l=Pe(e),c=ke(t),h=parseFloat(c.borderTopWidth,10),u=parseFloat(c.borderLeftWidth,10);i&&r&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var f=Xe({top:s.top-a.top-h,left:s.left-a.left-u,width:s.width,height:s.height});if(f.marginTop=0,f.marginLeft=0,!o&&r){var d=parseFloat(c.marginTop,10),p=parseFloat(c.marginLeft,10);f.top-=h-d,f.bottom-=h-d,f.left-=u-p,f.right-=u-p,f.marginTop=d,f.marginLeft=p}return(o&&!i?t.contains(l):t===l&&"BODY"!==l.nodeName)&&(f=function(e,t,n){var i=2<arguments.length&&void 0!==n&&n,o=Ue(t,"top"),r=Ue(t,"left"),s=i?-1:1;return e.top+=o*s,e.bottom+=o*s,e.left+=r*s,e.right+=r*s,e}(f,t)),f}function Je(e){if(!e||!e.parentElement||Re())return document.documentElement;for(var t=e.parentElement;t&&"none"===ke(t,"transform");)t=t.parentElement;return t||document.documentElement}function Ze(e,t,n,i,o){var r=4<arguments.length&&void 0!==o&&o,s={top:0,left:0},a=r?Je(e):We(e,xe(t));if("viewport"===i)s=function(e,t){var n=1<arguments.length&&void 0!==t&&t,i=e.ownerDocument.documentElement,o=$e(e,i),r=Math.max(i.clientWidth,window.innerWidth||0),s=Math.max(i.clientHeight,window.innerHeight||0),a=n?0:Ue(i),l=n?0:Ue(i,"left");return Xe({top:a-o.top+o.marginTop,left:l-o.left+o.marginLeft,width:r,height:s})}(a,r);else{var l=void 0;"scrollParent"===i?"BODY"===(l=Pe(Le(t))).nodeName&&(l=e.ownerDocument.documentElement):l="window"===i?e.ownerDocument.documentElement:i;var c=$e(l,a,r);if("HTML"!==l.nodeName||function e(t){var n=t.nodeName;if("BODY"===n||"HTML"===n)return!1;if("fixed"===ke(t,"position"))return!0;var i=Le(t);return!!i&&e(i)}(a))s=c;else{var h=Ke(e.ownerDocument),u=h.height,f=h.width;s.top+=c.top-c.marginTop,s.bottom=u+c.top,s.left+=c.left-c.marginLeft,s.right=f+c.left}}var d="number"==typeof(n=n||0);return s.left+=d?n:n.left||0,s.top+=d?n:n.top||0,s.right-=d?n:n.right||0,s.bottom-=d?n:n.bottom||0,s}function et(e,t,i,n,o,r){var s=5<arguments.length&&void 0!==r?r:0;if(-1===e.indexOf("auto"))return e;var a=Ze(i,n,s,o),l={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},c=Object.keys(l).map(function(e){return ze({key:e},l[e],{area:function(e){return e.width*e.height}(l[e])})}).sort(function(e,t){return t.area-e.area}),h=c.filter(function(e){var t=e.width,n=e.height;return t>=i.clientWidth&&n>=i.clientHeight}),u=0<h.length?h[0].key:c[0].key,f=e.split("-")[1];return u+(f?"-"+f:"")}function tt(e,t,n,i){var o=3<arguments.length&&void 0!==i?i:null;return $e(n,o?Je(t):We(t,xe(n)),o)}function nt(e){var t=e.ownerDocument.defaultView.getComputedStyle(e),n=parseFloat(t.marginTop||0)+parseFloat(t.marginBottom||0),i=parseFloat(t.marginLeft||0)+parseFloat(t.marginRight||0);return{width:e.offsetWidth+i,height:e.offsetHeight+n}}function it(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function ot(e,t,n){n=n.split("-")[0];var i=nt(e),o={width:i.width,height:i.height},r=-1!==["right","left"].indexOf(n),s=r?"top":"left",a=r?"left":"top",l=r?"height":"width",c=r?"width":"height";return o[s]=t[s]+t[l]/2-i[l]/2,o[a]=n===a?t[a]-i[c]:t[it(a)],o}function rt(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function st(e,n,t){return(void 0===t?e:e.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===n});var i=rt(e,function(e){return e[t]===n});return e.indexOf(i)}(e,"name",t))).forEach(function(e){e.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var t=e.function||e.fn;e.enabled&&Ne(t)&&(n.offsets.popper=Xe(n.offsets.popper),n.offsets.reference=Xe(n.offsets.reference),n=t(n,e))}),n}function at(e,n){return e.some(function(e){var t=e.name;return e.enabled&&t===n})}function lt(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),i=0;i<t.length;i++){var o=t[i],r=o?""+o+n:e;if("undefined"!=typeof document.body.style[r])return r}return null}function ct(e){var t=e.ownerDocument;return t?t.defaultView:window}function ht(e,t,n,i){n.updateBound=i,ct(e).addEventListener("resize",n.updateBound,{passive:!0});var o=Pe(e);return function e(t,n,i,o){var r="BODY"===t.nodeName,s=r?t.ownerDocument.defaultView:t;s.addEventListener(n,i,{passive:!0}),r||e(Pe(s.parentNode),n,i,o),o.push(s)}(o,"scroll",n.updateBound,n.scrollParents),n.scrollElement=o,n.eventsEnabled=!0,n}function ut(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=function(e,t){return ct(e).removeEventListener("resize",t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener("scroll",t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}(this.reference,this.state))}function ft(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function dt(n,i){Object.keys(i).forEach(function(e){var t="";-1!==["width","height","top","right","bottom","left"].indexOf(e)&&ft(i[e])&&(t="px"),n.style[e]=i[e]+t})}function pt(e,t){function n(e){return e}var i=e.offsets,o=i.popper,r=i.reference,s=Math.round,a=Math.floor,l=s(r.width),c=s(o.width),h=-1!==["left","right"].indexOf(e.placement),u=-1!==e.placement.indexOf("-"),f=t?h||u||l%2==c%2?s:a:n,d=t?s:n;return{left:f(l%2==1&&c%2==1&&!u&&t?o.left-1:o.left),top:d(o.top),bottom:d(o.bottom),right:f(o.right)}}var mt=Ie&&/Firefox/i.test(navigator.userAgent);function gt(e,t,n){var i=rt(e,function(e){return e.name===t}),o=!!i&&e.some(function(e){return e.name===n&&e.enabled&&e.order<i.order});if(!o){var r="`"+t+"`",s="`"+n+"`";console.warn(s+" modifier is required by "+r+" modifier in order to work, be sure to include it before "+r+"!")}return o}var _t=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],vt=_t.slice(3);function yt(e,t){var n=1<arguments.length&&void 0!==t&&t,i=vt.indexOf(e),o=vt.slice(i+1).concat(vt.slice(0,i));return n?o.reverse():o}var Et="flip",bt="clockwise",wt="counterclockwise";function Tt(e,o,r,t){var s=[0,0],a=-1!==["right","left"].indexOf(t),n=e.split(/(\+|\-)/).map(function(e){return e.trim()}),i=n.indexOf(rt(n,function(e){return-1!==e.search(/,|\s/)}));n[i]&&-1===n[i].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,c=-1!==i?[n.slice(0,i).concat([n[i].split(l)[0]]),[n[i].split(l)[1]].concat(n.slice(i+1))]:[n];return(c=c.map(function(e,t){var n=(1===t?!a:a)?"height":"width",i=!1;return e.reduce(function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,i=!0,e):i?(e[e.length-1]+=t,i=!1,e):e.concat(t)},[]).map(function(e){return function(e,t,n,i){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+o[1],s=o[2];if(!r)return e;if(0!==s.indexOf("%"))return"vh"!==s&&"vw"!==s?r:("vh"===s?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*r;var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=i}return Xe(a)[t]/100*r}(e,n,o,r)})})).forEach(function(n,i){n.forEach(function(e,t){ft(e)&&(s[i]+=e*("-"===n[t-1]?-1:1))})}),s}var Ct={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,n=t.split("-")[0],i=t.split("-")[1];if(i){var o=e.offsets,r=o.reference,s=o.popper,a=-1!==["bottom","top"].indexOf(n),l=a?"left":"top",c=a?"width":"height",h={start:Ye({},l,r[l]),end:Ye({},l,r[l]+r[c]-s[c])};e.offsets.popper=ze({},s,h[i])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var n=t.offset,i=e.placement,o=e.offsets,r=o.popper,s=o.reference,a=i.split("-")[0],l=void 0;return l=ft(+n)?[+n,0]:Tt(n,r,s,a),"left"===a?(r.top+=l[0],r.left-=l[1]):"right"===a?(r.top+=l[0],r.left+=l[1]):"top"===a?(r.left+=l[0],r.top-=l[1]):"bottom"===a&&(r.left+=l[0],r.top+=l[1]),e.popper=r,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,i){var t=i.boundariesElement||Fe(e.instance.popper);e.instance.reference===t&&(t=Fe(t));var n=lt("transform"),o=e.instance.popper.style,r=o.top,s=o.left,a=o[n];o.top="",o.left="",o[n]="";var l=Ze(e.instance.popper,e.instance.reference,i.padding,t,e.positionFixed);o.top=r,o.left=s,o[n]=a,i.boundaries=l;var c=i.priority,h=e.offsets.popper,u={primary:function(e){var t=h[e];return h[e]<l[e]&&!i.escapeWithReference&&(t=Math.max(h[e],l[e])),Ye({},e,t)},secondary:function(e){var t="right"===e?"left":"top",n=h[t];return h[e]>l[e]&&!i.escapeWithReference&&(n=Math.min(h[t],l[e]-("right"===e?h.width:h.height))),Ye({},t,n)}};return c.forEach(function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";h=ze({},h,u[t](e))}),e.offsets.popper=h,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,i=t.reference,o=e.placement.split("-")[0],r=Math.floor,s=-1!==["top","bottom"].indexOf(o),a=s?"right":"bottom",l=s?"left":"top",c=s?"width":"height";return n[a]<r(i[l])&&(e.offsets.popper[l]=r(i[l])-n[c]),n[l]>r(i[a])&&(e.offsets.popper[l]=r(i[a])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){var n;if(!gt(e.instance.modifiers,"arrow","keepTogether"))return e;var i=t.element;if("string"==typeof i){if(!(i=e.instance.popper.querySelector(i)))return e}else if(!e.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var o=e.placement.split("-")[0],r=e.offsets,s=r.popper,a=r.reference,l=-1!==["left","right"].indexOf(o),c=l?"height":"width",h=l?"Top":"Left",u=h.toLowerCase(),f=l?"left":"top",d=l?"bottom":"right",p=nt(i)[c];a[d]-p<s[u]&&(e.offsets.popper[u]-=s[u]-(a[d]-p)),a[u]+p>s[d]&&(e.offsets.popper[u]+=a[u]+p-s[d]),e.offsets.popper=Xe(e.offsets.popper);var m=a[u]+a[c]/2-p/2,g=ke(e.instance.popper),_=parseFloat(g["margin"+h],10),v=parseFloat(g["border"+h+"Width"],10),y=m-e.offsets.popper[u]-_-v;return y=Math.max(Math.min(s[c]-p,y),0),e.arrowElement=i,e.offsets.arrow=(Ye(n={},u,Math.round(y)),Ye(n,f,""),n),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(m,g){if(at(m.instance.modifiers,"inner"))return m;if(m.flipped&&m.placement===m.originalPlacement)return m;var _=Ze(m.instance.popper,m.instance.reference,g.padding,g.boundariesElement,m.positionFixed),v=m.placement.split("-")[0],y=it(v),E=m.placement.split("-")[1]||"",b=[];switch(g.behavior){case Et:b=[v,y];break;case bt:b=yt(v);break;case wt:b=yt(v,!0);break;default:b=g.behavior}return b.forEach(function(e,t){if(v!==e||b.length===t+1)return m;v=m.placement.split("-")[0],y=it(v);var n=m.offsets.popper,i=m.offsets.reference,o=Math.floor,r="left"===v&&o(n.right)>o(i.left)||"right"===v&&o(n.left)<o(i.right)||"top"===v&&o(n.bottom)>o(i.top)||"bottom"===v&&o(n.top)<o(i.bottom),s=o(n.left)<o(_.left),a=o(n.right)>o(_.right),l=o(n.top)<o(_.top),c=o(n.bottom)>o(_.bottom),h="left"===v&&s||"right"===v&&a||"top"===v&&l||"bottom"===v&&c,u=-1!==["top","bottom"].indexOf(v),f=!!g.flipVariations&&(u&&"start"===E&&s||u&&"end"===E&&a||!u&&"start"===E&&l||!u&&"end"===E&&c),d=!!g.flipVariationsByContent&&(u&&"start"===E&&a||u&&"end"===E&&s||!u&&"start"===E&&c||!u&&"end"===E&&l),p=f||d;(r||h||p)&&(m.flipped=!0,(r||h)&&(v=b[t+1]),p&&(E=function(e){return"end"===e?"start":"start"===e?"end":e}(E)),m.placement=v+(E?"-"+E:""),m.offsets.popper=ze({},m.offsets.popper,ot(m.instance.popper,m.offsets.reference,m.placement)),m=st(m.instance.modifiers,m,"flip"))}),m},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],i=e.offsets,o=i.popper,r=i.reference,s=-1!==["left","right"].indexOf(n),a=-1===["top","left"].indexOf(n);return o[s?"left":"top"]=r[n]-(a?o[s?"width":"height"]:0),e.placement=it(t),e.offsets.popper=Xe(o),e}},hide:{order:800,enabled:!0,fn:function(e){if(!gt(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=rt(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottom<n.top||t.left>n.right||t.top>n.bottom||t.right<n.left){if(!0===e.hide)return e;e.hide=!0,e.attributes["x-out-of-boundaries"]=""}else{if(!1===e.hide)return e;e.hide=!1,e.attributes["x-out-of-boundaries"]=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var n=t.x,i=t.y,o=e.offsets.popper,r=rt(e.instance.modifiers,function(e){return"applyStyle"===e.name}).gpuAcceleration;void 0!==r&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var s=void 0!==r?r:t.gpuAcceleration,a=Fe(e.instance.popper),l=Ge(a),c={position:o.position},h=pt(e,window.devicePixelRatio<2||!mt),u="bottom"===n?"top":"bottom",f="right"===i?"left":"right",d=lt("transform"),p=void 0,m=void 0;if(m="bottom"==u?"HTML"===a.nodeName?-a.clientHeight+h.bottom:-l.height+h.bottom:h.top,p="right"==f?"HTML"===a.nodeName?-a.clientWidth+h.right:-l.width+h.right:h.left,s&&d)c[d]="translate3d("+p+"px, "+m+"px, 0)",c[u]=0,c[f]=0,c.willChange="transform";else{var g="bottom"==u?-1:1,_="right"==f?-1:1;c[u]=m*g,c[f]=p*_,c.willChange=u+", "+f}var v={"x-placement":e.placement};return e.attributes=ze({},v,e.attributes),e.styles=ze({},c,e.styles),e.arrowStyles=ze({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){return dt(e.instance.popper,e.styles),function(t,n){Object.keys(n).forEach(function(e){!1!==n[e]?t.setAttribute(e,n[e]):t.removeAttribute(e)})}(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&dt(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,n,i,o){var r=tt(o,t,e,n.positionFixed),s=et(n.placement,r,t,e,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return t.setAttribute("x-placement",s),dt(t,{position:n.positionFixed?"fixed":"absolute"}),n},gpuAcceleration:void 0}}},St=(Qe(Dt,[{key:"update",value:function(){return function(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=tt(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=et(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=ot(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=st(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}.call(this)}},{key:"destroy",value:function(){return function(){return this.state.isDestroyed=!0,at(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[lt("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}.call(this)}},{key:"enableEventListeners",value:function(){return function(){this.state.eventsEnabled||(this.state=ht(this.reference,this.options,this.state,this.scheduleUpdate))}.call(this)}},{key:"disableEventListeners",value:function(){return ut.call(this)}}]),Dt);function Dt(e,t){var n=this,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Dt),this.scheduleUpdate=function(){return requestAnimationFrame(n.update)},this.update=Oe(this.update.bind(this)),this.options=ze({},Dt.Defaults,i),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=t&&t.jquery?t[0]:t,this.options.modifiers={},Object.keys(ze({},Dt.Defaults.modifiers,i.modifiers)).forEach(function(e){n.options.modifiers[e]=ze({},Dt.Defaults.modifiers[e]||{},i.modifiers?i.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return ze({name:e},n.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(e){e.enabled&&Ne(e.onLoad)&&e.onLoad(n.reference,n.popper,n.options,e,n.state)}),this.update();var o=this.options.eventsEnabled;o&&this.enableEventListeners(),this.state.eventsEnabled=o}St.Utils=("undefined"!=typeof window?window:global).PopperUtils,St.placements=_t,St.Defaults=Ct;var It="dropdown",At="bs.dropdown",Ot="."+At,Nt=".data-api",kt=p.fn[It],Lt=new RegExp("38|40|27"),Pt={HIDE:"hide"+Ot,HIDDEN:"hidden"+Ot,SHOW:"show"+Ot,SHOWN:"shown"+Ot,CLICK:"click"+Ot,CLICK_DATA_API:"click"+Ot+Nt,KEYDOWN_DATA_API:"keydown"+Ot+Nt,KEYUP_DATA_API:"keyup"+Ot+Nt},xt="disabled",jt="show",Ht="dropup",Rt="dropright",Ft="dropleft",Mt="dropdown-menu-right",Wt="position-static",Ut='[data-toggle="dropdown"]',Bt=".dropdown form",qt=".dropdown-menu",Kt=".navbar-nav",Qt=".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",Vt="top-start",Yt="top-end",zt="bottom-start",Xt="bottom-end",Gt="right-start",$t="left-start",Jt={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic",popperConfig:null},Zt={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"},en=function(){function c(e,t){this._element=e,this._popper=null,this._config=this._getConfig(t),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var e=c.prototype;return e.toggle=function(){if(!this._element.disabled&&!p(this._element).hasClass(xt)){var e=p(this._menu).hasClass(jt);c._clearMenus(),e||this.show(!0)}},e.show=function(e){if(void 0===e&&(e=!1),!(this._element.disabled||p(this._element).hasClass(xt)||p(this._menu).hasClass(jt))){var t={relatedTarget:this._element},n=p.Event(Pt.SHOW,t),i=c._getParentFromElement(this._element);if(p(i).trigger(n),!n.isDefaultPrevented()){if(!this._inNavbar&&e){if("undefined"==typeof St)throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org/)");var o=this._element;"parent"===this._config.reference?o=i:m.isElement(this._config.reference)&&(o=this._config.reference,"undefined"!=typeof this._config.reference.jquery&&(o=this._config.reference[0])),"scrollParent"!==this._config.boundary&&p(i).addClass(Wt),this._popper=new St(o,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===p(i).closest(Kt).length&&p(document.body).children().on("mouseover",null,p.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),p(this._menu).toggleClass(jt),p(i).toggleClass(jt).trigger(p.Event(Pt.SHOWN,t))}}},e.hide=function(){if(!this._element.disabled&&!p(this._element).hasClass(xt)&&p(this._menu).hasClass(jt)){var e={relatedTarget:this._element},t=p.Event(Pt.HIDE,e),n=c._getParentFromElement(this._element);p(n).trigger(t),t.isDefaultPrevented()||(this._popper&&this._popper.destroy(),p(this._menu).toggleClass(jt),p(n).toggleClass(jt).trigger(p.Event(Pt.HIDDEN,e)))}},e.dispose=function(){p.removeData(this._element,At),p(this._element).off(Ot),this._element=null,(this._menu=null)!==this._popper&&(this._popper.destroy(),this._popper=null)},e.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},e._addEventListeners=function(){var t=this;p(this._element).on(Pt.CLICK,function(e){e.preventDefault(),e.stopPropagation(),t.toggle()})},e._getConfig=function(e){return e=l({},this.constructor.Default,{},p(this._element).data(),{},e),m.typeCheckConfig(It,e,this.constructor.DefaultType),e},e._getMenuElement=function(){if(!this._menu){var e=c._getParentFromElement(this._element);e&&(this._menu=e.querySelector(qt))}return this._menu},e._getPlacement=function(){var e=p(this._element.parentNode),t=zt;return e.hasClass(Ht)?(t=Vt,p(this._menu).hasClass(Mt)&&(t=Yt)):e.hasClass(Rt)?t=Gt:e.hasClass(Ft)?t=$t:p(this._menu).hasClass(Mt)&&(t=Xt),t},e._detectNavbar=function(){return 0<p(this._element).closest(".navbar").length},e._getOffset=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=l({},e.offsets,{},t._config.offset(e.offsets,t._element)||{}),e}:e.offset=this._config.offset,e},e._getPopperConfig=function(){var e={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(e.modifiers.applyStyle={enabled:!1}),l({},e,{},this._config.popperConfig)},c._jQueryInterface=function(t){return this.each(function(){var e=p(this).data(At);if(e||(e=new c(this,"object"==typeof t?t:null),p(this).data(At,e)),"string"==typeof t){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}})},c._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var t=[].slice.call(document.querySelectorAll(Ut)),n=0,i=t.length;n<i;n++){var o=c._getParentFromElement(t[n]),r=p(t[n]).data(At),s={relatedTarget:t[n]};if(e&&"click"===e.type&&(s.clickEvent=e),r){var a=r._menu;if(p(o).hasClass(jt)&&!(e&&("click"===e.type&&/input|textarea/i.test(e.target.tagName)||"keyup"===e.type&&9===e.which)&&p.contains(o,e.target))){var l=p.Event(Pt.HIDE,s);p(o).trigger(l),l.isDefaultPrevented()||("ontouchstart"in document.documentElement&&p(document.body).children().off("mouseover",null,p.noop),t[n].setAttribute("aria-expanded","false"),r._popper&&r._popper.destroy(),p(a).removeClass(jt),p(o).removeClass(jt).trigger(p.Event(Pt.HIDDEN,s)))}}}},c._getParentFromElement=function(e){var t,n=m.getSelectorFromElement(e);return n&&(t=document.querySelector(n)),t||e.parentNode},c._dataApiKeydownHandler=function(e){if((/input|textarea/i.test(e.target.tagName)?!(32===e.which||27!==e.which&&(40!==e.which&&38!==e.which||p(e.target).closest(qt).length)):Lt.test(e.which))&&(e.preventDefault(),e.stopPropagation(),!this.disabled&&!p(this).hasClass(xt))){var t=c._getParentFromElement(this),n=p(t).hasClass(jt);if(n||27!==e.which)if(n&&(!n||27!==e.which&&32!==e.which)){var i=[].slice.call(t.querySelectorAll(Qt)).filter(function(e){return p(e).is(":visible")});if(0!==i.length){var o=i.indexOf(e.target);38===e.which&&0<o&&o--,40===e.which&&o<i.length-1&&o++,o<0&&(o=0),i[o].focus()}}else{if(27===e.which){var r=t.querySelector(Ut);p(r).trigger("focus")}p(this).trigger("click")}}},s(c,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return Jt}},{key:"DefaultType",get:function(){return Zt}}]),c}();p(document).on(Pt.KEYDOWN_DATA_API,Ut,en._dataApiKeydownHandler).on(Pt.KEYDOWN_DATA_API,qt,en._dataApiKeydownHandler).on(Pt.CLICK_DATA_API+" "+Pt.KEYUP_DATA_API,en._clearMenus).on(Pt.CLICK_DATA_API,Ut,function(e){e.preventDefault(),e.stopPropagation(),en._jQueryInterface.call(p(this),"toggle")}).on(Pt.CLICK_DATA_API,Bt,function(e){e.stopPropagation()}),p.fn[It]=en._jQueryInterface,p.fn[It].Constructor=en,p.fn[It].noConflict=function(){return p.fn[It]=kt,en._jQueryInterface};var tn="modal",nn="bs.modal",on="."+nn,rn=p.fn[tn],sn={backdrop:!0,keyboard:!0,focus:!0,show:!0},an={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"},ln={HIDE:"hide"+on,HIDE_PREVENTED:"hidePrevented"+on,HIDDEN:"hidden"+on,SHOW:"show"+on,SHOWN:"shown"+on,FOCUSIN:"focusin"+on,RESIZE:"resize"+on,CLICK_DISMISS:"click.dismiss"+on,KEYDOWN_DISMISS:"keydown.dismiss"+on,MOUSEUP_DISMISS:"mouseup.dismiss"+on,MOUSEDOWN_DISMISS:"mousedown.dismiss"+on,CLICK_DATA_API:"click"+on+".data-api"},cn="modal-dialog-scrollable",hn="modal-scrollbar-measure",un="modal-backdrop",fn="modal-open",dn="fade",pn="show",mn="modal-static",gn=".modal-dialog",_n=".modal-body",vn='[data-toggle="modal"]',yn='[data-dismiss="modal"]',En=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",bn=".sticky-top",wn=function(){function o(e,t){this._config=this._getConfig(t),this._element=e,this._dialog=e.querySelector(gn),this._backdrop=null,this._isShown=!1,this._isBodyOverflowing=!1,this._ignoreBackdropClick=!1,this._isTransitioning=!1,this._scrollbarWidth=0}var e=o.prototype;return e.toggle=function(e){return this._isShown?this.hide():this.show(e)},e.show=function(e){var t=this;if(!this._isShown&&!this._isTransitioning){p(this._element).hasClass(dn)&&(this._isTransitioning=!0);var n=p.Event(ln.SHOW,{relatedTarget:e});p(this._element).trigger(n),this._isShown||n.isDefaultPrevented()||(this._isShown=!0,this._checkScrollbar(),this._setScrollbar(),this._adjustDialog(),this._setEscapeEvent(),this._setResizeEvent(),p(this._element).on(ln.CLICK_DISMISS,yn,function(e){return t.hide(e)}),p(this._dialog).on(ln.MOUSEDOWN_DISMISS,function(){p(t._element).one(ln.MOUSEUP_DISMISS,function(e){p(e.target).is(t._element)&&(t._ignoreBackdropClick=!0)})}),this._showBackdrop(function(){return t._showElement(e)}))}},e.hide=function(e){var t=this;if(e&&e.preventDefault(),this._isShown&&!this._isTransitioning){var n=p.Event(ln.HIDE);if(p(this._element).trigger(n),this._isShown&&!n.isDefaultPrevented()){this._isShown=!1;var i=p(this._element).hasClass(dn);if(i&&(this._isTransitioning=!0),this._setEscapeEvent(),this._setResizeEvent(),p(document).off(ln.FOCUSIN),p(this._element).removeClass(pn),p(this._element).off(ln.CLICK_DISMISS),p(this._dialog).off(ln.MOUSEDOWN_DISMISS),i){var o=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(e){return t._hideModal(e)}).emulateTransitionEnd(o)}else this._hideModal()}}},e.dispose=function(){[window,this._element,this._dialog].forEach(function(e){return p(e).off(on)}),p(document).off(ln.FOCUSIN),p.removeData(this._element,nn),this._config=null,this._element=null,this._dialog=null,this._backdrop=null,this._isShown=null,this._isBodyOverflowing=null,this._ignoreBackdropClick=null,this._isTransitioning=null,this._scrollbarWidth=null},e.handleUpdate=function(){this._adjustDialog()},e._getConfig=function(e){return e=l({},sn,{},e),m.typeCheckConfig(tn,e,an),e},e._triggerBackdropTransition=function(){var e=this;if("static"===this._config.backdrop){var t=p.Event(ln.HIDE_PREVENTED);if(p(this._element).trigger(t),t.defaultPrevented)return;this._element.classList.add(mn);var n=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,function(){e._element.classList.remove(mn)}).emulateTransitionEnd(n),this._element.focus()}else this.hide()},e._showElement=function(e){var t=this,n=p(this._element).hasClass(dn),i=this._dialog?this._dialog.querySelector(_n):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),p(this._dialog).hasClass(cn)&&i?i.scrollTop=0:this._element.scrollTop=0,n&&m.reflow(this._element),p(this._element).addClass(pn),this._config.focus&&this._enforceFocus();function o(){t._config.focus&&t._element.focus(),t._isTransitioning=!1,p(t._element).trigger(r)}var r=p.Event(ln.SHOWN,{relatedTarget:e});if(n){var s=m.getTransitionDurationFromElement(this._dialog);p(this._dialog).one(m.TRANSITION_END,o).emulateTransitionEnd(s)}else o()},e._enforceFocus=function(){var t=this;p(document).off(ln.FOCUSIN).on(ln.FOCUSIN,function(e){document!==e.target&&t._element!==e.target&&0===p(t._element).has(e.target).length&&t._element.focus()})},e._setEscapeEvent=function(){var t=this;this._isShown&&this._config.keyboard?p(this._element).on(ln.KEYDOWN_DISMISS,function(e){27===e.which&&t._triggerBackdropTransition()}):this._isShown||p(this._element).off(ln.KEYDOWN_DISMISS)},e._setResizeEvent=function(){var t=this;this._isShown?p(window).on(ln.RESIZE,function(e){return t.handleUpdate(e)}):p(window).off(ln.RESIZE)},e._hideModal=function(){var e=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._isTransitioning=!1,this._showBackdrop(function(){p(document.body).removeClass(fn),e._resetAdjustments(),e._resetScrollbar(),p(e._element).trigger(ln.HIDDEN)})},e._removeBackdrop=function(){this._backdrop&&(p(this._backdrop).remove(),this._backdrop=null)},e._showBackdrop=function(e){var t=this,n=p(this._element).hasClass(dn)?dn:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className=un,n&&this._backdrop.classList.add(n),p(this._backdrop).appendTo(document.body),p(this._element).on(ln.CLICK_DISMISS,function(e){t._ignoreBackdropClick?t._ignoreBackdropClick=!1:e.target===e.currentTarget&&t._triggerBackdropTransition()}),n&&m.reflow(this._backdrop),p(this._backdrop).addClass(pn),!e)return;if(!n)return void e();var i=m.getTransitionDurationFromElement(this._backdrop);p(this._backdrop).one(m.TRANSITION_END,e).emulateTransitionEnd(i)}else if(!this._isShown&&this._backdrop){p(this._backdrop).removeClass(pn);var o=function(){t._removeBackdrop(),e&&e()};if(p(this._element).hasClass(dn)){var r=m.getTransitionDurationFromElement(this._backdrop);p(this._backdrop).one(m.TRANSITION_END,o).emulateTransitionEnd(r)}else o()}else e&&e()},e._adjustDialog=function(){var e=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},e._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},e._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=e.left+e.right<window.innerWidth,this._scrollbarWidth=this._getScrollbarWidth()},e._setScrollbar=function(){var o=this;if(this._isBodyOverflowing){var e=[].slice.call(document.querySelectorAll(En)),t=[].slice.call(document.querySelectorAll(bn));p(e).each(function(e,t){var n=t.style.paddingRight,i=p(t).css("padding-right");p(t).data("padding-right",n).css("padding-right",parseFloat(i)+o._scrollbarWidth+"px")}),p(t).each(function(e,t){var n=t.style.marginRight,i=p(t).css("margin-right");p(t).data("margin-right",n).css("margin-right",parseFloat(i)-o._scrollbarWidth+"px")});var n=document.body.style.paddingRight,i=p(document.body).css("padding-right");p(document.body).data("padding-right",n).css("padding-right",parseFloat(i)+this._scrollbarWidth+"px")}p(document.body).addClass(fn)},e._resetScrollbar=function(){var e=[].slice.call(document.querySelectorAll(En));p(e).each(function(e,t){var n=p(t).data("padding-right");p(t).removeData("padding-right"),t.style.paddingRight=n||""});var t=[].slice.call(document.querySelectorAll(""+bn));p(t).each(function(e,t){var n=p(t).data("margin-right");"undefined"!=typeof n&&p(t).css("margin-right",n).removeData("margin-right")});var n=p(document.body).data("padding-right");p(document.body).removeData("padding-right"),document.body.style.paddingRight=n||""},e._getScrollbarWidth=function(){var e=document.createElement("div");e.className=hn,document.body.appendChild(e);var t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t},o._jQueryInterface=function(n,i){return this.each(function(){var e=p(this).data(nn),t=l({},sn,{},p(this).data(),{},"object"==typeof n&&n?n:{});if(e||(e=new o(this,t),p(this).data(nn,e)),"string"==typeof n){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n](i)}else t.show&&e.show(i)})},s(o,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return sn}}]),o}();p(document).on(ln.CLICK_DATA_API,vn,function(e){var t,n=this,i=m.getSelectorFromElement(this);i&&(t=document.querySelector(i));var o=p(t).data(nn)?"toggle":l({},p(t).data(),{},p(this).data());"A"!==this.tagName&&"AREA"!==this.tagName||e.preventDefault();var r=p(t).one(ln.SHOW,function(e){e.isDefaultPrevented()||r.one(ln.HIDDEN,function(){p(n).is(":visible")&&n.focus()})});wn._jQueryInterface.call(p(t),o,this)}),p.fn[tn]=wn._jQueryInterface,p.fn[tn].Constructor=wn,p.fn[tn].noConflict=function(){return p.fn[tn]=rn,wn._jQueryInterface};var Tn=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],Cn={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},Sn=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,Dn=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function In(e,r,t){if(0===e.length)return e;if(t&&"function"==typeof t)return t(e);for(var n=(new window.DOMParser).parseFromString(e,"text/html"),s=Object.keys(r),a=[].slice.call(n.body.querySelectorAll("*")),i=function(e){var t=a[e],n=t.nodeName.toLowerCase();if(-1===s.indexOf(t.nodeName.toLowerCase()))return t.parentNode.removeChild(t),"continue";var i=[].slice.call(t.attributes),o=[].concat(r["*"]||[],r[n]||[]);i.forEach(function(e){!function(e,t){var n=e.nodeName.toLowerCase();if(-1!==t.indexOf(n))return-1===Tn.indexOf(n)||Boolean(e.nodeValue.match(Sn)||e.nodeValue.match(Dn));for(var i=t.filter(function(e){return e instanceof RegExp}),o=0,r=i.length;o<r;o++)if(n.match(i[o]))return!0;return!1}(e,o)&&t.removeAttribute(e.nodeName)})},o=0,l=a.length;o<l;o++)i(o);return n.body.innerHTML}var An="tooltip",On="bs.tooltip",Nn="."+On,kn=p.fn[An],Ln="bs-tooltip",Pn=new RegExp("(^|\\s)"+Ln+"\\S+","g"),xn=["sanitize","whiteList","sanitizeFn"],jn={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object",popperConfig:"(null|object)"},Hn={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},Rn={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:Cn,popperConfig:null},Fn="show",Mn="out",Wn={HIDE:"hide"+Nn,HIDDEN:"hidden"+Nn,SHOW:"show"+Nn,SHOWN:"shown"+Nn,INSERTED:"inserted"+Nn,CLICK:"click"+Nn,FOCUSIN:"focusin"+Nn,FOCUSOUT:"focusout"+Nn,MOUSEENTER:"mouseenter"+Nn,MOUSELEAVE:"mouseleave"+Nn},Un="fade",Bn="show",qn=".tooltip-inner",Kn=".arrow",Qn="hover",Vn="focus",Yn="click",zn="manual",Xn=function(){function i(e,t){if("undefined"==typeof St)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=e,this.config=this._getConfig(t),this.tip=null,this._setListeners()}var e=i.prototype;return e.enable=function(){this._isEnabled=!0},e.disable=function(){this._isEnabled=!1},e.toggleEnabled=function(){this._isEnabled=!this._isEnabled},e.toggle=function(e){if(this._isEnabled)if(e){var t=this.constructor.DATA_KEY,n=p(e.currentTarget).data(t);n||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),p(e.currentTarget).data(t,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(p(this.getTipElement()).hasClass(Bn))return void this._leave(null,this);this._enter(null,this)}},e.dispose=function(){clearTimeout(this._timeout),p.removeData(this.element,this.constructor.DATA_KEY),p(this.element).off(this.constructor.EVENT_KEY),p(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&p(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},e.show=function(){var t=this;if("none"===p(this.element).css("display"))throw new Error("Please use show on visible elements");var e=p.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){p(this.element).trigger(e);var n=m.findShadowRoot(this.element),i=p.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(e.isDefaultPrevented()||!i)return;var o=this.getTipElement(),r=m.getUID(this.constructor.NAME);o.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&p(o).addClass(Un);var s="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,a=this._getAttachment(s);this.addAttachmentClass(a);var l=this._getContainer();p(o).data(this.constructor.DATA_KEY,this),p.contains(this.element.ownerDocument.documentElement,this.tip)||p(o).appendTo(l),p(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new St(this.element,o,this._getPopperConfig(a)),p(o).addClass(Bn),"ontouchstart"in document.documentElement&&p(document.body).children().on("mouseover",null,p.noop);var c=function(){t.config.animation&&t._fixTransition();var e=t._hoverState;t._hoverState=null,p(t.element).trigger(t.constructor.Event.SHOWN),e===Mn&&t._leave(null,t)};if(p(this.tip).hasClass(Un)){var h=m.getTransitionDurationFromElement(this.tip);p(this.tip).one(m.TRANSITION_END,c).emulateTransitionEnd(h)}else c()}},e.hide=function(e){function t(){n._hoverState!==Fn&&i.parentNode&&i.parentNode.removeChild(i),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),p(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),e&&e()}var n=this,i=this.getTipElement(),o=p.Event(this.constructor.Event.HIDE);if(p(this.element).trigger(o),!o.isDefaultPrevented()){if(p(i).removeClass(Bn),"ontouchstart"in document.documentElement&&p(document.body).children().off("mouseover",null,p.noop),this._activeTrigger[Yn]=!1,this._activeTrigger[Vn]=!1,this._activeTrigger[Qn]=!1,p(this.tip).hasClass(Un)){var r=m.getTransitionDurationFromElement(i);p(i).one(m.TRANSITION_END,t).emulateTransitionEnd(r)}else t();this._hoverState=""}},e.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},e.isWithContent=function(){return Boolean(this.getTitle())},e.addAttachmentClass=function(e){p(this.getTipElement()).addClass(Ln+"-"+e)},e.getTipElement=function(){return this.tip=this.tip||p(this.config.template)[0],this.tip},e.setContent=function(){var e=this.getTipElement();this.setElementContent(p(e.querySelectorAll(qn)),this.getTitle()),p(e).removeClass(Un+" "+Bn)},e.setElementContent=function(e,t){"object"!=typeof t||!t.nodeType&&!t.jquery?this.config.html?(this.config.sanitize&&(t=In(t,this.config.whiteList,this.config.sanitizeFn)),e.html(t)):e.text(t):this.config.html?p(t).parent().is(e)||e.empty().append(t):e.text(p(t).text())},e.getTitle=function(){var e=this.element.getAttribute("data-original-title");return e=e||("function"==typeof this.config.title?this.config.title.call(this.element):this.config.title)},e._getPopperConfig=function(e){var t=this;return l({},{placement:e,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:Kn},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(e){e.originalPlacement!==e.placement&&t._handlePopperPlacementChange(e)},onUpdate:function(e){return t._handlePopperPlacementChange(e)}},{},this.config.popperConfig)},e._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=l({},e.offsets,{},t.config.offset(e.offsets,t.element)||{}),e}:e.offset=this.config.offset,e},e._getContainer=function(){return!1===this.config.container?document.body:m.isElement(this.config.container)?p(this.config.container):p(document).find(this.config.container)},e._getAttachment=function(e){return Hn[e.toUpperCase()]},e._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(e){if("click"===e)p(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(e){return i.toggle(e)});else if(e!==zn){var t=e===Qn?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=e===Qn?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;p(i.element).on(t,i.config.selector,function(e){return i._enter(e)}).on(n,i.config.selector,function(e){return i._leave(e)})}}),this._hideModalHandler=function(){i.element&&i.hide()},p(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},e._fixTitle=function(){var e=typeof this.element.getAttribute("data-original-title");!this.element.getAttribute("title")&&"string"==e||(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},e._enter=function(e,t){var n=this.constructor.DATA_KEY;(t=t||p(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),p(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusin"===e.type?Vn:Qn]=!0),p(t.getTipElement()).hasClass(Bn)||t._hoverState===Fn?t._hoverState=Fn:(clearTimeout(t._timeout),t._hoverState=Fn,t.config.delay&&t.config.delay.show?t._timeout=setTimeout(function(){t._hoverState===Fn&&t.show()},t.config.delay.show):t.show())},e._leave=function(e,t){var n=this.constructor.DATA_KEY;(t=t||p(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),p(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusout"===e.type?Vn:Qn]=!1),t._isWithActiveTrigger()||(clearTimeout(t._timeout),t._hoverState=Mn,t.config.delay&&t.config.delay.hide?t._timeout=setTimeout(function(){t._hoverState===Mn&&t.hide()},t.config.delay.hide):t.hide())},e._isWithActiveTrigger=function(){for(var e in this._activeTrigger)if(this._activeTrigger[e])return!0;return!1},e._getConfig=function(e){var t=p(this.element).data();return Object.keys(t).forEach(function(e){-1!==xn.indexOf(e)&&delete t[e]}),"number"==typeof(e=l({},this.constructor.Default,{},t,{},"object"==typeof e&&e?e:{})).delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),m.typeCheckConfig(An,e,this.constructor.DefaultType),e.sanitize&&(e.template=In(e.template,e.whiteList,e.sanitizeFn)),e},e._getDelegateConfig=function(){var e={};if(this.config)for(var t in this.config)this.constructor.Default[t]!==this.config[t]&&(e[t]=this.config[t]);return e},e._cleanTipClass=function(){var e=p(this.getTipElement()),t=e.attr("class").match(Pn);null!==t&&t.length&&e.removeClass(t.join(""))},e._handlePopperPlacementChange=function(e){var t=e.instance;this.tip=t.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(e.placement))},e._fixTransition=function(){var e=this.getTipElement(),t=this.config.animation;null===e.getAttribute("x-placement")&&(p(e).removeClass(Un),this.config.animation=!1,this.hide(),this.show(),this.config.animation=t)},i._jQueryInterface=function(n){return this.each(function(){var e=p(this).data(On),t="object"==typeof n&&n;if((e||!/dispose|hide/.test(n))&&(e||(e=new i(this,t),p(this).data(On,e)),"string"==typeof n)){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return Rn}},{key:"NAME",get:function(){return An}},{key:"DATA_KEY",get:function(){return On}},{key:"Event",get:function(){return Wn}},{key:"EVENT_KEY",get:function(){return Nn}},{key:"DefaultType",get:function(){return jn}}]),i}();p.fn[An]=Xn._jQueryInterface,p.fn[An].Constructor=Xn,p.fn[An].noConflict=function(){return p.fn[An]=kn,Xn._jQueryInterface};var Gn="popover",$n="bs.popover",Jn="."+$n,Zn=p.fn[Gn],ei="bs-popover",ti=new RegExp("(^|\\s)"+ei+"\\S+","g"),ni=l({},Xn.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),ii=l({},Xn.DefaultType,{content:"(string|element|function)"}),oi="fade",ri="show",si=".popover-header",ai=".popover-body",li={HIDE:"hide"+Jn,HIDDEN:"hidden"+Jn,SHOW:"show"+Jn,SHOWN:"shown"+Jn,INSERTED:"inserted"+Jn,CLICK:"click"+Jn,FOCUSIN:"focusin"+Jn,FOCUSOUT:"focusout"+Jn,MOUSEENTER:"mouseenter"+Jn,MOUSELEAVE:"mouseleave"+Jn},ci=function(e){function i(){return e.apply(this,arguments)||this}!function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}(i,e);var t=i.prototype;return t.isWithContent=function(){return this.getTitle()||this._getContent()},t.addAttachmentClass=function(e){p(this.getTipElement()).addClass(ei+"-"+e)},t.getTipElement=function(){return this.tip=this.tip||p(this.config.template)[0],this.tip},t.setContent=function(){var e=p(this.getTipElement());this.setElementContent(e.find(si),this.getTitle());var t=this._getContent();"function"==typeof t&&(t=t.call(this.element)),this.setElementContent(e.find(ai),t),e.removeClass(oi+" "+ri)},t._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},t._cleanTipClass=function(){var e=p(this.getTipElement()),t=e.attr("class").match(ti);null!==t&&0<t.length&&e.removeClass(t.join(""))},i._jQueryInterface=function(n){return this.each(function(){var e=p(this).data($n),t="object"==typeof n?n:null;if((e||!/dispose|hide/.test(n))&&(e||(e=new i(this,t),p(this).data($n,e)),"string"==typeof n)){if("undefined"==typeof e[n])throw new TypeError('No method named "'+n+'"');e[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return ni}},{key:"NAME",get:function(){return Gn}},{key:"DATA_KEY",get:function(){return $n}},{key:"Event",get:function(){return li}},{key:"EVENT_KEY",get:function(){return Jn}},{key:"DefaultType",get:function(){return ii}}]),i}(Xn);p.fn[Gn]=ci._jQueryInterface,p.fn[Gn].Constructor=ci,p.fn[Gn].noConflict=function(){return p.fn[Gn]=Zn,ci._jQueryInterface};var hi="scrollspy",ui="bs.scrollspy",fi="."+ui,di=p.fn[hi],pi={offset:10,method:"auto",target:""},mi={offset:"number",method:"string",target:"(string|element)"},gi={ACTIVATE:"activate"+fi,SCROLL:"scroll"+fi,LOAD_DATA_API:"load"+fi+".data-api"},_i="dropdown-item",vi="active",yi='[data-spy="scroll"]',Ei=".nav, .list-group",bi=".nav-link",wi=".nav-item",Ti=".list-group-item",Ci=".dropdown",Si=".dropdown-item",Di=".dropdown-toggle",Ii="offset",Ai="position",Oi=function(){function n(e,t){var n=this;this._element=e,this._scrollElement="BODY"===e.tagName?window:e,this._config=this._getConfig(t),this._selector=this._config.target+" "+bi+","+this._config.target+" "+Ti+","+this._config.target+" "+Si,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,p(this._scrollElement).on(gi.SCROLL,function(e){return n._process(e)}),this.refresh(),this._process()}var e=n.prototype;return e.refresh=function(){var t=this,e=this._scrollElement===this._scrollElement.window?Ii:Ai,o="auto"===this._config.method?e:this._config.method,r=o===Ai?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map(function(e){var t,n=m.getSelectorFromElement(e);if(n&&(t=document.querySelector(n)),t){var i=t.getBoundingClientRect();if(i.width||i.height)return[p(t)[o]().top+r,n]}return null}).filter(function(e){return e}).sort(function(e,t){return e[0]-t[0]}).forEach(function(e){t._offsets.push(e[0]),t._targets.push(e[1])})},e.dispose=function(){p.removeData(this._element,ui),p(this._scrollElement).off(fi),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},e._getConfig=function(e){if("string"!=typeof(e=l({},pi,{},"object"==typeof e&&e?e:{})).target){var t=p(e.target).attr("id");t||(t=m.getUID(hi),p(e.target).attr("id",t)),e.target="#"+t}return m.typeCheckConfig(hi,e,mi),e},e._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},e._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},e._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},e._process=function(){var e=this._getScrollTop()+this._config.offset,t=this._getScrollHeight(),n=this._config.offset+t-this._getOffsetHeight();if(this._scrollHeight!==t&&this.refresh(),n<=e){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&e<this._offsets[0]&&0<this._offsets[0])return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;){this._activeTarget!==this._targets[o]&&e>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||e<this._offsets[o+1])&&this._activate(this._targets[o])}}},e._activate=function(t){this._activeTarget=t,this._clear();var e=this._selector.split(",").map(function(e){return e+'[data-target="'+t+'"],'+e+'[href="'+t+'"]'}),n=p([].slice.call(document.querySelectorAll(e.join(","))));n.hasClass(_i)?(n.closest(Ci).find(Di).addClass(vi),n.addClass(vi)):(n.addClass(vi),n.parents(Ei).prev(bi+", "+Ti).addClass(vi),n.parents(Ei).prev(wi).children(bi).addClass(vi)),p(this._scrollElement).trigger(gi.ACTIVATE,{relatedTarget:t})},e._clear=function(){[].slice.call(document.querySelectorAll(this._selector)).filter(function(e){return e.classList.contains(vi)}).forEach(function(e){return e.classList.remove(vi)})},n._jQueryInterface=function(t){return this.each(function(){var e=p(this).data(ui);if(e||(e=new n(this,"object"==typeof t&&t),p(this).data(ui,e)),"string"==typeof t){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}})},s(n,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"Default",get:function(){return pi}}]),n}();p(window).on(gi.LOAD_DATA_API,function(){for(var e=[].slice.call(document.querySelectorAll(yi)),t=e.length;t--;){var n=p(e[t]);Oi._jQueryInterface.call(n,n.data())}}),p.fn[hi]=Oi._jQueryInterface,p.fn[hi].Constructor=Oi,p.fn[hi].noConflict=function(){return p.fn[hi]=di,Oi._jQueryInterface};var Ni="bs.tab",ki="."+Ni,Li=p.fn.tab,Pi={HIDE:"hide"+ki,HIDDEN:"hidden"+ki,SHOW:"show"+ki,SHOWN:"shown"+ki,CLICK_DATA_API:"click"+ki+".data-api"},xi="dropdown-menu",ji="active",Hi="disabled",Ri="fade",Fi="show",Mi=".dropdown",Wi=".nav, .list-group",Ui=".active",Bi="> li > .active",qi='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',Ki=".dropdown-toggle",Qi="> .dropdown-menu .active",Vi=function(){function i(e){this._element=e}var e=i.prototype;return e.show=function(){var n=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&p(this._element).hasClass(ji)||p(this._element).hasClass(Hi))){var e,i,t=p(this._element).closest(Wi)[0],o=m.getSelectorFromElement(this._element);if(t){var r="UL"===t.nodeName||"OL"===t.nodeName?Bi:Ui;i=(i=p.makeArray(p(t).find(r)))[i.length-1]}var s=p.Event(Pi.HIDE,{relatedTarget:this._element}),a=p.Event(Pi.SHOW,{relatedTarget:i});if(i&&p(i).trigger(s),p(this._element).trigger(a),!a.isDefaultPrevented()&&!s.isDefaultPrevented()){o&&(e=document.querySelector(o)),this._activate(this._element,t);var l=function(){var e=p.Event(Pi.HIDDEN,{relatedTarget:n._element}),t=p.Event(Pi.SHOWN,{relatedTarget:i});p(i).trigger(e),p(n._element).trigger(t)};e?this._activate(e,e.parentNode,l):l()}}},e.dispose=function(){p.removeData(this._element,Ni),this._element=null},e._activate=function(e,t,n){function i(){return o._transitionComplete(e,r,n)}var o=this,r=(!t||"UL"!==t.nodeName&&"OL"!==t.nodeName?p(t).children(Ui):p(t).find(Bi))[0],s=n&&r&&p(r).hasClass(Ri);if(r&&s){var a=m.getTransitionDurationFromElement(r);p(r).removeClass(Fi).one(m.TRANSITION_END,i).emulateTransitionEnd(a)}else i()},e._transitionComplete=function(e,t,n){if(t){p(t).removeClass(ji);var i=p(t.parentNode).find(Qi)[0];i&&p(i).removeClass(ji),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!1)}if(p(e).addClass(ji),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!0),m.reflow(e),e.classList.contains(Ri)&&e.classList.add(Fi),e.parentNode&&p(e.parentNode).hasClass(xi)){var o=p(e).closest(Mi)[0];if(o){var r=[].slice.call(o.querySelectorAll(Ki));p(r).addClass(ji)}e.setAttribute("aria-expanded",!0)}n&&n()},i._jQueryInterface=function(n){return this.each(function(){var e=p(this),t=e.data(Ni);if(t||(t=new i(this),e.data(Ni,t)),"string"==typeof n){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}}]),i}();p(document).on(Pi.CLICK_DATA_API,qi,function(e){e.preventDefault(),Vi._jQueryInterface.call(p(this),"show")}),p.fn.tab=Vi._jQueryInterface,p.fn.tab.Constructor=Vi,p.fn.tab.noConflict=function(){return p.fn.tab=Li,Vi._jQueryInterface};var Yi="toast",zi="bs.toast",Xi="."+zi,Gi=p.fn[Yi],$i={CLICK_DISMISS:"click.dismiss"+Xi,HIDE:"hide"+Xi,HIDDEN:"hidden"+Xi,SHOW:"show"+Xi,SHOWN:"shown"+Xi},Ji="fade",Zi="hide",eo="show",to="showing",no={animation:"boolean",autohide:"boolean",delay:"number"},io={animation:!0,autohide:!0,delay:500},oo='[data-dismiss="toast"]',ro=function(){function i(e,t){this._element=e,this._config=this._getConfig(t),this._timeout=null,this._setListeners()}var e=i.prototype;return e.show=function(){var e=this,t=p.Event($i.SHOW);if(p(this._element).trigger(t),!t.isDefaultPrevented()){this._config.animation&&this._element.classList.add(Ji);var n=function(){e._element.classList.remove(to),e._element.classList.add(eo),p(e._element).trigger($i.SHOWN),e._config.autohide&&(e._timeout=setTimeout(function(){e.hide()},e._config.delay))};if(this._element.classList.remove(Zi),m.reflow(this._element),this._element.classList.add(to),this._config.animation){var i=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,n).emulateTransitionEnd(i)}else n()}},e.hide=function(){if(this._element.classList.contains(eo)){var e=p.Event($i.HIDE);p(this._element).trigger(e),e.isDefaultPrevented()||this._close()}},e.dispose=function(){clearTimeout(this._timeout),this._timeout=null,this._element.classList.contains(eo)&&this._element.classList.remove(eo),p(this._element).off($i.CLICK_DISMISS),p.removeData(this._element,zi),this._element=null,this._config=null},e._getConfig=function(e){return e=l({},io,{},p(this._element).data(),{},"object"==typeof e&&e?e:{}),m.typeCheckConfig(Yi,e,this.constructor.DefaultType),e},e._setListeners=function(){var e=this;p(this._element).on($i.CLICK_DISMISS,oo,function(){return e.hide()})},e._close=function(){function e(){t._element.classList.add(Zi),p(t._element).trigger($i.HIDDEN)}var t=this;if(this._element.classList.remove(eo),this._config.animation){var n=m.getTransitionDurationFromElement(this._element);p(this._element).one(m.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},i._jQueryInterface=function(n){return this.each(function(){var e=p(this),t=e.data(zi);if(t||(t=new i(this,"object"==typeof n&&n),e.data(zi,t)),"string"==typeof n){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n](this)}})},s(i,null,[{key:"VERSION",get:function(){return"4.4.1"}},{key:"DefaultType",get:function(){return no}},{key:"Default",get:function(){return io}}]),i}();p.fn[Yi]=ro._jQueryInterface,p.fn[Yi].Constructor=ro,p.fn[Yi].noConflict=function(){return p.fn[Yi]=Gi,ro._jQueryInterface},e.Alert=_,e.Button=x,e.Carousel=he,e.Collapse=De,e.Dropdown=en,e.Modal=wn,e.Popover=ci,e.Scrollspy=Oi,e.Tab=Vi,e.Toast=ro,e.Tooltip=Xn,e.Util=m,Object.defineProperty(e,"__esModule",{value:!0})});
 
assets/css/front.css CHANGED
@@ -775,15 +775,7 @@
775
  .w3eden label.error.valid {
776
  display: none;
777
  }
778
- .w3eden #wpdm-featured-image {
779
- display: block;
780
- height: 200px;
781
- border: 2px dashed #ddd;
782
- margin: 15px;
783
- background: url(../images/plus.svg) no-repeat center center;
784
- background-size: 48px;
785
- text-indent: -999999px;
786
- }
787
  .w3eden label.error.valid {
788
  display: none !important;
789
  }
775
  .w3eden label.error.valid {
776
  display: none;
777
  }
778
+
 
 
 
 
 
 
 
 
779
  .w3eden label.error.valid {
780
  display: none !important;
781
  }
assets/css/front3.css CHANGED
@@ -755,15 +755,7 @@
755
  .w3eden label.error.valid {
756
  display: none;
757
  }
758
- .w3eden #wpdm-featured-image {
759
- display: block;
760
- width: 100%;
761
- height: 200px;
762
- border: 2px dashed #ddd;
763
- background: url(../images/plus.svg) no-repeat center center;
764
- background-size: 48px;
765
- text-indent: -999999px;
766
- }
767
  .w3eden label.error.valid {
768
  display: none !important;
769
  }
755
  .w3eden label.error.valid {
756
  display: none;
757
  }
758
+
 
 
 
 
 
 
 
 
759
  .w3eden label.error.valid {
760
  display: none !important;
761
  }
assets/images/plus.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="256" x2="256" y1="512" y2="-9.094947e-013"><stop offset="0" style="stop-color:#76B852"/><stop offset="1" style="stop-color:#8DC26F"/></linearGradient><circle cx="256" cy="256" fill="url(#SVGID_1_)" r="256"/><path d="M381.7,244.2H267.8V130.3c0-6.5-5.3-11.8-11.8-11.8c-6.5,0-11.8,5.3-11.8,11.8v113.9H130.3 c-6.5,0-11.8,5.3-11.8,11.8s5.3,11.8,11.8,11.8h113.9v113.9c0,6.5,5.3,11.8,11.8,11.8c6.5,0,11.8-5.3,11.8-11.8V267.8h113.9 c6.5,0,11.8-5.3,11.8-11.8S388.2,244.2,381.7,244.2z" fill="#FFFFFF"/></svg>
download-manager.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Download Manager
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
- Version: 3.1.08
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
@@ -106,7 +106,7 @@ class WordPressDownloadManager{
106
 
107
  function __construct(){
108
 
109
- define('WPDM_Version','3.1.08');
110
 
111
  register_activation_hook(__FILE__, array($this, 'Install'));
112
 
@@ -119,7 +119,7 @@ class WordPressDownloadManager{
119
  add_action( 'wp_head', array($this, 'wpHead') );
120
  add_action( 'wp_footer', array($this, 'wpFooter') );
121
 
122
- spl_autoload_register( array( $this, 'AutoLoad' ) );
123
 
124
  include_once(dirname(__FILE__) . "/wpdm-functions.php");
125
 
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
+ Version: 3.1.11
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
106
 
107
  function __construct(){
108
 
109
+ define('WPDM_Version','3.1.11');
110
 
111
  register_activation_hook(__FILE__, array($this, 'Install'));
112
 
119
  add_action( 'wp_head', array($this, 'wpHead') );
120
  add_action( 'wp_footer', array($this, 'wpFooter') );
121
 
122
+ spl_autoload_register( array( $this, 'autoLoad' ) );
123
 
124
  include_once(dirname(__FILE__) . "/wpdm-functions.php");
125
 
libs/class.Apply.php CHANGED
@@ -144,7 +144,7 @@ class Apply {
144
  global $wp_query, $post, $wpdb;
145
  if (!isset($_POST['wpdm_login'])) return;
146
 
147
- $shortcode_params = (array)Crypt::decrypt(wpdm_query_var('__phash'));
148
 
149
  $login_try = (int)Session::get('login_try');
150
  $login_try++;
@@ -222,7 +222,7 @@ class Apply {
222
  if (!isset($_POST['wpdm_reg'])) return;
223
 
224
 
225
- $shortcode_params = (array)Crypt::decrypt(wpdm_query_var('__phash'));
226
 
227
  if (!is_array($shortcode_params)) $shortcode_params = array();
228
 
144
  global $wp_query, $post, $wpdb;
145
  if (!isset($_POST['wpdm_login'])) return;
146
 
147
+ $shortcode_params = Crypt::decrypt(wpdm_query_var('__phash'), true);
148
 
149
  $login_try = (int)Session::get('login_try');
150
  $login_try++;
222
  if (!isset($_POST['wpdm_reg'])) return;
223
 
224
 
225
+ $shortcode_params = Crypt::decrypt(wpdm_query_var('__phash'), true);
226
 
227
  if (!is_array($shortcode_params)) $shortcode_params = array();
228
 
libs/class.AssetManager.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Asset Manager for WordPress Download Manager
4
  Author: Shahjada
5
- Version: 1.0.0
6
  */
7
 
8
  namespace WPDM;
@@ -28,7 +28,7 @@ if(!class_exists('AssetManager')):
28
 
29
  public static function root($path = ''){
30
  global $current_user;
31
- $root = current_user_can('manage_options')?rtrim(get_option('_wpdm_file_browser_root'), '/').'/' : UPLOAD_DIR . $current_user->user_login . '/';
32
  $_root = str_replace("\\", "/", $root);
33
  if($path !== '') $root .= $path;
34
  $root = realpath($root);
@@ -498,7 +498,7 @@ if(!class_exists('AssetManager')):
498
  $reldest = Crypt::decrypt(wpdm_query_var('zipdest'));
499
  if($reldest == '') $reldest = dirname($zipfile);
500
  $zipdest = AssetManager::root($reldest);
501
- if(!current_user_can('manage_options')) wp_send_json(array('success' => false, 'message' => __( "Error! Only Administrator can execute this operation.", "download-manager" )));
502
  if(!$zipfile || !stristr($zipfile, '.zip')) wp_send_json(array('success' => false, 'message' => __( "Error! Unauthorized Path.", "download-manager" )));
503
  if(!$zipdest) wp_send_json(array('success' => false, 'message' => __( "Error! Invalid Destination Path.", "download-manager" )));
504
  if(!class_exists('\ZipArchive')) wp_send_json(array('success' => false, 'message' => __('Please activate "zlib" in your server to perform zip operations','download-manager')));
2
  /*
3
  Asset Manager for WordPress Download Manager
4
  Author: Shahjada
5
+ Version: 1.1.0
6
  */
7
 
8
  namespace WPDM;
28
 
29
  public static function root($path = ''){
30
  global $current_user;
31
+ $root = current_user_can(WPDM_ADMIN_CAP)?rtrim(get_option('_wpdm_file_browser_root'), '/').'/' : UPLOAD_DIR . $current_user->user_login . '/';
32
  $_root = str_replace("\\", "/", $root);
33
  if($path !== '') $root .= $path;
34
  $root = realpath($root);
498
  $reldest = Crypt::decrypt(wpdm_query_var('zipdest'));
499
  if($reldest == '') $reldest = dirname($zipfile);
500
  $zipdest = AssetManager::root($reldest);
501
+ if(!current_user_can(WPDM_ADMIN_CAP)) wp_send_json(array('success' => false, 'message' => __( "Error! Only Administrator can execute this operation.", "download-manager" )));
502
  if(!$zipfile || !stristr($zipfile, '.zip')) wp_send_json(array('success' => false, 'message' => __( "Error! Unauthorized Path.", "download-manager" )));
503
  if(!$zipdest) wp_send_json(array('success' => false, 'message' => __( "Error! Invalid Destination Path.", "download-manager" )));
504
  if(!class_exists('\ZipArchive')) wp_send_json(array('success' => false, 'message' => __('Please activate "zlib" in your server to perform zip operations','download-manager')));
libs/class.CategoryHandler.php CHANGED
@@ -337,7 +337,7 @@ class CategoryHandler
337
  $efs = '</fieldset>';
338
  }
339
  }
340
-
341
  if (!isset($paging) || intval($paging) == 1) {
342
  $pag_links = wpdm_paginate_links($total, $items_per_page, $page, $cpvar, array('container' => '#content_' . $scid, 'async' => (isset($async) && $async == 1 ? 1 : 0), 'next_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-top: 2px solid;transform: rotate(45deg);margin-left: -2px;margin-top: -2px;"></i> ', 'prev_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-bottom: 2px solid;transform: rotate(135deg);margin-left: 2px;margin-top: -2px;"></i> '));
343
  $pagination = "<div style='clear:both'></div>" . $pag_links . "<div style='clear:both'></div>";
337
  $efs = '</fieldset>';
338
  }
339
  }
340
+ $pagination = "";
341
  if (!isset($paging) || intval($paging) == 1) {
342
  $pag_links = wpdm_paginate_links($total, $items_per_page, $page, $cpvar, array('container' => '#content_' . $scid, 'async' => (isset($async) && $async == 1 ? 1 : 0), 'next_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-top: 2px solid;transform: rotate(45deg);margin-left: -2px;margin-top: -2px;"></i> ', 'prev_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-bottom: 2px solid;transform: rotate(135deg);margin-left: 2px;margin-top: -2px;"></i> '));
343
  $pagination = "<div style='clear:both'></div>" . $pag_links . "<div style='clear:both'></div>";
libs/class.Crypt.php CHANGED
@@ -37,7 +37,7 @@ class Crypt
37
  return $ciphertext;
38
  }
39
 
40
- public static function decrypt($ciphertext)
41
  {
42
  if($ciphertext === '') return $ciphertext;
43
  if(defined('SECURE_AUTH_KEY'))
@@ -57,8 +57,9 @@ class Crypt
57
  if (hash_equals($hmac, $calcmac)) //PHP 5.6+ timing attack safe comparison
58
  {
59
  $original_plaintext = trim($original_plaintext);
60
- $unjsoned_plaintext = json_decode($original_plaintext);
61
- return is_object($unjsoned_plaintext) || is_array($unjsoned_plaintext) ? $unjsoned_plaintext : $original_plaintext;
 
62
  }
63
  } catch (\Exception $e){
64
  return '';
37
  return $ciphertext;
38
  }
39
 
40
+ public static function decrypt($ciphertext, $ARRAY = false)
41
  {
42
  if($ciphertext === '') return $ciphertext;
43
  if(defined('SECURE_AUTH_KEY'))
57
  if (hash_equals($hmac, $calcmac)) //PHP 5.6+ timing attack safe comparison
58
  {
59
  $original_plaintext = trim($original_plaintext);
60
+ $unjsoned_plaintext = json_decode($original_plaintext, $ARRAY);
61
+ $original_plaintext = is_object($unjsoned_plaintext) || is_array($unjsoned_plaintext) ? $unjsoned_plaintext : $original_plaintext;
62
+ return $original_plaintext;
63
  }
64
  } catch (\Exception $e){
65
  return '';
libs/class.Email.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Email Handler Class for WordPress Download Manager Pro
4
  * Since: v4.6.0
5
  * Author: Shahjada
6
  */
@@ -8,6 +8,29 @@ namespace WPDM;
8
 
9
  class Email {
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  function __construct() {
12
 
13
  }
@@ -43,7 +66,7 @@ class Email {
43
  'from_name' => get_option( 'blogname' ),
44
  'from_email' => $admin_email,
45
  'to_email' => $admin_email,
46
- 'message' => __( "New user registration on your site WordPress Download Manager:" , "download-manager" ).'<hr/>Username: [#username#]<br/>Email: [#email#]<br/>IP: [#user_ip#]<hr/>[edit_user_btn]<br/><br/>Best Regards,<br/>Support Team<br/><b><a href="[#homeurl#]">[#sitename#]</a></b>'
47
  )
48
  ),
49
  'password-reset' => array(
@@ -66,7 +89,17 @@ class Email {
66
  'message' => 'Thanks for Subscribing to [#sitename#]<br/>Please click on following link to start download:<br/><b><a style="display: block;text-align: center" class="button" href="[#download_url#]">Download</a></b><br/><br/><br/>Best Regards,<br/>Support Team<br/><b>[#sitename#]</b>'
67
  )
68
  ),
69
-
 
 
 
 
 
 
 
 
 
 
70
  );
71
 
72
  $templates = apply_filters( 'wpdm_email_templates', $templates );
@@ -77,8 +110,7 @@ class Email {
77
 
78
  public static function info( $id ) {
79
  $templates = self::templates();
80
-
81
- return $templates[ $id ];
82
  }
83
 
84
  public static function tags() {
@@ -110,13 +142,25 @@ class Email {
110
  "[#edit_url#]" => array( 'value' => '', 'desc' => 'Package Edit URL' )
111
  );
112
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  return apply_filters( "wpdm_email_template_tags", $tags );
114
  }
115
 
116
  public static function defaultTemplate( $id ) {
117
  $templates = self::templates();
118
 
119
- return $templates[ $id ]['default'];
120
  }
121
 
122
  public static function template( $id ) {
@@ -139,8 +183,8 @@ class Email {
139
 
140
  $__wpdm_email_setting = maybe_unserialize( get_option( '__wpdm_email_setting', array() ) );
141
  $params = $params + $__wpdm_email_setting;
142
- $logo = esc_url($params['logo']);
143
- $banner = esc_url($params['banner']);
144
  $params['img_logo'] = isset( $params['logo'] ) && $params['logo'] != '' ? "<img style='max-width: 70%' src='{$logo}' alt='".esc_attr(get_option('blogname'))."' />" : "";
145
  $params['banner'] = isset( $params['banner'] ) && $params['banner'] != '' ? esc_url($params['banner']) : "";
146
  $params['banner_img'] = isset( $params['banner'] ) && $params['banner'] != '' ? "<img style='max-width: 100%;' src='{$banner}' alt='Banner Image' />" : "";
@@ -170,8 +214,9 @@ class Email {
170
  }
171
 
172
  $template['subject'] = str_replace( array_keys( $params ), array_values( $params ), $template['subject'] );
 
173
  $template['message'] = str_replace( array_keys( $params ), array_values( $params ), $template['message'] );
174
-
175
  return $template;
176
  }
177
 
@@ -180,7 +225,10 @@ class Email {
180
  $template = self::prepare( $id, $params );
181
  $headers[] = "From: " . $template['from_name'] . " <" . $template['from_email'] . ">";
182
  $headers[] = "Content-type: text/html";
183
- $to = $email['for'] !== 'admin' && !isset($params['to_seller']) ? $params['to_email'] : $template['to_email'];
 
 
 
184
  $headers = apply_filters( "wpdm_email_headers_" . str_replace("-", "_", $id), $headers );
185
  if(isset($params['cc'])){
186
  $headers[] = "CC: {$params['cc']}";
@@ -191,7 +239,7 @@ class Email {
191
  unset($params['bcc']);
192
  }
193
  $attachments = apply_filters( "wpdm_email_attachments_" . str_replace("-", "_", $id), array(), $params );
194
- return wp_mail( $to, $template['subject'], $template['message'], $headers, $attachments );
195
  }
196
 
197
 
@@ -216,7 +264,7 @@ class Email {
216
  );
217
 
218
  if ( isset( $_REQUEST['etmpl'] ) ) {
219
- $params['template_file'] = wpdm_query_var('etmpl');
220
  }
221
  $template = self::prepare( $id, $params );
222
  echo $template['message'];
@@ -230,15 +278,63 @@ class Email {
230
  die( 'Error' );
231
  }
232
 
233
-
234
-
235
- $params['message'] = $message;
236
  $params['template_file'] = $template;
237
 
238
  $template = self::prepare( 'default', $params );
239
  return $template['message'];
240
  }
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
 
243
  }
244
 
1
  <?php
2
  /**
3
+ * Email Handler Class for WordPress Download Manager
4
  * Since: v4.6.0
5
  * Author: Shahjada
6
  */
8
 
9
  class Email {
10
 
11
+ var $email_hooks = [
12
+ 'wpdm_before_email_download_link' => [
13
+ 'title' => 'Before email download link',
14
+ 'params' => 2
15
+ ],
16
+ 'wpdm_onstart_download' => [
17
+ 'title' => 'Just before download starts',
18
+ 'params' => 1
19
+ ],
20
+ 'create_package_frontend' => [
21
+ 'title' => 'Create new package from front-end',
22
+ 'params' => 2
23
+ ],
24
+ 'edit_package_frontend' => [
25
+ 'title' => 'Update a package from frontend',
26
+ 'params' => 2
27
+ ],
28
+ 'wpdm_after_checkout' => [
29
+ 'title' => 'After a successful checkout',
30
+ 'params' => 2
31
+ ],
32
+ ];
33
+
34
  function __construct() {
35
 
36
  }
66
  'from_name' => get_option( 'blogname' ),
67
  'from_email' => $admin_email,
68
  'to_email' => $admin_email,
69
+ 'message' => __( "New user registration on your site WordPress Download Manager:" , "download-manager" ).'<hr/>Username: [#username#]<br/>Email: [#email#]<br/>IP: [#user_ip#]<hr/>[#edit_user_btn#]<br/><br/>Best Regards,<br/>Support Team<br/><b><a href="[#homeurl#]">[#sitename#]</a></b>'
70
  )
71
  ),
72
  'password-reset' => array(
89
  'message' => 'Thanks for Subscribing to [#sitename#]<br/>Please click on following link to start download:<br/><b><a style="display: block;text-align: center" class="button" href="[#download_url#]">Download</a></b><br/><br/><br/>Best Regards,<br/>Support Team<br/><b>[#sitename#]</b>'
90
  )
91
  ),
92
+ 'new-package-frontend' => array(
93
+ 'label' => __( "New Package Notification" , "download-manager" ),
94
+ 'for' => 'admin',
95
+ 'default' => array(
96
+ 'subject' => __( "New Package is Added By [#name#]" , "download-manager" ),
97
+ 'from_name' => get_option( 'blogname' ),
98
+ 'from_email' => $admin_email,
99
+ 'to_email' => $admin_email,
100
+ 'message' => 'A new package is added<br/><br/><table style="width: 100%" cellpadding="10px"><tr><td width="120px">Package Name:</td><td>[#package_name#]</td></tr><tr><td width="120px">Added By:</td><td>[#author#]</td></tr><tr><td width="120px"></td><td><div style="padding-top: 10px;"><a class="btn" href="[#edit_url#]">Review The Package</a></div></td></tr></table>'
101
+ )
102
+ ),
103
  );
104
 
105
  $templates = apply_filters( 'wpdm_email_templates', $templates );
110
 
111
  public static function info( $id ) {
112
  $templates = self::templates();
113
+ return isset($templates[ $id ]) ? $templates[ $id ] : null;
 
114
  }
115
 
116
  public static function tags() {
142
  "[#edit_url#]" => array( 'value' => '', 'desc' => 'Package Edit URL' )
143
  );
144
 
145
+ $tags["[#client_ip#]"] = ['value' => wpdm_get_client_ip(), 'desc' => 'User IP'];
146
+
147
+ if(is_user_logged_in()) {
148
+ global $current_user;
149
+ $tags["[#user_login#]"] = ['value' => $current_user->user_login, 'desc' => 'User login'];
150
+ $tags["[#user_email#]"] = ['value' => $current_user->user_email, 'desc' => 'User email'];
151
+ $tags["[#user_first_name#]"] = ['value' => $current_user->user_firstname, 'desc' => 'User first name'];
152
+ $tags["[#user_last_name#]"] = ['value' => $current_user->user_lastname, 'desc' => 'User last name'];
153
+ $tags["[#user_display_name#]"] = ['value' => $current_user->display_name, 'desc' => 'User display name'];
154
+ $tags["[#user_description#]"] = ['value' => get_user_meta($current_user->ID, 'description', true), 'desc' => 'User display name'];
155
+ }
156
+
157
  return apply_filters( "wpdm_email_template_tags", $tags );
158
  }
159
 
160
  public static function defaultTemplate( $id ) {
161
  $templates = self::templates();
162
 
163
+ return isset($templates[ $id ], $templates[ $id ]['default']) ? $templates[ $id ]['default'] : null;
164
  }
165
 
166
  public static function template( $id ) {
183
 
184
  $__wpdm_email_setting = maybe_unserialize( get_option( '__wpdm_email_setting', array() ) );
185
  $params = $params + $__wpdm_email_setting;
186
+ $logo = isset($params['logo']) ? esc_url($params['logo']) : '';
187
+ $banner = isset($params['banner']) ? esc_url($params['banner']) : '';
188
  $params['img_logo'] = isset( $params['logo'] ) && $params['logo'] != '' ? "<img style='max-width: 70%' src='{$logo}' alt='".esc_attr(get_option('blogname'))."' />" : "";
189
  $params['banner'] = isset( $params['banner'] ) && $params['banner'] != '' ? esc_url($params['banner']) : "";
190
  $params['banner_img'] = isset( $params['banner'] ) && $params['banner'] != '' ? "<img style='max-width: 100%;' src='{$banner}' alt='Banner Image' />" : "";
214
  }
215
 
216
  $template['subject'] = str_replace( array_keys( $params ), array_values( $params ), $template['subject'] );
217
+ $template['to_email'] = str_replace( array_keys( $params ), array_values( $params ), $template['to_email'] );
218
  $template['message'] = str_replace( array_keys( $params ), array_values( $params ), $template['message'] );
219
+ $template['message'] = self::compile($template['message']);
220
  return $template;
221
  }
222
 
225
  $template = self::prepare( $id, $params );
226
  $headers[] = "From: " . $template['from_name'] . " <" . $template['from_email'] . ">";
227
  $headers[] = "Content-type: text/html";
228
+ if(!isset($template['to_email'])) {
229
+ $template['to_email'] = get_option('admin_email');
230
+ }
231
+ $to = $email['for'] !== 'admin' && !isset($params['to_seller']) && isset($params['to_email']) ? $params['to_email'] : $template['to_email'];
232
  $headers = apply_filters( "wpdm_email_headers_" . str_replace("-", "_", $id), $headers );
233
  if(isset($params['cc'])){
234
  $headers[] = "CC: {$params['cc']}";
239
  unset($params['bcc']);
240
  }
241
  $attachments = apply_filters( "wpdm_email_attachments_" . str_replace("-", "_", $id), array(), $params );
242
+ return wp_mail( $to, html_entity_decode($template['subject']), $template['message'], $headers, $attachments );
243
  }
244
 
245
 
264
  );
265
 
266
  if ( isset( $_REQUEST['etmpl'] ) ) {
267
+ $params['template_file'] = $_REQUEST['etmpl'];
268
  }
269
  $template = self::prepare( $id, $params );
270
  echo $template['message'];
278
  die( 'Error' );
279
  }
280
 
 
 
 
281
  $params['template_file'] = $template;
282
 
283
  $template = self::prepare( 'default', $params );
284
  return $template['message'];
285
  }
286
 
287
+ static function compile($template, $rule = "/\[\#(.*)\#\]/")
288
+ {
289
+ $compiled = preg_replace_callback($rule, [new self, '_var'], $template);
290
+ return $compiled;
291
+ }
292
+
293
+ static function _var($matched)
294
+ {
295
+ if(substr_count($matched[1], "acfx_user_meta_")){
296
+ $meta_name = str_replace("acfx_user_meta_", "", $matched[1]);
297
+ $meta_value = get_field($meta_name, 'user_'.get_current_user_id());
298
+ return $meta_value;
299
+ }
300
+ if(substr_count($matched[1], "acf_user_meta_")){
301
+ $meta_name = str_replace("acf_user_meta_", "", $matched[1]);
302
+ $data = maybe_unserialize(get_user_meta(get_current_user_id(), 'wpdm_cregf', true));
303
+ $value = wpdm_valueof($data, $meta_name);
304
+ if(is_array($value)) $value = implode(", ", $value);
305
+ return $value;
306
+ }
307
+ if(substr_count($matched[1], "user_meta_")){
308
+ $meta_name = str_replace("user_meta_", "", $matched[1]);
309
+ if(substr_count($meta_name, '/')){
310
+ $meta_name = explode("/", $meta_name);
311
+ $meta_value = get_user_meta(get_current_user_id(), $meta_name[0], true);
312
+ array_shift($meta_name);
313
+ $meta_value = wpdm_valueof($meta_value, implode("/", $meta_name));
314
+ return $meta_value;
315
+ }
316
+ return get_user_meta(get_current_user_id(), $meta_name, true);
317
+ }
318
+ if(substr_count($matched[1], "SERVER_")){
319
+ $meta_name = str_replace("SERVER_", "", $matched[1]);
320
+ if(substr_count($meta_name, '/')){
321
+ $meta_name = explode("/", $meta_name);
322
+ $meta_value = get_user_meta(get_current_user_id(), $meta_name[0], true);
323
+ array_shift($meta_name);
324
+ $meta_value = wpdm_valueof($meta_value, implode("/", $meta_name));
325
+ return $meta_value;
326
+ }
327
+ return get_user_meta(get_current_user_id(), $meta_name, true);
328
+ }
329
+ if(substr_count($matched[1], "REQUEST_")){
330
+ $meta_name = str_replace("REQUEST_", "", $matched[1]);
331
+ $meta_value = wpdm_valueof($_REQUEST, $meta_name);
332
+ if(is_array($meta_value)) $meta_value = implode(", ", $meta_value);
333
+ return $meta_value;
334
+ }
335
+ return $matched[1];
336
+ }
337
+
338
 
339
  }
340
 
libs/class.Package.php CHANGED
@@ -1075,7 +1075,6 @@ class Package {
1075
  preg_match_all("/\[cf ([^\]]+)\]/", $template, $cfmatches);
1076
  preg_match_all("/\[thumb_([0-9]+)x([0-9]+)\]/", $template, $matches);
1077
  preg_match_all("/\[thumb_url_([0-9]+)x([0-9]+)\]/", $template, $umatches);
1078
- preg_match_all("/\[thumb_gallery_([0-9]+)x([0-9]+)\]/", $template, $gmatches);
1079
  preg_match_all("/\[excerpt_([0-9]+)\]/", $template, $xmatches);
1080
  preg_match_all("/\[pdf_thumb_([0-9]+)x([0-9]+)\]/", $template, $pmatches);
1081
  preg_match_all("/\[txt=([^\]]+)\]/", $template, $txtmatches);
@@ -1132,12 +1131,6 @@ class Package {
1132
  $values[] = $vars['preview'] != '' ? wpdm_dynamic_thumb($vars['preview'], array($umatches[1][$nd], $umatches[2][$nd])) : '';
1133
  }
1134
 
1135
- foreach ($gmatches[0] as $nd => $scode) {
1136
- $keys[] = $scode;
1137
- $values[] = wpdm_get_additional_preview_images($vars, $gmatches[1][$nd], $gmatches[2][$nd]);
1138
- }
1139
-
1140
-
1141
  foreach ($xmatches[0] as $nd => $scode) {
1142
  $keys[] = $scode;
1143
  $ss = substr(strip_tags($vars['description']), 0, intval($xmatches[1][$nd]));
@@ -1147,9 +1140,6 @@ class Package {
1147
  $values[] = $ss . '...';
1148
  }
1149
 
1150
- if ($type == 'page' && (strpos($template, '[similar_downloads]') || strpos($vars['description'], '[similar_downloads]')))
1151
- $vars['similar_downloads'] = wpdm_similar_packages($vars, 5);
1152
-
1153
  if(strpos($template, 'doc_preview'))
1154
  $vars['doc_preview'] = self::docPreview($vars);
1155
 
@@ -1163,9 +1153,11 @@ class Package {
1163
 
1164
  // If need to re-process any data before fetch template
1165
  $vars = apply_filters("wdm_before_fetch_template", $vars, $template, $type);
 
1166
  foreach ($vars as $key => $value) {
1167
  if(!is_array($value)) {
1168
  $keys[] = "[$key]";
 
1169
  $values[] = $value;
1170
  }
1171
  }
1075
  preg_match_all("/\[cf ([^\]]+)\]/", $template, $cfmatches);
1076
  preg_match_all("/\[thumb_([0-9]+)x([0-9]+)\]/", $template, $matches);
1077
  preg_match_all("/\[thumb_url_([0-9]+)x([0-9]+)\]/", $template, $umatches);
 
1078
  preg_match_all("/\[excerpt_([0-9]+)\]/", $template, $xmatches);
1079
  preg_match_all("/\[pdf_thumb_([0-9]+)x([0-9]+)\]/", $template, $pmatches);
1080
  preg_match_all("/\[txt=([^\]]+)\]/", $template, $txtmatches);
1131
  $values[] = $vars['preview'] != '' ? wpdm_dynamic_thumb($vars['preview'], array($umatches[1][$nd], $umatches[2][$nd])) : '';
1132
  }
1133
 
 
 
 
 
 
 
1134
  foreach ($xmatches[0] as $nd => $scode) {
1135
  $keys[] = $scode;
1136
  $ss = substr(strip_tags($vars['description']), 0, intval($xmatches[1][$nd]));
1140
  $values[] = $ss . '...';
1141
  }
1142
 
 
 
 
1143
  if(strpos($template, 'doc_preview'))
1144
  $vars['doc_preview'] = self::docPreview($vars);
1145
 
1153
 
1154
  // If need to re-process any data before fetch template
1155
  $vars = apply_filters("wdm_before_fetch_template", $vars, $template, $type);
1156
+
1157
  foreach ($vars as $key => $value) {
1158
  if(!is_array($value)) {
1159
  $keys[] = "[$key]";
1160
+ if(is_object($value) || is_array($value)) $value = json_encode($value);
1161
  $values[] = $value;
1162
  }
1163
  }
libs/class.Session.php CHANGED
@@ -23,11 +23,8 @@ class Session
23
 
24
  if(file_exists(WPDM_CACHE_DIR."session-{$deviceID}.txt")) {
25
  $data = file_get_contents(WPDM_CACHE_DIR . "session-{$deviceID}.txt");
26
- $data = (array)Crypt::decrypt($data);
27
  if(!is_array($data)) $data = array();
28
- foreach ($data as &$item){
29
- if(is_object($item)) $item = (array)$item;
30
- }
31
  } else {
32
  $data = array();
33
  }
23
 
24
  if(file_exists(WPDM_CACHE_DIR."session-{$deviceID}.txt")) {
25
  $data = file_get_contents(WPDM_CACHE_DIR . "session-{$deviceID}.txt");
26
+ $data = Crypt::decrypt($data, true);
27
  if(!is_array($data)) $data = array();
 
 
 
28
  } else {
29
  $data = array();
30
  }
libs/class.ShortCodes.php CHANGED
@@ -273,6 +273,7 @@ class ShortCodes
273
 
274
  if (isset($scparams['s']) && $scparams['s'] != '') $params['s'] = $scparams['s'];
275
  if (isset($_GET['skw']) && $_GET['skw'] != '') $params['s'] = wpdm_query_var('skw', 'txt');
 
276
  if (isset($scparams['author']) && $scparams['author'] != '') $params['author'] = $scparams['author'];
277
  if (isset($scparams['author_name']) && $scparams['author_name'] != '') $params['author_name'] = $scparams['author_name'];
278
  if (isset($scparams['author__not_in']) && $scparams['author__not_in'] != '') $params['author__not_in'] = explode(",", $scparams['author__not_in']);
273
 
274
  if (isset($scparams['s']) && $scparams['s'] != '') $params['s'] = $scparams['s'];
275
  if (isset($_GET['skw']) && $_GET['skw'] != '') $params['s'] = wpdm_query_var('skw', 'txt');
276
+ if (isset($scparams['post__in']) && $scparams['post__in'] != '') $params['post__in'] = explode(",", $scparams['post__in']);
277
  if (isset($scparams['author']) && $scparams['author'] != '') $params['author'] = $scparams['author'];
278
  if (isset($scparams['author_name']) && $scparams['author_name'] != '') $params['author_name'] = $scparams['author_name'];
279
  if (isset($scparams['author__not_in']) && $scparams['author__not_in'] != '') $params['author__not_in'] = explode(",", $scparams['author__not_in']);
libs/class.TempStorage.php CHANGED
@@ -20,7 +20,7 @@ class TempStorage
20
  {
21
  if(file_exists(WPDM_CACHE_DIR.'/temp-storage.txt')) {
22
  $data = file_get_contents(WPDM_CACHE_DIR . '/temp-storage.txt');
23
- $data = (array)Crypt::decrypt($data);
24
  if(!is_array($data)) $data = array();
25
  } else {
26
  $data = array();
20
  {
21
  if(file_exists(WPDM_CACHE_DIR.'/temp-storage.txt')) {
22
  $data = file_get_contents(WPDM_CACHE_DIR . '/temp-storage.txt');
23
+ $data = Crypt::decrypt($data, true);
24
  if(!is_array($data)) $data = array();
25
  } else {
26
  $data = array();
libs/class.User.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
  /**
3
- * Created by PhpStorm.
4
  * User: shahnuralam
5
  * Date: 6/24/18
6
  * Time: 10:39 PM
@@ -11,7 +10,7 @@ namespace WPDM\libs;
11
 
12
  use WPDM\Form;
13
 
14
- if( ! class_exists( 'User' ) ):
15
 
16
  class User{
17
 
@@ -75,6 +74,7 @@ if( ! class_exists( 'User' ) ):
75
  );
76
  }
77
  }
 
78
  $form = new Form($reg_data_fields, ['name' => 'wpdm_reg_form', 'id' => 'wpdm_reg_form', 'method' => 'POST', 'action' => '', 'submit_button' => [ ], 'noForm' => true]);
79
  return $form->render();
80
 
@@ -102,6 +102,7 @@ if( ! class_exists( 'User' ) ):
102
  );
103
  }
104
  }
 
105
  $form = new Form($login_data_fields, ['name' => 'wpdm_login_form', 'id' => 'wpdm_login_form', 'method' => 'POST', 'action' => '', 'submit_button' => [ ], 'noForm' => true]);
106
  return $form->render();
107
 
@@ -156,7 +157,7 @@ if( ! class_exists( 'User' ) ):
156
 
157
  }
158
 
159
- //echo User::signupForm();
160
 
161
- endif;
 
162
 
1
  <?php
2
  /**
 
3
  * User: shahnuralam
4
  * Date: 6/24/18
5
  * Time: 10:39 PM
10
 
11
  use WPDM\Form;
12
 
13
+
14
 
15
  class User{
16
 
74
  );
75
  }
76
  }
77
+ $reg_data_fields = apply_filters("wpdm_register_form_fields", $reg_data_fields);
78
  $form = new Form($reg_data_fields, ['name' => 'wpdm_reg_form', 'id' => 'wpdm_reg_form', 'method' => 'POST', 'action' => '', 'submit_button' => [ ], 'noForm' => true]);
79
  return $form->render();
80
 
102
  );
103
  }
104
  }
105
+ $login_data_fields = apply_filters("wpdm_login_form_fields", $login_data_fields);
106
  $form = new Form($login_data_fields, ['name' => 'wpdm_login_form', 'id' => 'wpdm_login_form', 'method' => 'POST', 'action' => '', 'submit_button' => [ ], 'noForm' => true]);
107
  return $form->render();
108
 
157
 
158
  }
159
 
 
160
 
161
+
162
+
163
 
libs/class.UserProfile.php CHANGED
@@ -70,13 +70,13 @@ class UserProfile
70
 
71
 
72
  function downloads(){
73
- $params = (array)Crypt::decrypt(wpdm_query_var('__scp'));
74
  $params['author'] = wpdm_query_var('__pu', 'int');
75
  echo WPDM()->shortCode->packages($params);
76
  }
77
 
78
  function favourites(){
79
- $params = (array)Crypt::decrypt(wpdm_query_var('__scp'));
80
  $myfavs = maybe_unserialize(get_user_meta(wpdm_query_var('__pu', 'int'), '__wpdm_favs', true));
81
  $params['post__in'] = implode(",", $myfavs);
82
  echo WPDM()->shortCode->packages($params);
70
 
71
 
72
  function downloads(){
73
+ $params = Crypt::decrypt(wpdm_query_var('__scp'), true);
74
  $params['author'] = wpdm_query_var('__pu', 'int');
75
  echo WPDM()->shortCode->packages($params);
76
  }
77
 
78
  function favourites(){
79
+ $params = Crypt::decrypt(wpdm_query_var('__scp'), true);
80
  $myfavs = maybe_unserialize(get_user_meta(wpdm_query_var('__pu', 'int'), '__wpdm_favs', true));
81
  $params['post__in'] = implode(",", $myfavs);
82
  echo WPDM()->shortCode->packages($params);
readme.txt CHANGED
@@ -113,6 +113,9 @@ Use [Premium Package – Complete Digital Store Solution](https://www.wpdownload
113
  * [Gutenberg Blocks](https://www.wpdownloadmanager.com/download/gutenberg-blocks/) for gutenberg editor
114
  * [Gutenberg Blocks and Page Layouts – Attire Blocks](https://wordpress.org/plugins/attire-blocks/)
115
 
 
 
 
116
  = Google Drive =
117
  Use [Google Drive Explorer](https://www.wpdownloadmanager.com/download/google-drive-explorer/) add-on ( free ) to store your files in google drive and link with download manager, get 15 GB free storage space and save your server bandwidth
118
 
@@ -179,6 +182,18 @@ Check download stats and get a push notification when someone downloads, install
179
 
180
  == Changelog ==
181
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  = 3.1.08 =
183
  * Fixed an issue with the login form parameter handling
184
 
113
  * [Gutenberg Blocks](https://www.wpdownloadmanager.com/download/gutenberg-blocks/) for gutenberg editor
114
  * [Gutenberg Blocks and Page Layouts – Attire Blocks](https://wordpress.org/plugins/attire-blocks/)
115
 
116
+ = Elementor Addons =
117
+ * [Download Manager Addons for Elementor](https://wordpress.org/plugins/wpdm-elementor/) - Use the plugin if you are using Elementor Website Builder. The plugin provides elementor addons for all wordpress download manager shortcodes you were writing manually.
118
+
119
  = Google Drive =
120
  Use [Google Drive Explorer](https://www.wpdownloadmanager.com/download/google-drive-explorer/) add-on ( free ) to store your files in google drive and link with download manager, get 15 GB free storage space and save your server bandwidth
121
 
182
 
183
  == Changelog ==
184
 
185
+ = 3.1.11 =
186
+ * Improved asset manager
187
+ * Fixed the issue with displaying download count
188
+ * Fixed the date format issue with download history
189
+
190
+ = 3.1.10 =
191
+ * Improved email class, added support for custom tags in email to add user meta and REQUEST data
192
+
193
+ = 3.1.09 =
194
+ * Improved Crypt class
195
+ * Fixed an issue with the category shortcode
196
+
197
  = 3.1.08 =
198
  * Fixed an issue with the login form parameter handling
199
 
wpdm-core.php CHANGED
@@ -115,41 +115,41 @@ function wpdm_dropdown_categories($name = '', $selected = '', $id = '', $echo =
115
  /**
116
  * @param $url
117
  * @param array $data
118
- * @return array|WP_Error
 
119
  */
120
- function wpdm_remote_post($url, $data = array(), $headers = array())
121
  {
122
 
123
- $response = wp_remote_post( $url, array(
124
- 'method' => 'POST',
125
- 'timeout' => 45,
 
126
  'redirection' => 5,
127
  'httpversion' => '1.0',
128
- 'blocking' => true,
129
- 'headers' => $headers,
130
- 'body' => $data,
131
- 'cookies' => array()
132
  )
133
  );
134
-
135
- if ( is_wp_error( $response ) ) {
136
- return $response;
137
- } else {
138
- return $response['body'];
139
- }
140
  }
141
 
142
  /**
143
- * @usage Get with cURL
144
  * @param $url
 
145
  * @return bool|mixed|string
146
  */
147
- function wpdm_remote_get($url)
148
  {
149
- $res = wp_remote_get($url);
150
- $content = '';
151
- if( is_array($res) )
152
- $content = $res['body'];
 
 
153
  return $content;
154
  }
155
 
115
  /**
116
  * @param $url
117
  * @param array $data
118
+ * @param array $headers
119
+ * @return bool|mixed|string
120
  */
121
+ function wpdm_remote_post($url, $data = [], $headers = [])
122
  {
123
 
124
+ $response = wp_remote_post($url, array(
125
+ 'method' => 'POST',
126
+ 'sslverify' => false,
127
+ 'timeout' => 5,
128
  'redirection' => 5,
129
  'httpversion' => '1.0',
130
+ 'blocking' => true,
131
+ 'headers' => $headers,
132
+ 'body' => $data,
133
+ 'cookies' => array()
134
  )
135
  );
136
+ $body = wp_remote_retrieve_body($response);
137
+ return $body;
 
 
 
 
138
  }
139
 
140
  /**
 
141
  * @param $url
142
+ * @param array $headers
143
  * @return bool|mixed|string
144
  */
145
+ function wpdm_remote_get($url, $headers = [])
146
  {
147
+ $content = "";
148
+ $response = wp_remote_get($url, array('timeout' => 5, 'sslverify' => false, 'headers' => $headers));
149
+ if (is_array($response)) {
150
+ $content = $response['body'];
151
+ } else
152
+ $content = WPDM_Messages::error($response->get_error_message(), -1);
153
  return $content;
154
  }
155
 
wpdm-functions.php CHANGED
@@ -3,8 +3,8 @@ if (!defined('ABSPATH')) die();
3
  global $wpdm_message, $btnclass;
4
 
5
 
6
-
7
- function wpdm_zip_package($package){
8
  return \WPDM\Package::Zip($package['ID']);
9
  }
10
 
@@ -24,7 +24,8 @@ function wpdm_download_data($filename, $content)
24
  * @param $zipname
25
  * @return bool|string
26
  */
27
- function wpdm_zip_files($files, $zipname){
 
28
 
29
  return \WPDM\libs\FileSystem::zipFiles($files, $zipname);
30
  }
@@ -41,8 +42,8 @@ function wpdm_zip_files($files, $zipname){
41
  function wpdm_download_file($filepath, $filename, $speed = 0, $resume_support = 1, $extras = array())
42
  {
43
 
44
- if(isset($_GET['play'])) $extras['play'] = esc_attr($_GET['play']);
45
- \WPDM\libs\FileSystem::downloadFile($filepath, $filename, $speed, $resume_support, $extras);
46
 
47
  }
48
 
@@ -52,8 +53,9 @@ function wpdm_download_file($filepath, $filename, $speed = 0, $resume_support =
52
  * @usage Returns the user roles who has access to specified package
53
  * @return array|mixed
54
  */
55
- function wpdm_allowed_roles($id){
56
- return \WPDM\Package::AllowedRoles($id);
 
57
  }
58
 
59
 
@@ -64,7 +66,8 @@ function wpdm_allowed_roles($id){
64
  *
65
  * @return bool
66
  */
67
- function wpdm_user_has_access($id, $type = 'package'){
 
68
  return \WPDM\Package::UserCanAccess($id, $type);
69
  }
70
 
@@ -79,8 +82,8 @@ function wpdm_user_has_access($id, $type = 'package'){
79
  function downloadLink(&$package, $embed = 0, $extras = array())
80
  {
81
  global $wpdb, $current_user, $wpdm_download_icon, $wpdm_download_lock_icon, $btnclass;
82
- if(is_array($extras))
83
- extract($extras);
84
  $data = '';
85
  //get_currentuserinfo();
86
 
@@ -88,7 +91,7 @@ function downloadLink(&$package, $embed = 0, $extras = array())
88
  //$loginmsg = wpdm_escs(htmlspecialchars_decode($loginmsg));
89
 
90
  $package['link_url'] = home_url('/?download=1&');
91
- $package['link_label'] = !isset($package['link_label']) || $package['link_label'] == '' ? __("Download",'download-manager') : $package['link_label'];
92
 
93
  //Change link label using a button image
94
  $package['link_label'] = apply_filters('wpdm_button_image', $package['link_label'], $package);
@@ -97,50 +100,52 @@ function downloadLink(&$package, $embed = 0, $extras = array())
97
  $package['download_url'] = wpdm_download_url($package);
98
  if (wpdm_is_download_limit_exceed($package['ID'])) {
99
  $package['download_url'] = '#';
100
- $package['link_label'] = __('Download Limit Exceeded','download-manager');
101
  }
102
  if (isset($package['expire_date']) && $package['expire_date'] != "" && strtotime($package['expire_date']) < time()) {
103
  $package['download_url'] = '#';
104
- $package['link_label'] = __('Download was expired on','download-manager') . " " . date_i18n(get_option('date_format')." h:i A", strtotime($package['expire_date']));
105
  $package['download_link'] = "<a href='#'>{$package['link_label']}</a>";
106
- return "<div class='alert alert-warning'><b>" . __('Download:','download-manager') . "</b><br/>{$package['link_label']}</div>";
107
  }
108
 
109
- if (isset($package['publish_date']) && $package['publish_date'] !='' && strtotime($package['publish_date']) > time()) {
110
  $package['download_url'] = '#';
111
- $package['link_label'] = __('Download will be available from ','download-manager') . " " . date_i18n(get_option('date_format')." h:i A", strtotime($package['publish_date']));
112
  $package['download_link'] = "<a href='#'>{$package['link_label']}</a>";
113
- return "<div class='alert alert-warning'><b>" . __('Download:','download-manager') . "</b><br/>{$package['link_label']}</div>";
114
  }
115
 
116
- $link_label = isset($package['link_label']) ? $package['link_label'] : __('Download','download-manager');
117
 
118
- $package['access'] = wpdm_allowed_roles($package['ID']);
119
 
120
  if ($package['download_url'] != '#')
121
  $package['download_link'] = "<a class='wpdm-download-link {$btnclass}' rel='nofollow' href='#' onclick=\"location.href='{$package['download_url']}';return false;\"><i class='$wpdm_download_icon'></i>{$link_label}</a>";
122
  else
123
- $package['download_link'] = "<div class='alert alert-warning'><b>" . __('Download:','download-manager') . "</b><br/>{$link_label}</div>";
124
  $caps = array_keys($current_user->caps);
125
  $role = array_shift($caps);
126
 
127
- $matched = (is_array(@maybe_unserialize($package['access'])) && is_user_logged_in())?array_intersect($current_user->roles, @maybe_unserialize($package['access'])):array();
128
 
129
  $skiplink = 0;
130
 
131
  if (is_user_logged_in() && count($matched) <= 0 && !@in_array('guest', @maybe_unserialize($package['access']))) {
132
  $package['download_url'] = "#";
133
- $package['download_link'] = $package['download_link_extended'] = stripslashes(get_option('wpdm_permission_msg', __('Permission Denied','download-manager')));
134
  $package = apply_filters('download_link', $package);
135
- if (get_option('_wpdm_hide_all', 0) == 1) { $package['download_link'] = $package['download_link_extended'] = 'blocked'; }
 
 
136
  return $package['download_link'];
137
  }
138
  if (!@in_array('guest', @maybe_unserialize($package['access'])) && !is_user_logged_in()) {
139
 
140
- $loginform = wpdm_login_form(array('redirect'=>get_permalink($package['ID'])));
141
  if (get_option('_wpdm_hide_all', 0) == 1) return 'loginform';
142
  $package['download_url'] = home_url('/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
143
- $package['download_link'] = stripcslashes(str_replace(array("[loginform]","[this_url]"), array($loginform,get_permalink($package['ID'])), $loginmsg));
144
  return get_option('__wpdm_login_form', 0) == 1 ? $loginform : $package['download_link'];
145
 
146
  }
@@ -151,7 +156,7 @@ function downloadLink(&$package, $embed = 0, $extras = array())
151
  if (!isset($package['quota']) || (isset($package['quota']) && $package['quota'] > 0 && $package['quota'] > $package['download_count']) || $package['quota'] == 0) {
152
  $lock = 0;
153
 
154
- if ( $package['password'] != '') {
155
  $lock = 'locked';
156
  $data = \WPDM\libs\PackageLocks::AskPassword($package);
157
  }
@@ -161,7 +166,7 @@ function downloadLink(&$package, $embed = 0, $extras = array())
161
 
162
  if (isset($package['captcha_lock']) && (int)$package['captcha_lock'] == 1) {
163
  $lock = 'locked';
164
- $sociallock .= \WPDM\libs\PackageLocks::reCaptchaLock($package , true);
165
 
166
  }
167
 
@@ -170,7 +175,7 @@ function downloadLink(&$package, $embed = 0, $extras = array())
170
 
171
  if (is_array($extralocks) && $extralocks['lock'] === 'locked') {
172
 
173
- if(isset($extralocks['type']) && $extralocks['type'] == 'social')
174
  $sociallock .= $extralocks['html'];
175
  else
176
  $data .= $extralocks['html'];
@@ -178,8 +183,8 @@ function downloadLink(&$package, $embed = 0, $extras = array())
178
  $lock = 'locked';
179
  }
180
 
181
- if($sociallock!=""){
182
- $data .= "<div class='panel panel-default'><div class='panel-heading'>".__("Download",'download-manager')."</div><div class='panel-body wpdm-social-locks text-center'>{$sociallock}</div></div>";
183
  }
184
 
185
  if ($lock === 'locked') {
@@ -199,9 +204,8 @@ function downloadLink(&$package, $embed = 0, $extras = array())
199
 
200
 
201
  }
202
- }
203
- else {
204
- $data = __("Download limit exceeded!",'download-manager');
205
  }
206
 
207
 
@@ -216,16 +220,17 @@ function downloadLink(&$package, $embed = 0, $extras = array())
216
  * @param $email
217
  * @return bool
218
  */
219
- function wpdm_verify_email($email){
220
- $dns_verify = get_option('__wpdm_verify_dns',0);
221
- $blocked_domains = explode("\n",str_replace("\r","",get_option('__wpdm_blocked_domains','')));
222
- $blocked_emails = explode("\n",str_replace("\r","",get_option('__wpdm_blocked_emails','')));
 
223
  $eparts = explode("@", $email);
224
  $domain = $eparts[1];
225
- if(!is_email($email)) return false;
226
- if(in_array($email, $blocked_emails)) return false;
227
- if(in_array($domain, $blocked_domains)) return false;
228
- if($dns_verify && !checkdnsrr($domain, 'MX')) return false;
229
  return true;
230
  }
231
 
@@ -250,9 +255,9 @@ function wpdm_getlink()
250
 
251
  $data = array('error' => '', 'downloadurl' => '');
252
 
253
- if(isset($_POST['reCaptchaVerify'])){
254
  $ret = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array('method' => 'POST', 'body' => array('secret' => get_option('_wpdm_recaptcha_secret_key'), 'response' => $_POST['reCaptchaVerify'], 'remoteip' => $_SERVER['REMOTE_ADDR'])));
255
- if(is_wp_error($ret)){
256
  header("Content-type: application/json");
257
  $data['error'] = $ret->get_error_message();
258
  $data['downloadurl'] = '';
@@ -260,11 +265,10 @@ function wpdm_getlink()
260
  die();
261
  }
262
  $ret = json_decode($ret['body']);
263
- if($ret->success == 1){
264
  $download_url = \WPDM\Package::expirableDownloadLink($file['ID'], 3, 10800);
265
  $data['downloadurl'] = $download_url;
266
- }
267
- else{
268
  $data['error'] = __("Captcha Verification Failed!", "wpmdpro");
269
  }
270
  header("Content-type: application/json");
@@ -283,16 +287,16 @@ function wpdm_getlink()
283
  $adata = apply_filters("wpdmgetlink", $data, $file);
284
  $data = is_array($adata) ? $adata : $data;
285
 
286
- if(!wpdm_is_ajax()){
287
 
288
- @setcookie("wpdm_getlink_data_".$key, json_encode($data));
289
 
290
- if(isset($data['downloadurl']) && $data['downloadurl']!=''){
291
- header("location: ".$data['downloadurl']);
292
  die();
293
  }
294
 
295
- header("location: ".$_SERVER['HTTP_REFERER']."#nojs_popup|ckid:".$key);
296
  die();
297
  }
298
 
@@ -303,29 +307,29 @@ function wpdm_getlink()
303
  }
304
 
305
  $decoded_pass = htmlspecialchars_decode($file['password']);
306
- if ($plock === 1 && $password !== $file['password'] && $password !== $decoded_pass && !strpos("__" . $file['password'], "[$password]") && !strpos("__" . $decoded_pass, "[$password]") ) {
307
- $data['error'] = '<span style="font-size: 8pt"><i class="fas fa-sync"></i> '.__('Wrong Password! Try Again.','download-manager')."</span>";
308
  $file = array();
309
  }
310
  if ($plock == 1 && $password == '') {
311
- $data['error'] = '<span class="color-red" style="font-size: 8pt"><i class="fas fa-sync"></i> '.__('Wrong Password! Try Again.','download-manager')."</span>";
312
  $file = array();
313
  }
314
  $ux = "";
315
  if ($plock == 1 && isset($file['ID'])) {
316
- update_post_meta($file['ID'], "__wpdmkey_" .$key, 3);
317
  }
318
 
319
- if ( isset($file['ID']) && $file['ID'] != '') {
320
- $pu = isset($file['password_usage']) && is_array($file['password_usage'])?$file['password_usage']:array();
321
- $pul = isset($file['password_usage_limit'])?(int)$file['password_usage_limit']:99999999999;
322
 
323
  if (is_array($pu) && isset($pu[$password]) && $pu[$password] >= $pul && $pul > 0)
324
- $data['error'] = __('Password usages limit exceeded','download-manager');
325
  else {
326
- if(!is_array($pu)) $pu = array();
327
  \WPDM\Session::set("pass_verified_" . $file['ID'], 1);
328
- $pu[$password] = isset($pu[$password])?$pu[$password]+1:1;
329
  update_post_meta($file['ID'], '__wpdm_password_usage', $pu);
330
  }
331
  }
@@ -340,31 +344,30 @@ function wpdm_getlink()
340
  $adata = apply_filters("wpdmgetlink", $data, $file);
341
  $data = is_array($adata) ? $adata : $data;
342
 
343
- if(!wpdm_is_ajax()){
344
 
345
- @setcookie("wpdm_getlink_data_".$key, json_encode($data));
346
 
347
- if(isset($data['downloadurl']) && $data['downloadurl']!=''){
348
- header("location: ".$data['downloadurl']);
349
- die();
350
- }
351
 
352
- header("location: ".$_SERVER['HTTP_REFERER']."#nojs_popup|ckid:".$key);
353
- die();
354
- }
355
 
356
  header("Content-type: application/json");
357
  die(json_encode($data));
358
  }
359
 
360
 
361
-
362
  function wpdm_package_link_legacy($params)
363
  {
364
  extract($params);
365
- $posts = get_posts(array("post_type"=>"wpdmpro","meta_key"=>"__wpdm_legacy_id","meta_value"=>$params['id']));
366
  $data = (array)$posts[0];
367
- if(!isset($data['ID'])) return "";
368
  $data = wpdm_setup_package_data($data);
369
 
370
  if ($data['ID'] == '') {
@@ -373,9 +376,9 @@ function wpdm_package_link_legacy($params)
373
 
374
  $templates = maybe_unserialize(get_option("_fm_link_templates", true));
375
 
376
- if(!isset($template) || $template=="" ) $template = $data['template'];
377
 
378
- if(isset($template) && isset($templates[$template]) && isset($templates[$template]['content'])) $template = $templates[$template]['content'];
379
 
380
 
381
  return "<div class='w3eden'>" . FetchTemplate($template, $data, 'link') . "</div>";
@@ -389,8 +392,8 @@ function wpdm_package_link_legacy($params)
389
  */
390
  function wpdm_downloadable($content)
391
  {
392
- if( defined('WPDM_THEME_SUPPORT') && WPDM_THEME_SUPPORT == true ) return $content;
393
- if(get_post_type(get_the_ID()) != 'wpdmpro') return $content;
394
 
395
  global $wpdb, $current_user, $post, $wp_query, $wpdm_package;
396
  if (isset($wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')]) && $wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')] != '')
@@ -402,16 +405,16 @@ function wpdm_downloadable($content)
402
  $login_msg = wpdm_escs(htmlspecialchars_decode($login_msg));
403
  $user = new WP_User(null);
404
  if (isset($_GET[get_option('__wpdm_purl_base', 'download')]) && $_GET[get_option('__wpdm_purl_base', 'download')] != '' && $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] == '')
405
- $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] = esc_attr($_GET[get_option('__wpdm_purl_base', 'download')]);
406
  $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] = isset($wp_query->query_vars[get_option('__wpdm_purl_base', 'download')]) ? urldecode($wp_query->query_vars[get_option('__wpdm_purl_base', 'download')]) : '';
407
 
408
  if (is_singular('wpdmpro')) {
409
  if (get_option('_wpdm_custom_template') == 1 || current_theme_supports('wpdm')) return $content;
410
 
411
- $template = get_post_meta(get_the_ID(),'__wpdm_page_template', true);
412
  $data = FetchTemplate($template, get_the_ID(), 'page');
413
  $siteurl = site_url('/');
414
- return "<div class='w3eden'>{$data}</div>";
415
  }
416
 
417
  return $content;
@@ -425,7 +428,8 @@ function wpdm_downloadable($content)
425
  * @param $id
426
  * @return int
427
  */
428
- function wpdm_package_filecount($id){
 
429
  return \WPDM\Package::fileCount($id);
430
 
431
  }
@@ -435,7 +439,8 @@ function wpdm_package_filecount($id){
435
  * @param $id
436
  * @return float|int|mixed|string
437
  */
438
- function wpdm_package_size($id){
 
439
  return \WPDM\Package::Size($id);
440
  }
441
 
@@ -445,29 +450,30 @@ function wpdm_package_size($id){
445
  * @param $file
446
  * @return float|int|mixed|string
447
  */
448
- function wpdm_file_size($file){
449
- if(file_exists($file))
 
450
  $_size = filesize($file);
451
- else if(file_exists(UPLOAD_DIR.$file))
452
- $_size = filesize(UPLOAD_DIR.$file);
453
  else $_size = 0;
454
  $size = $_size / 1024;
455
  if ($size > 1024) $size = number_format($size / 1024, 2) . ' MB';
456
  else $size = number_format($size, 2) . ' KB';
457
- if($size === '0.00 KB')
458
- $size = $_size." bytes";
459
  return $size;
460
  }
461
 
462
 
463
-
464
  /**
465
  * @usage Returns icons for package file types
466
  * @param $id
467
  * @param bool $img
468
  * @return array|string
469
  */
470
- function wpdm_package_filetypes($id, $img = true){
 
471
 
472
  return \WPDM\Package::fileTypes($id, $img);
473
 
@@ -481,19 +487,20 @@ function wpdm_package_filetypes($id, $img = true){
481
  * @param string $continue
482
  * @return string
483
  */
484
- function wpdm_get_excerpt($post, $length = 100, $word_break = false, $continue = "..."){
 
485
  $post = is_object($post) ? $post : get_post($post);
486
- if(!is_object($post)) return '';
487
  $excerpt = get_the_excerpt($post);
488
- if(!$excerpt) $excerpt = $post->post_content;
489
  $excerpt = strip_tags($excerpt);
490
  $excerpt = substr(trim($excerpt), 0, $length);
491
- if(!$word_break) {
492
  $excerpt = explode(" ", $excerpt);
493
  array_pop($excerpt);
494
  $excerpt = implode(" ", $excerpt);
495
  }
496
- return $excerpt.$continue;
497
  }
498
 
499
 
@@ -502,8 +509,9 @@ function wpdm_get_excerpt($post, $length = 100, $word_break = false, $continue =
502
  * @param $html
503
  * @return null|string|string[]
504
  */
505
- function wpdm_escs($html){
506
- $html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $html);
 
507
  $html = stripslashes_deep($html);
508
  return $html;
509
  }
@@ -518,18 +526,18 @@ function wpdm_escs($html){
518
 
519
  function wpdm_valueof($var, $index, $params = [])
520
  {
521
- $index = explode("/" , $index );
522
  $default = is_string($params) ? $params : '';
523
  $default = is_array($params) && isset($params['default']) ? $params['default'] : $default;
524
- if(count($index) > 1){
525
  $val = $var;
526
- foreach ($index as $key){
527
- $val = is_array($val) && isset($val[$key])?$val[$key]:false;
528
  }
529
  } else
530
  $val = isset($var[$index[0]]) ? $var[$index[0]] : $default;
531
 
532
- if(is_array($params) && isset($params['validate'])) {
533
  if (!is_array($val))
534
  $val = wpdm_sanitize_var($val, $params['validate']);
535
  else
@@ -548,18 +556,18 @@ function wpdm_valueof($var, $index, $params = [])
548
  */
549
  function wpdm_query_var($var, $params = array())
550
  {
551
- $_var = explode("/" , $var );
552
- if(count($_var) > 1){
553
  $val = $_REQUEST;
554
- foreach ($_var as $key){
555
- $val = is_array($val) && isset($val[$key])?$val[$key]:false;
556
  }
557
  } else
558
  $val = isset($_REQUEST[$var]) ? $_REQUEST[$var] : null;
559
  $validate = is_string($params) ? $params : '';
560
  $validate = is_array($params) && isset($params['validate']) ? $params['validate'] : $validate;
561
 
562
- if(!is_array($val))
563
  $val = wpdm_sanitize_var($val, $validate);
564
  else
565
  $val = wpdm_sanitize_array($val, $validate);
@@ -572,11 +580,12 @@ function wpdm_query_var($var, $params = array())
572
  * @param $array
573
  * @return mixed
574
  */
575
- function wpdm_sanitize_array($array, $sanitize = 'kses'){
576
- if(!is_array($array)) return esc_attr($array);
577
- foreach ($array as $key => &$value){
 
578
  $validate = is_array($sanitize) && isset($sanitize[$key]) ? $sanitize[$key] : $sanitize;
579
- if(is_array($value))
580
  wpdm_sanitize_array($value, $validate);
581
  else {
582
  $value = wpdm_sanitize_var($value, $validate);
@@ -591,11 +600,12 @@ function wpdm_sanitize_array($array, $sanitize = 'kses'){
591
  * @param $value
592
  * @return string
593
  */
594
- function wpdm_sanitize_var($value, $sanitize = 'kses'){
595
- if(is_array($value))
 
596
  return wpdm_sanitize_array($value, $sanitize);
597
  else {
598
- switch ($sanitize){
599
  case 'int':
600
  case 'num':
601
  return (int)$value;
@@ -648,11 +658,9 @@ function wpdm_sanitize_var($value, $sanitize = 'kses'){
648
  }
649
 
650
 
651
-
652
-
653
  function wpdm_category($params)
654
  {
655
- $params['order_field'] = isset($params['order_by'])?$params['order_by']:'date';
656
  unset($params['order_by']);
657
  if (isset($params['item_per_page']) && !isset($params['items_per_page'])) $params['items_per_page'] = $params['item_per_page'];
658
  unset($params['item_per_page']);
@@ -677,23 +685,23 @@ function wpdm_page_links($urltemplate, $total, $page = 1, $items_per_page = 10)
677
  }
678
 
679
 
680
- function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN' , 'items_per_page' => 10, 'title' => false, 'desc' => false, 'order_field' => 'date', 'order' => 'desc', 'paging' => false, 'toolbar' => 1, 'template' => '','cols'=>3, 'colspad'=>2, 'colsphone' => 1))
681
  {
682
  //die("<pre>".print_r($params, 1));
683
  extract($params);
684
  $fnparams = $params;
685
- if(!isset($id) || $id =="") return;
686
- if(!isset($items_per_page)) $items_per_page = 10;
687
- if(!isset($template)) $template = 'link-template-calltoaction3.php';
688
- if(!isset($cols)) $cols = 1;
689
- if(!isset($colspad)) $colspad = 1;
690
- if(!isset($colsphone)) $colsphone = 1;
691
- if(!isset($toolbar)) $toolbar = 1;
692
  $taxo = 'wpdmcategory';
693
- if(isset($tag) && $tag==1) $taxo = 'post_tag';
694
- $cwd_class = "col-md-".(int)(12/$cols);
695
- $cwdsm_class = "col-sm-".(int)(12/$colspad);
696
- $cwdxs_class = "col-xs-".(int)(12/$colsphone);
697
 
698
  $id = trim($id, ", ");
699
  $cids = explode(",", $id);
@@ -703,11 +711,11 @@ function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN' , 'i
703
  $order_field = isset($order_field) ? $order_field : 'date';
704
  $order_field = isset($_GET['orderby']) ? esc_attr($_GET['orderby']) : $order_field;
705
  $order = isset($order) ? $order : 'desc';
706
- $order = isset($_GET['order']) ?esc_attr( $_GET['order']) : $order;
707
- $operator = isset($operator)?$operator:'IN';
708
- $cpvar = 'cp_'.$cids[0];
709
- $cp = wpdm_query_var($cpvar,'num');
710
- if(!$cp) $cp = 1;
711
 
712
  $params = array(
713
  'post_type' => 'wpdmpro',
@@ -725,12 +733,12 @@ function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN' , 'i
725
  if (get_option('_wpdm_hide_all', 0) == 1) {
726
  $params['meta_query'] = array(
727
  array(
728
- 'key' => '__wpdm_access',
729
- 'value' => 'guest',
730
- 'compare' => 'LIKE'
731
  )
732
  );
733
- if(is_user_logged_in()){
734
  global $current_user;
735
  $params['meta_query'][] = array(
736
  'key' => '__wpdm_access',
@@ -772,21 +780,22 @@ function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN' , 'i
772
  $html = '';
773
  $templates = maybe_unserialize(get_option("_fm_link_templates", true));
774
 
775
- if(isset($templates[$template])) $template = $templates[$template]['content'];
776
 
777
  global $post;
778
- while($packs->have_posts()) { $packs->the_post();
 
779
 
780
  $pack = (array)$post;
781
- $repeater = "<div class='{$cwd_class} {$cwdsm_class} {$cwdxs_class}'>".FetchTemplate($template, $pack)."</div>";
782
- $html .= $repeater;
783
 
784
  }
785
  wp_reset_query();
786
 
787
  $html = "<div class='row'>{$html}</div>";
788
  $cname = array();
789
- foreach($cids as $cid){
790
  $cat = get_term_by('slug', $cid, $taxo);
791
  $cname[] = $cat->name;
792
 
@@ -797,19 +806,19 @@ function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN' , 'i
797
  $desc = '';
798
  $trm = get_term_by('slug', $cids[0], 'wpdmcategory');
799
 
800
- if(isset($fnparams['title']) && $fnparams['title'] != false && intval($fnparams['title']) != 1) $cats = $fnparams['title'];
801
- if(isset($fnparams['desc']) && $fnparams['desc'] != false && intval($fnparams['desc']) != 1) $desc = $fnparams['desc'];
802
- if(isset($fnparams['desc']) && (int)$fnparams['desc'] == 1) $desc = $trm->description;
803
 
804
 
805
- $cimg = '';
806
 
807
 
808
  $subcats = '';
809
  if (function_exists('wpdm_ap_categories') && $subcats == 1) {
810
  $schtml = wpdm_ap_categories(array('parent' => $id));
811
  if ($schtml != '') {
812
- $subcats = "<fieldset class='cat-page-tilte'><legend>" . __('Sub-Categories','download-manager') . "</legend>" . $schtml . "<div style='clear:both'></div></fieldset>" . "<fieldset class='cat-page-tilte'><legend>" . __('Downloads','download-manager') . "</legend>";
813
  $efs = '</fieldset>';
814
  }
815
  }
@@ -826,22 +835,22 @@ function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN' , 'i
826
  if (isset($_GET['src']) && $_GET['src'] != '') $burl .= 'src=' . esc_attr($_GET['src']) . '&';
827
  $orderby = isset($_GET['orderby']) ? esc_attr($_GET['orderby']) : 'date';
828
  $order = ucfirst($order);
829
- $order_field = " " . __(ucwords(str_replace("_", " ", $order_field)),'download-manager');
830
- $ttitle = __('Title','download-manager');
831
- $tdls = __('Downloads','download-manager');
832
- $tcdate = __('Publish Date','download-manager');
833
- $tudate = __('Update Date','download-manager');
834
- $tasc = __('Asc','download-manager');
835
- $tdsc = __('Desc','download-manager');
836
- $tsrc = __('Search','download-manager');
837
- $ord = __('Order','download-manager');
838
- $order_by_label = __('Order By','download-manager');
839
- $hasdesc = $desc !=''?'has-desc':'';
840
  if ($toolbar || get_option('__wpdm_cat_tb') == 1) {
841
- if($toolbar != 'skinny') {
842
  $icon = \WPDM\libs\CategoryHandler::icon($trm->term_id);
843
- $iconw = $desc != ''?64:32;
844
- if($icon != '') $icon = "<div class='pull-left'><img class='category-icon category-{$trm->term_id}' style='max-width: {$iconw}px' src='{$icon}' alt='{$trm->name}' /></div>";
845
  $toolbar = <<<TBR
846
  <div class="panel panel-default category-panel {$hasdesc}">
847
  <div class="panel-body">
@@ -876,23 +885,22 @@ TBR;
876
 
877
  TBR;
878
  }
879
- }
880
- else
881
  $toolbar = '';
882
- return "<div class='w3eden'>" . $toolbar . $cimg . $subcats . $html . $pgn . "<div style='clear:both'></div></div>";
883
  }
884
 
885
 
886
-
887
  /**
888
  * @param $file
889
  * @return array|mixed
890
  */
891
- function wpdm_basename($file){
892
- if(strpos("~".$file,"\\"))
 
893
  $basename = explode("\\", $file);
894
  else
895
- $basename = explode("/", $file);
896
  $basename = end($basename);
897
  return $basename;
898
  }
@@ -918,31 +926,33 @@ function wpdm_dynamic_thumb($path, $size)
918
  * @param null $extra
919
  * @return mixed|string|void
920
  */
921
- function wpdm_post_thumb($size='', $echo = true, $extra = null){
 
922
  global $post;
923
- $size = $size?$size:'thumbnail';
924
- $class = isset($extra['class'])?$extra['class']:'';
925
  $alt = $post->post_title;
926
- if(is_array($size))
927
- {
928
- $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
929
  $large_image_url = $large_image_url[0];
930
- if($large_image_url!=''){
931
  $path = str_replace(site_url('/'), ABSPATH, $large_image_url);
932
  $thumb = wpdm_dynamic_thumb($path, $size);
933
  $thumb = str_replace(ABSPATH, site_url('/'), $thumb);
934
  $alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true);
935
- $img = "<img src='".$thumb."' alt='{$alt}' class='{$class}' />";
936
- if($echo) { echo $img; return; }
937
- else
 
 
938
  return $img;
939
  }
940
  }
941
- if($echo&&has_post_thumbnail($post->ID ))
942
- echo get_the_post_thumbnail($post->ID, $size, $extra );
943
- else if(!$echo&&has_post_thumbnail($post->ID ))
944
- return get_the_post_thumbnail($post->ID, $size, $extra );
945
- else if($echo)
946
  echo "";
947
  else
948
  return "";
@@ -956,33 +966,35 @@ function wpdm_post_thumb($size='', $echo = true, $extra = null){
956
  * @param null $extra
957
  * @return mixed|string|void
958
  */
959
- function wpdm_thumb($post, $size='', $echo = true, $extra = null){
960
- if(is_int($post))
961
- $post = get_post($post);
962
- $size = $size?$size:'thumbnail';
963
- $class = isset($extra['class'])?$extra['class']:'';
 
964
  $alt = $post->post_title;
965
- if(is_array($size))
966
- {
967
- $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
968
  $large_image_url = $large_image_url[0];
969
- if($large_image_url!=''){
970
  $path = str_replace(site_url('/'), ABSPATH, $large_image_url);
971
  $thumb = wpdm_dynamic_thumb($path, $size);
972
  $thumb = str_replace(ABSPATH, site_url('/'), $thumb);
973
  $alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true);
974
- if($echo==='url') return $thumb;
975
- $img = "<img src='".$thumb."' alt='{$alt}' class='{$class}' />";
976
- if($echo) { echo $img; return; }
977
- else
 
 
978
  return $img;
979
  }
980
  }
981
- if($echo&&has_post_thumbnail($post->ID ))
982
- echo get_the_post_thumbnail($post->ID, $size, $extra );
983
- else if(!$echo&&has_post_thumbnail($post->ID ))
984
- return get_the_post_thumbnail($post->ID, $size, $extra );
985
- else if($echo)
986
  echo "";
987
  else
988
  return "";
@@ -993,37 +1005,38 @@ function wpdm_thumb($post, $size='', $echo = true, $extra = null){
993
  * @param $data
994
  * @return mixed|string
995
  */
996
- function wpdm_option_field($data) {
 
997
 
998
- $desc = isset($data['description'])? "<em class='note'>{$data['description']}</em>":"";
999
 
1000
- switch($data['type']):
1001
  case 'text':
1002
  return "<input type='text' name='$data[name]' class='form-control' id='$data[id]' value='$data[value]' placeholder='{$data['placeholder']}' />$desc";
1003
  break;
1004
  case 'select':
1005
  case 'dropdown':
1006
  $html = "<select name='{$data['name']}' id='{$data['id']}' style='width:100%;min-width:150px;' >";
1007
- foreach($data['options'] as $value => $label){
1008
 
1009
- $html .= "<option value='{$value}' ".selected($data['selected'],$value,false).">$label</option>";
1010
  }
1011
  $html .= "</select>";
1012
- return $html.$desc;
1013
  break;
1014
  case 'notice':
1015
- return "<div class='alert alert-info' style='margin: 0'>$data[notice]</div>".$desc;
1016
  case 'textarea':
1017
  return "<textarea name='$data[name]' id='$data[id]' class='form-control' style='min-height: 100px'>$data[value]</textarea>$desc";
1018
  break;
1019
  case 'checkbox':
1020
- return "<input type='hidden' name='$data[name]' value='0' /><input type='checkbox' name='$data[name]' id='$data[id]' value='$data[value]' ".checked($data['checked'], $data['value'], false)." />".$desc;
1021
  break;
1022
  case 'callback':
1023
- return call_user_func($data['dom_callback'], $data['dom_callback_params']).$desc;
1024
  break;
1025
  case 'heading':
1026
- return "<h3>".$data['label']."</h3>";
1027
  break;
1028
  endswitch;
1029
  }
@@ -1032,17 +1045,18 @@ function wpdm_option_field($data) {
1032
  * @param $options
1033
  * @return string
1034
  */
1035
- function wpdm_option_page($options){
 
1036
  $html = "<div class='wpdm-settings-fields'>";
1037
- foreach($options as $id => $option){
1038
- if(in_array($option['type'], array('checkbox','radio')))
1039
- $html .= "<div class='form-group'><label>".wpdm_option_field($option)." {$option['label']}</label></div>";
1040
- else if($option['type']=='heading')
1041
  $html .= "<h3>{$option['label']}</h3>";
1042
  else
1043
- $html .= "<div class='form-group'><label>{$option['label']}</label>".wpdm_option_field($option)."</div>";
1044
  }
1045
- $html .="</div>";
1046
  return $html;
1047
  }
1048
 
@@ -1052,8 +1066,9 @@ function wpdm_option_page($options){
1052
  * @param $options
1053
  * @return string
1054
  */
1055
- function wpdm_settings_section($name, $options){
1056
- return "<div class='panel panel-default'><div class='panel-heading'>{$name}</div><div class='panel-body'>".wpdm_option_page($options)."</div></div>";
 
1057
  }
1058
 
1059
 
@@ -1086,7 +1101,8 @@ function wpdm_setup_package_data($vars)
1086
  * @param $id
1087
  * @return bool
1088
  */
1089
- function wpdm_is_locked($id){
 
1090
 
1091
  return \WPDM\Package::isLocked($id);
1092
 
@@ -1112,7 +1128,8 @@ function FetchTemplate($template, $vars, $type = 'link')
1112
  * @param string $type
1113
  * @return mixed|string|void
1114
  */
1115
- function wpdm_fetch_template($template, $vars, $type = 'link'){
 
1116
  return \WPDM\Package::fetchTemplate($template, $vars, $type);
1117
  }
1118
 
@@ -1121,8 +1138,9 @@ function wpdm_fetch_template($template, $vars, $type = 'link'){
1121
  * @usage Callback function for [wpdm_login_form] short-code
1122
  * @return string
1123
  */
1124
- function wpdm_loginform(){
1125
- return wpdm_login_form(array('redirect'=>$_SERVER['REQUEST_URI']));
 
1126
  }
1127
 
1128
 
@@ -1142,7 +1160,8 @@ function wpdm_is_ajax()
1142
  * @param $ID
1143
  * @return bool|mixed|null|void|WP_Post
1144
  */
1145
- function wpdm_get_package($ID){
 
1146
  return \WPDM\Package::Get($ID);
1147
  }
1148
 
@@ -1152,7 +1171,8 @@ function wpdm_get_package($ID){
1152
  * @param $meta
1153
  * @return mixed
1154
  */
1155
- function get_package_data($ID, $key){
 
1156
  return \WPDM\Package::Get($ID, $key);
1157
  }
1158
 
@@ -1171,7 +1191,7 @@ function wpdm_check_invpass()
1171
  $password = $data[$_POST['wpdmfile']]['password'] != "" ? $data[$_POST['wpdmfile']]['password'] : $packagemeta['password'];
1172
  if ($password == $_POST['actioninddlpvr'] || strpos($password, "[" . $_POST['actioninddlpvr'] . "]") !== FALSE) {
1173
  $id = uniqid();
1174
- update_post_meta($fileid, "__wpdmkey_".$id, 8);
1175
  die("|ok|$id|");
1176
  } else
1177
  die('|error|');
@@ -1183,7 +1203,7 @@ function wpdm_check_invpass()
1183
  */
1184
  function wpdm_generate_password()
1185
  {
1186
- if(!current_user_can('manage_options') || !wpdm_is_ajax()) die();
1187
  include(wpdm_tpl_path('wpdm-generate-password.php'));
1188
  die();
1189
 
@@ -1218,21 +1238,23 @@ function quote_it($value)
1218
  return $value;
1219
  }
1220
 
1221
- function wpdm_view_countplus(){
1222
- if(isset($_REQUEST['_nonce'])&&wp_verify_nonce($_REQUEST['_nonce'],"__wpdm_view_count")){
 
1223
 
1224
  $id = intval($_REQUEST['id']);
1225
  $views = (int)get_post_meta($id, '__wpdm_view_count', true);
1226
- update_post_meta($id, '__wpdm_view_count', $views+1);
1227
- echo $views+1;
1228
  die();
1229
 
1230
  }
1231
  }
1232
 
1233
 
1234
- function wpdm_array_splice_assoc(&$input, $offset, $length, $replacement) {
1235
- $replacement = (array) $replacement;
 
1236
  $key_indices = array_flip(array_keys($input));
1237
  if (isset($input[$offset]) && is_string($offset)) {
1238
  $offset = $key_indices[$offset];
@@ -1250,14 +1272,15 @@ function wpdm_array_splice_assoc(&$input, $offset, $length, $replacement) {
1250
  * Added from v4.1.1
1251
  * WPDM add-on installer
1252
  */
1253
- function wpdm_install_addon(){
1254
- if(isset($_REQUEST['addon']) && current_user_can('manage_options') && wp_verify_nonce($_REQUEST['__wpdmpinn'], $_REQUEST['addon'].NONCE_KEY)){
1255
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
 
1256
  include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1257
  include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1258
- $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
1259
- $plugin_dir = isset($_REQUEST['dirname'])?esc_attr($_REQUEST['dirname']):false;
1260
- if($plugin_dir) {
1261
  $plugin_data = wpdm_plugin_data($plugin_dir);
1262
  $plugin_file = $plugin_data ? $plugin_data['plugin_index_file'] : false;
1263
  if ($plugin_file) {
@@ -1267,7 +1290,7 @@ function wpdm_install_addon(){
1267
  delete_plugins(array($plugin_file));
1268
  }
1269
  }
1270
- $downloadlink = 'https://www.wpdownloadmanager.com/?wpdmdl='.(int)$_REQUEST['addon'];
1271
  $upgrader->install($downloadlink);
1272
  die();
1273
  } else {
@@ -1278,21 +1301,22 @@ function wpdm_install_addon(){
1278
  /**
1279
  * @usage Active premium package add-on / shopping cart
1280
  */
1281
- function wpdm_activate_shop(){
1282
- if( current_user_can(WPDM_ADMIN_CAP)){
 
1283
  include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1284
  include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1285
- $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
1286
  $downloadlink = 'https://www.wpdownloadmanager.com/?wpdmdl=15671';
1287
  ob_start();
1288
  echo "<div id='acto'>";
1289
- if(file_exists(dirname(dirname(__FILE__)).'/wpdm-premium-packages/'))
1290
  $upgrader->upgrade($downloadlink);
1291
  else
1292
  $upgrader->install($downloadlink);
1293
  echo '</div><style>#acto .wrap { display: none; }</style>';
1294
  $data = ob_get_clean();
1295
- if(file_exists(dirname(WPDM_BASE_DIR).'/wpdm-premium-packages/wpdm-premium-packages.php')) {
1296
  activate_plugin('wpdm-premium-packages/wpdm-premium-packages.php');
1297
  echo "Congratulation! Your Digital Store is Activated. <a href='' class='btn btn-warning'>Refresh The Page!</a>";
1298
  } else
@@ -1312,7 +1336,8 @@ function wpdm_activate_shop(){
1312
  * @return string
1313
  * @usage Generates thumbnail html from PDF file attached with a Package. [ From v4.1.3 ]
1314
  */
1315
- function wpdm_pdf_preview($pid, $w, $h, $echo = true){
 
1316
 
1317
  $post = get_post($pid);
1318
  $files = get_post_meta($pid, '__wpdm_files', true);
@@ -1323,13 +1348,13 @@ function wpdm_pdf_preview($pid, $w, $h, $echo = true){
1323
  $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($pid), 'full');
1324
  $preview = $thumb['0'];
1325
 
1326
- if($ext=='pdf')
1327
- $pdf_thumb = wpdm_pdf_thumbnail($pdf, $pid);
1328
  else $pdf_thumb = $preview;
1329
 
1330
- $imsrc = wpdm_dynamic_thumb($pdf_thumb, array($w, $h));
1331
 
1332
- if(!$echo)
1333
  return "<img src='{$imsrc}' alt='{$post->post_title}'/>";
1334
 
1335
  echo "<img src='{$imsrc}' alt='{$post->post_title}'/>";
@@ -1342,35 +1367,43 @@ function wpdm_pdf_preview($pid, $w, $h, $echo = true){
1342
  * @return string
1343
  * @usage Generates thumbnail from PDF file. [ From v4.1.3 ]
1344
  */
1345
- function wpdm_pdf_thumbnail($pdf, $id){
 
1346
  return \WPDM\libs\FileSystem::pdfThumbnail($pdf, $id);
1347
  }
1348
 
1349
 
1350
- function wpdm_media_field($data){
 
1351
  ob_start();
1352
  $attrs = '';
1353
- if(isset($data['attrs'])) {
1354
- foreach ($data['attrs'] as $attr => $value){
1355
  $attrs .= "$attr='$value' ";
1356
  }
1357
  }
1358
  ?>
1359
  <div class="input-group">
1360
- <input placeholder="<?php echo $data['placeholder']; ?>" <?php echo $attrs; ?> type="url" name="<?php echo $data['name']; ?>" id="<?php echo isset($data['id'])?$data['id']:($id = uniqid()); ?>" class="form-control" value="<?php echo isset($data['value']) ? $data['value'] : ''; ?>"/>
 
 
 
1361
  <span class="input-group-btn">
1362
- <button class="btn btn-secondary btn-media-upload" type="button" rel="#<?php echo isset($data['id'])?$data['id']:$id; ?>"><i class="far fa-image"></i></button>
 
 
1363
  </span>
1364
  </div>
1365
  <?php
1366
  return ob_get_clean();
1367
  }
1368
 
1369
- function wpdm_image_selector($data){
 
1370
  ob_start();
1371
  $attrs = '';
1372
- if(isset($data['attrs'])) {
1373
- foreach ($data['attrs'] as $attr => $value){
1374
  $attrs .= "$attr='$value' ";
1375
  }
1376
  }
@@ -1378,22 +1411,29 @@ function wpdm_image_selector($data){
1378
  ?>
1379
  <div class="panel panel-default text-center image-selector-panel" style="width: 250px">
1380
  <div class="panel-body">
1381
- <img id="<?php echo isset($data['id'])?$data['id']:$id; ?>" src="<?php echo isset($data['value']) && $data['value'] != '' ? $data['value'] : WPDM_BASE_URL.'assets/images/image.png'; ?>" />
 
1382
  </div>
1383
  <div class="panel-footer">
1384
- <input id="<?php echo isset($data['id'])?$data['id']:$id; ?>_hidden" type="hidden" name="<?php echo $data['name']; ?>" value="<?php echo isset($data['value']) ? $data['value'] : ''; ?>"/>
1385
- <button class="btn btn-info btn-block btn-image-selector" type="button" rel="#<?php echo isset($data['id'])?$data['id']:$id; ?>"><i class="far fa-image"></i> <?php isset($data['btnlabel'])?$data['btnlabel']:_e('Select Image', 'download-manager'); ?></button>
 
 
 
 
 
1386
  </div>
1387
  </div>
1388
  <?php
1389
  return ob_get_clean();
1390
  }
1391
 
1392
- function wpdm_image_uploader($data){
 
1393
  ob_start();
1394
  $attrs = '';
1395
- if(isset($data['attrs'])) {
1396
- foreach ($data['attrs'] as $attr => $value){
1397
  $attrs .= "$attr='$value' ";
1398
  }
1399
  }
@@ -1402,63 +1442,77 @@ function wpdm_image_uploader($data){
1402
  <div id="wpdm-upload-ui" class="panel panel-default text-center image-selector-panel" style="width: 250px">
1403
  <div id="wpdm-drag-drop-area">
1404
  <div class="panel-body">
1405
- <img id="<?php echo isset($data['id'])?$data['id']:$id; ?>" src="<?php echo isset($data['value']) && $data['value'] != '' ? $data['value'] : WPDM_BASE_URL.'assets/images/image.png'; ?>" />
 
1406
  </div>
1407
  <div class="panel-footer">
1408
- <input id="<?php echo isset($data['id'])?$data['id']:$id; ?>_hidden" type="hidden" name="<?php echo $data['name']; ?>" value="<?php echo isset($data['value']) ? $data['value'] : ''; ?>"/>
1409
-
1410
- <button id="wpdm-browse-button" style="font-size: 9px;text-transform: unset" type="button" class="btn btn-info btn-block"><?php echo isset($data['btnlabel'])?$data['btnlabel']:__('SELECT IMAGE', 'download-manager'); ?></button>
1411
- <div class="progress" id="wmprogressbar" style="height: 30px !important;border-radius: 3px !important;margin: 0;position: relative;background: #0d406799;display: none;box-shadow: none">
1412
- <div id="wmprogress" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;line-height: 30px;background-color: #007bff"></div>
1413
- <div class="fetfont" style="font-size:9px;position: absolute;line-height: 30px;height: 30px;width: 100%;z-index: 999;text-align: center;color: #ffffff;font-weight: 800;letter-spacing: 1px">UPLOADING... <span id="wmloaded">0</span>%</div>
 
 
 
 
 
 
 
 
 
1414
  </div>
1415
 
1416
  <?php
1417
 
1418
  $plupload_init = array(
1419
- 'runtimes' => 'html5,silverlight,flash,html4',
1420
- 'browse_button' => 'wpdm-browse-button',
1421
- 'container' => 'wpdm-upload-ui',
1422
- 'drop_element' => 'wpdm-drag-drop-area',
1423
- 'file_data_name' => 'wpdm_file',
1424
- 'multiple_queues' => false,
1425
- 'url' => admin_url('admin-ajax.php'),
1426
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
1427
  'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
1428
- 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => 'png,jpg,jpeg,gif')),
1429
- 'multipart' => true,
1430
- 'urlstream_upload' => true,
1431
 
1432
  // additional post data to send to our ajax hook
1433
- 'multipart_params' => array(
1434
  '_ajax_nonce' => wp_create_nonce(NONCE_KEY),
1435
- 'action' => $data['action'], // the ajax action name
1436
  ),
1437
  );
1438
 
1439
- $plupload_init['max_file_size'] = wp_max_upload_size().'b';
1440
 
1441
  // we should probably not apply this filter, plugins may expect wp's media uploader...
1442
  $plupload_init = apply_filters('plupload_init', $plupload_init); ?>
1443
 
1444
  <script type="text/javascript">
1445
 
1446
- jQuery(function($){
1447
 
1448
  // create the uploader and pass the config from above
1449
  var uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?>);
1450
 
1451
  // checks if browser supports drag and drop upload, makes some css adjustments if necessary
1452
- uploader.bind('Init', function(up){
1453
  var uploaddiv = $('#wpdm-upload-ui');
1454
 
1455
- if(up.features.dragdrop){
1456
  uploaddiv.addClass('drag-drop');
1457
  $('#drag-drop-area')
1458
- .bind('dragover.wp-uploader', function(){ uploaddiv.addClass('drag-over'); })
1459
- .bind('dragleave.wp-uploader, drop.wp-uploader', function(){ uploaddiv.removeClass('drag-over'); });
1460
-
1461
- }else{
 
 
 
 
1462
  uploaddiv.removeClass('drag-drop');
1463
  $('#drag-drop-area').unbind('.wp-uploader');
1464
  }
@@ -1466,21 +1520,21 @@ function wpdm_image_uploader($data){
1466
 
1467
  uploader.init();
1468
 
1469
- uploader.bind('Error', function(uploader, error){
1470
  wpdm_bootModal('Error', error.message);
1471
  $('#wmprogressbar').hide();
1472
  $('#wpdm-browse-button').show();
1473
  });
1474
 
1475
  // a file was added in the queue
1476
- uploader.bind('FilesAdded', function(up, files){
1477
  //var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
1478
 
1479
  $('#wpdm-browse-button').hide(); //attr('disabled', 'disabled');
1480
  $('#wmprogressbar').show();
1481
 
1482
- plupload.each(files, function(file){
1483
- $('#wmprogress').css('width', file.percent+"%");
1484
  $('#wmloaded').html(file.percent);
1485
  //jQuery('#wpdm-browse-button').hide(); //.html('<span id="' + file.id + '"><i class="fas fa-sun fa-spin"></i> <?php _e('Uploading', 'download-manager'); ?> (<span>' + plupload.formatSize(0) + '</span>/' + plupload.formatSize(file.size) + ') </span>');
1486
  });
@@ -1489,19 +1543,19 @@ function wpdm_image_uploader($data){
1489
  up.start();
1490
  });
1491
 
1492
- uploader.bind('UploadProgress', function(up, file) {
1493
  //jQuery('#' + file.id + " span").html(plupload.formatSize(parseInt(file.size * file.percent / 100)));
1494
- $('#wmprogress').css('width', file.percent+"%");
1495
  $('#wmloaded').html(file.percent);
1496
  });
1497
 
1498
 
1499
  // a file was uploaded
1500
- uploader.bind('FileUploaded', function(up, file, response) {
1501
  res = JSON.parse(response.response);
1502
- $('#<?php echo isset($data['id'])?$data['id']:$id; ?>').attr('src', res.image_url);
1503
  $('#wmprogressbar').hide();
1504
- $('#wpdm-browse-button').show(); //removeAttr('disabled').html('<?php echo isset($data['btnlabel'])?$data['btnlabel']:__('SELECT IMAGE', 'download-manager'); ?>');
1505
 
1506
  });
1507
 
@@ -1523,15 +1577,20 @@ function wpdm_image_uploader($data){
1523
  /**
1524
  * @usage Show admin notices
1525
  */
1526
- function wpdm_admin_notices() {
 
1527
  global $wp_query;
1528
- if(get_post_type()=='wpdmpro' && isset($wp_query->query_vars['posts_per_page'])){
1529
  ?>
1530
  <div class="updated" style="border: 2px solid #ffffff !important;border-radius: 0;">
1531
  <p>
1532
  <strong>Download Manager Pro!</strong><br/>
1533
- <i><a href="https://www.wpdownloadmanager.com/?affid=admin&amp;domain=localhost" target="_blank">Get Download Manager Pro Version Now! </a></i>
1534
- <a style="float:right;margin-top: -23px;margin-right: -6px;border: 0 none;border-radius: 0;box-shadow: none;text-shadow: none !important;font-weight: bold" class="button button-primary button-hero" href="https://www.wpdownloadmanager.com/?affid=admin&amp;domain=localhost#features" target="_blank">Checkout The Features Here &rarr;</a>
 
 
 
 
1535
  </p>
1536
  </div>
1537
  <?php
@@ -1539,76 +1598,79 @@ function wpdm_admin_notices() {
1539
  }
1540
 
1541
 
1542
-
1543
  /**
1544
  * @usage Show Login Form
1545
  */
1546
- function wpdm_login_form($params = array()){
 
1547
  return WPDM()->shortCode->loginForm($params);
1548
  }
1549
 
1550
- function wpdm_user_dashboard_url(){
 
1551
  $id = get_option('__wpdm_user_dashboard', 0);
1552
- if($id > 0) {
1553
  $url = get_permalink($id);
1554
- }
1555
- else $url = home_url('/');
1556
  return $url;
1557
  }
1558
 
1559
- function wpdm_registration_url(){
 
1560
  $id = get_option('__wpdm_register_url', 0);
1561
- if($id > 0) {
1562
  $url = get_permalink($id);
1563
 
1564
- }
1565
- else $url = wp_registration_url();
1566
  return $url;
1567
  }
1568
 
1569
- function wpdm_login_url($redirect = ''){
 
1570
  $id = get_option('__wpdm_login_url', 0);
1571
- if($id > 0) {
1572
  $url = get_permalink($id);
1573
- if($redirect != '')
1574
- $url .= (strstr($url,'?')?'&':'?').'redirect_to='.$redirect;
1575
- }
1576
- else $url = wp_login_url($redirect);
1577
  return $url;
1578
  }
1579
 
1580
- function wpdm_lostpassword_url(){
 
1581
  return add_query_arg(array('action' => 'lostpassword'), wpdm_login_url());
1582
  }
1583
 
1584
- function wpdm_logout_url($redirect = ''){
1585
- $logout_url = home_url("/?logout=".wp_create_nonce(NONCE_KEY));
1586
- return $redirect!=''?add_query_arg(array('redirect_to' => $redirect), $logout_url):$logout_url;
 
1587
  }
1588
 
1589
 
1590
- function wpdm_user_logged_in($msg){
 
1591
  echo $msg;
1592
  }
1593
 
1594
 
1595
-
1596
  /**
1597
  * @usage Returns download manager template file path
1598
  * @param $file
1599
  * @param string $tpldir
1600
  * @return string
1601
  */
1602
- function wpdm_tpl_path1($file, $tpldir = ''){
1603
- if(file_exists(get_stylesheet_directory().'/download-manager/'.$file))
1604
- $path = get_stylesheet_directory().'/download-manager/'.$file;
1605
- else if(file_exists(get_template_directory().'/download-manager/'.$file))
1606
- $path = get_template_directory().'/download-manager/'.$file;
1607
- else if($tpldir !='' && file_exists($tpldir.'/'.$file))
1608
- $path = $tpldir.'/'.$file;
1609
- else if($tpldir !='' && file_exists(get_template_directory().'/download-manager/'.$tpldir.'/'.$file))
1610
- $path = get_template_directory().'/download-manager/'.$tpldir.'/'.$file;
1611
- else $path = WPDM_BASE_DIR.'tpls/'.$file;
 
1612
 
1613
  return $path;
1614
 
@@ -1620,21 +1682,22 @@ function wpdm_tpl_path1($file, $tpldir = ''){
1620
  * @param string $tpldir
1621
  * @return string
1622
  */
1623
- function wpdm_tpl_path($file, $tpldir = '', $fallback = ''){
1624
- if(file_exists(get_stylesheet_directory().'/download-manager/'.$file))
1625
- $path = get_stylesheet_directory().'/download-manager/'.$file;
1626
- else if(file_exists(get_template_directory().'/download-manager/'.$file))
1627
- $path = get_template_directory().'/download-manager/'.$file;
1628
- else if($tpldir !=='' && file_exists($tpldir.'/'.$file))
1629
- $path = $tpldir.'/'.$file;
1630
- else if($tpldir !='' && file_exists(get_template_directory().'/download-manager/'.$tpldir.'/'.$file))
1631
- $path = get_template_directory().'/download-manager/'.$tpldir.'/'.$file;
1632
- else $path = WPDM_TPL_DIR.$file;
 
1633
 
1634
  /* Fallack template directory*/
1635
- if($fallback == '') $fallback = WPDM_TPL_FALLBACK;
1636
- if($fallback !== '' && !file_exists($path))
1637
- $path = $fallback."/".$file;
1638
 
1639
  //if(!file_exists($path))
1640
  //wpdmdd($path);
@@ -1647,23 +1710,24 @@ function wpdm_tpl_path($file, $tpldir = '', $fallback = ''){
1647
  * @param $range
1648
  * @return bool
1649
  */
1650
- function wpdm_ip_in_range( $ip, $range ) {
 
1651
  // Check IP range
1652
 
1653
  list($subnet, $bits) = explode('/', $range);
1654
- if(!$bits || (int)$bits < 1) return false;
1655
  // Convert subnet to binary string of $bits length
1656
  $subnet = unpack('H*', @inet_pton($subnet)); // Subnet in Hex
1657
- foreach($subnet as $i => $h) $subnet[$i] = base_convert($h, 16, 2); // Array of Binary
1658
  $subnet = substr(implode('', $subnet), 0, $bits); // Subnet in Binary, only network bits
1659
 
1660
  // Convert remote IP to binary string of $bits length
1661
  $ip = unpack('H*', @inet_pton($ip)); // IP in Hex
1662
- foreach($ip as $i => $h) $ip[$i] = base_convert($h, 16, 2); // Array of Binary
1663
  $ip = substr(implode('', $ip), 0, $bits); // IP in Binary, only network bits
1664
 
1665
  // Check network bits match
1666
- if($subnet == $ip) {
1667
  return true;
1668
  }
1669
  return false;
@@ -1673,21 +1737,22 @@ function wpdm_ip_in_range( $ip, $range ) {
1673
  * @param null $ip
1674
  * @return bool
1675
  */
1676
- function wpdm_ip_blocked($ip = null){
1677
- $ip = $ip?$ip:wpdm_get_client_ip();
 
1678
  $allblocked = get_option('__wpdm_blocked_ips', '');
1679
  $allblocked = explode("\n", str_replace("\r", "", $allblocked));
1680
  $isblocked = false;
1681
  foreach ($allblocked as $blocked) {
1682
- if(strstr($blocked, '/'))
1683
  $isblocked = wpdm_ip_in_range($ip, $blocked);
1684
- else if(strstr($blocked, '*')){
1685
- preg_match('/'.$blocked.'/', $ip, $matches);
1686
- $isblocked = count($matches) > 0?true:false;
1687
- } else if( $ip == $blocked )
1688
  $isblocked = true;
1689
 
1690
- if($isblocked == true) return $isblocked;
1691
 
1692
  }
1693
  return $isblocked;
@@ -1696,19 +1761,20 @@ function wpdm_ip_blocked($ip = null){
1696
  /**
1697
  * @return string or bool
1698
  */
1699
- function wpdm_get_client_ip() {
 
1700
  $ipaddress = '';
1701
  if (isset($_SERVER['HTTP_CLIENT_IP']))
1702
  $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
1703
- else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
1704
  $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
1705
- else if(isset($_SERVER['HTTP_X_FORWARDED']))
1706
  $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
1707
- else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
1708
  $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
1709
- else if(isset($_SERVER['HTTP_FORWARDED']))
1710
  $ipaddress = $_SERVER['HTTP_FORWARDED'];
1711
- else if(isset($_SERVER['REMOTE_ADDR']))
1712
  $ipaddress = $_SERVER['REMOTE_ADDR'];
1713
  else
1714
  $ipaddress = false;
@@ -1722,54 +1788,56 @@ function wpdm_get_client_ip() {
1722
  * @return bool|int
1723
  * @since 4.7.4
1724
  */
1725
- function is_wpdmkey_valid($ID, $_key, $update = false){
1726
- if($_key == '') return 0; // Invalid
 
1727
 
1728
- $key = "__wpdmkey_".$_key;
1729
  $xlimit = get_post_meta($ID, $key, true);
1730
 
1731
- if(!$xlimit) return 0; // Invalid
1732
 
1733
  $xlimit = maybe_unserialize($xlimit);
1734
- if(!is_array($xlimit)) return 0;
1735
 
1736
- $limit = isset($xlimit['use'])?$xlimit['use']:0;
1737
 
1738
  $expired = false;
1739
 
1740
  if ($limit <= 0) {
1741
  delete_post_meta($ID, $key);
1742
  return -1; // Limit exceeded
1743
- }
1744
- else {
1745
 
1746
- $limit --;
1747
  $xlimit['use'] = $limit;
1748
 
1749
- if($xlimit['expire'] < time()){
1750
  $xlimit['use'] = $limit = 0;
1751
  $expired = true;
1752
  }
1753
- if($update)
1754
  update_post_meta($ID, $key, $xlimit);
1755
- if($expired) return -2; // Time expired
1756
  }
1757
  return 1;
1758
  }
1759
 
1760
 
1761
- function wpdm_is_url( $url ) {
1762
- $result = ( false !== filter_var( $url, FILTER_VALIDATE_URL ) );
1763
- return apply_filters( 'wpdm_is_url', $result, $url );
 
1764
  }
1765
 
1766
  /**
1767
  * @param null $uid
1768
  * @return int
1769
  */
1770
- function wpdm_total_downloads($uid = null){
 
1771
  global $wpdb;
1772
- if(isset($uid) && $uid > 0)
1773
  $download_count = $wpdb->get_var("select sum(pm.meta_value) from {$wpdb->prefix}postmeta pm, {$wpdb->prefix}posts p where meta_key='__wpdm_download_count' and p.ID = pm.post_id and p.post_author = '{$uid}'");
1774
  else
1775
  $download_count = $wpdb->get_var("select sum(meta_value) from {$wpdb->prefix}postmeta where meta_key='__wpdm_download_count'");
@@ -1780,9 +1848,10 @@ function wpdm_total_downloads($uid = null){
1780
  * @param null $uid
1781
  * @return mixed
1782
  */
1783
- function wpdm_total_views($uid = null){
 
1784
  global $wpdb;
1785
- if(isset($uid) && $uid > 0)
1786
  $download_count = $wpdb->get_var("select sum(pm.meta_value) from {$wpdb->prefix}postmeta pm, {$wpdb->prefix}posts p where meta_key='__wpdm_view_count' and p.ID = pm.post_id and p.post_author = '{$uid}'");
1787
  else
1788
  $download_count = $wpdb->get_var("select sum(meta_value) from {$wpdb->prefix}postmeta where meta_key='__wpdm_view_count'");
@@ -1796,22 +1865,23 @@ function wpdm_total_views($uid = null){
1796
  * @param string $var
1797
  * @return string
1798
  */
1799
- function wpdm_paginate_links($total, $items_per_page, $current_page = 1, $var = 'cp', $params = array()){
 
1800
 
1801
- $pages = ceil($total/$items_per_page);
1802
 
1803
  $args = array(
1804
  //'base' => '%_%',
1805
- 'format' => "?{$var}=%#%",
1806
- 'total' => $pages,
1807
- 'current' => $current_page,
1808
  //'show_all' => false,
1809
  //'end_size' => 2,
1810
  //'mid_size' => 1,
1811
  //'prev_next' => true,
1812
- 'prev_text' => isset($params['prev_text'])?$params['prev_text']:__('Previous'),
1813
- 'next_text' => isset($params['prev_text'])?$params['next_text']:__('Next'),
1814
- 'type' => 'array',
1815
  //'add_args' => false,
1816
  //'add_fragment' => '',
1817
  //'before_page_number' => '',
@@ -1821,31 +1891,47 @@ function wpdm_paginate_links($total, $items_per_page, $current_page = 1, $var =
1821
  $pags = paginate_links($args);
1822
  //wpdmprecho($pags);
1823
  $phtml = "";
1824
- if(is_array($pags)) {
1825
  foreach ($pags as $pagl) {
1826
- if(isset($params['container'])){
1827
  $pagl = str_replace("<a", "<a data-container='{$params['container']}'", $pagl);
1828
  }
1829
  $phtml .= "<li>{$pagl}</li>";
1830
  }
1831
  }
1832
- $async = isset($params['async']) && $params['async']?' async':'';
1833
  $phtml = "<div class='text-center'><ul class='pagination wpdm-pagination pagination-centered text-center{$async}'>{$phtml}</ul></div>";
1834
  return $phtml;
1835
  }
1836
 
1837
 
1838
- function wpdm_download_button_style($p = null, $pacakge_ID = null){
1839
- if(is_singular('wpdmpro') || $p === true)
 
1840
  $ui_button = get_option('__wpdm_ui_download_button');
1841
  else
1842
  $ui_button = get_option('__wpdm_ui_download_button_sc');
1843
- $class = "btn ".(isset($ui_button['color'])?$ui_button['color']:'btn-primary')." ".(isset($ui_button['size'])?$ui_button['size']:'');
1844
  $class = apply_filters("wpdm_download_button_style", $class, $pacakge_ID);
1845
  return $class;
1846
  }
1847
 
1848
- function wpdm_hex2rgb($hex){
 
1849
  list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x");
1850
  return "$r, $g, $b";
1851
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  global $wpdm_message, $btnclass;
4
 
5
 
6
+ function wpdm_zip_package($package)
7
+ {
8
  return \WPDM\Package::Zip($package['ID']);
9
  }
10
 
24
  * @param $zipname
25
  * @return bool|string
26
  */
27
+ function wpdm_zip_files($files, $zipname)
28
+ {
29
 
30
  return \WPDM\libs\FileSystem::zipFiles($files, $zipname);
31
  }
42
  function wpdm_download_file($filepath, $filename, $speed = 0, $resume_support = 1, $extras = array())
43
  {
44
 
45
+ if (isset($_GET['play'])) $extras['play'] = esc_attr($_GET['play']);
46
+ \WPDM\libs\FileSystem::downloadFile($filepath, $filename, $speed, $resume_support, $extras);
47
 
48
  }
49
 
53
  * @usage Returns the user roles who has access to specified package
54
  * @return array|mixed
55
  */
56
+ function wpdm_allowed_roles($id)
57
+ {
58
+ return \WPDM\Package::AllowedRoles($id);
59
  }
60
 
61
 
66
  *
67
  * @return bool
68
  */
69
+ function wpdm_user_has_access($id, $type = 'package')
70
+ {
71
  return \WPDM\Package::UserCanAccess($id, $type);
72
  }
73
 
82
  function downloadLink(&$package, $embed = 0, $extras = array())
83
  {
84
  global $wpdb, $current_user, $wpdm_download_icon, $wpdm_download_lock_icon, $btnclass;
85
+ if (is_array($extras))
86
+ extract($extras);
87
  $data = '';
88
  //get_currentuserinfo();
89
 
91
  //$loginmsg = wpdm_escs(htmlspecialchars_decode($loginmsg));
92
 
93
  $package['link_url'] = home_url('/?download=1&');
94
+ $package['link_label'] = !isset($package['link_label']) || $package['link_label'] == '' ? __("Download", 'download-manager') : $package['link_label'];
95
 
96
  //Change link label using a button image
97
  $package['link_label'] = apply_filters('wpdm_button_image', $package['link_label'], $package);
100
  $package['download_url'] = wpdm_download_url($package);
101
  if (wpdm_is_download_limit_exceed($package['ID'])) {
102
  $package['download_url'] = '#';
103
+ $package['link_label'] = __('Download Limit Exceeded', 'download-manager');
104
  }
105
  if (isset($package['expire_date']) && $package['expire_date'] != "" && strtotime($package['expire_date']) < time()) {
106
  $package['download_url'] = '#';
107
+ $package['link_label'] = __('Download was expired on', 'download-manager') . " " . date_i18n(get_option('date_format') . " h:i A", strtotime($package['expire_date']));
108
  $package['download_link'] = "<a href='#'>{$package['link_label']}</a>";
109
+ return "<div class='alert alert-warning'><b>" . __('Download:', 'download-manager') . "</b><br/>{$package['link_label']}</div>";
110
  }
111
 
112
+ if (isset($package['publish_date']) && $package['publish_date'] != '' && strtotime($package['publish_date']) > time()) {
113
  $package['download_url'] = '#';
114
+ $package['link_label'] = __('Download will be available from ', 'download-manager') . " " . date_i18n(get_option('date_format') . " h:i A", strtotime($package['publish_date']));
115
  $package['download_link'] = "<a href='#'>{$package['link_label']}</a>";
116
+ return "<div class='alert alert-warning'><b>" . __('Download:', 'download-manager') . "</b><br/>{$package['link_label']}</div>";
117
  }
118
 
119
+ $link_label = isset($package['link_label']) ? $package['link_label'] : __('Download', 'download-manager');
120
 
121
+ $package['access'] = wpdm_allowed_roles($package['ID']);
122
 
123
  if ($package['download_url'] != '#')
124
  $package['download_link'] = "<a class='wpdm-download-link {$btnclass}' rel='nofollow' href='#' onclick=\"location.href='{$package['download_url']}';return false;\"><i class='$wpdm_download_icon'></i>{$link_label}</a>";
125
  else
126
+ $package['download_link'] = "<div class='alert alert-warning'><b>" . __('Download:', 'download-manager') . "</b><br/>{$link_label}</div>";
127
  $caps = array_keys($current_user->caps);
128
  $role = array_shift($caps);
129
 
130
+ $matched = (is_array(@maybe_unserialize($package['access'])) && is_user_logged_in()) ? array_intersect($current_user->roles, @maybe_unserialize($package['access'])) : array();
131
 
132
  $skiplink = 0;
133
 
134
  if (is_user_logged_in() && count($matched) <= 0 && !@in_array('guest', @maybe_unserialize($package['access']))) {
135
  $package['download_url'] = "#";
136
+ $package['download_link'] = $package['download_link_extended'] = stripslashes(get_option('wpdm_permission_msg', __('Permission Denied', 'download-manager')));
137
  $package = apply_filters('download_link', $package);
138
+ if (get_option('_wpdm_hide_all', 0) == 1) {
139
+ $package['download_link'] = $package['download_link_extended'] = 'blocked';
140
+ }
141
  return $package['download_link'];
142
  }
143
  if (!@in_array('guest', @maybe_unserialize($package['access'])) && !is_user_logged_in()) {
144
 
145
+ $loginform = wpdm_login_form(array('redirect' => get_permalink($package['ID'])));
146
  if (get_option('_wpdm_hide_all', 0) == 1) return 'loginform';
147
  $package['download_url'] = home_url('/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
148
+ $package['download_link'] = stripcslashes(str_replace(array("[loginform]", "[this_url]"), array($loginform, get_permalink($package['ID'])), $loginmsg));
149
  return get_option('__wpdm_login_form', 0) == 1 ? $loginform : $package['download_link'];
150
 
151
  }
156
  if (!isset($package['quota']) || (isset($package['quota']) && $package['quota'] > 0 && $package['quota'] > $package['download_count']) || $package['quota'] == 0) {
157
  $lock = 0;
158
 
159
+ if ($package['password'] != '') {
160
  $lock = 'locked';
161
  $data = \WPDM\libs\PackageLocks::AskPassword($package);
162
  }
166
 
167
  if (isset($package['captcha_lock']) && (int)$package['captcha_lock'] == 1) {
168
  $lock = 'locked';
169
+ $sociallock .= \WPDM\libs\PackageLocks::reCaptchaLock($package, true);
170
 
171
  }
172
 
175
 
176
  if (is_array($extralocks) && $extralocks['lock'] === 'locked') {
177
 
178
+ if (isset($extralocks['type']) && $extralocks['type'] == 'social')
179
  $sociallock .= $extralocks['html'];
180
  else
181
  $data .= $extralocks['html'];
183
  $lock = 'locked';
184
  }
185
 
186
+ if ($sociallock != "") {
187
+ $data .= "<div class='panel panel-default'><div class='panel-heading'>" . __("Download", 'download-manager') . "</div><div class='panel-body wpdm-social-locks text-center'>{$sociallock}</div></div>";
188
  }
189
 
190
  if ($lock === 'locked') {
204
 
205
 
206
  }
207
+ } else {
208
+ $data = __("Download limit exceeded!", 'download-manager');
 
209
  }
210
 
211
 
220
  * @param $email
221
  * @return bool
222
  */
223
+ function wpdm_verify_email($email)
224
+ {
225
+ $dns_verify = get_option('__wpdm_verify_dns', 0);
226
+ $blocked_domains = explode("\n", str_replace("\r", "", get_option('__wpdm_blocked_domains', '')));
227
+ $blocked_emails = explode("\n", str_replace("\r", "", get_option('__wpdm_blocked_emails', '')));
228
  $eparts = explode("@", $email);
229
  $domain = $eparts[1];
230
+ if (!is_email($email)) return false;
231
+ if (in_array($email, $blocked_emails)) return false;
232
+ if (in_array($domain, $blocked_domains)) return false;
233
+ if ($dns_verify && !checkdnsrr($domain, 'MX')) return false;
234
  return true;
235
  }
236
 
255
 
256
  $data = array('error' => '', 'downloadurl' => '');
257
 
258
+ if (isset($_POST['reCaptchaVerify'])) {
259
  $ret = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array('method' => 'POST', 'body' => array('secret' => get_option('_wpdm_recaptcha_secret_key'), 'response' => $_POST['reCaptchaVerify'], 'remoteip' => $_SERVER['REMOTE_ADDR'])));
260
+ if (is_wp_error($ret)) {
261
  header("Content-type: application/json");
262
  $data['error'] = $ret->get_error_message();
263
  $data['downloadurl'] = '';
265
  die();
266
  }
267
  $ret = json_decode($ret['body']);
268
+ if ($ret->success == 1) {
269
  $download_url = \WPDM\Package::expirableDownloadLink($file['ID'], 3, 10800);
270
  $data['downloadurl'] = $download_url;
271
+ } else {
 
272
  $data['error'] = __("Captcha Verification Failed!", "wpmdpro");
273
  }
274
  header("Content-type: application/json");
287
  $adata = apply_filters("wpdmgetlink", $data, $file);
288
  $data = is_array($adata) ? $adata : $data;
289
 
290
+ if (!wpdm_is_ajax()) {
291
 
292
+ @setcookie("wpdm_getlink_data_" . $key, json_encode($data));
293
 
294
+ if (isset($data['downloadurl']) && $data['downloadurl'] != '') {
295
+ header("location: " . $data['downloadurl']);
296
  die();
297
  }
298
 
299
+ header("location: " . $_SERVER['HTTP_REFERER'] . "#nojs_popup|ckid:" . $key);
300
  die();
301
  }
302
 
307
  }
308
 
309
  $decoded_pass = htmlspecialchars_decode($file['password']);
310
+ if ($plock === 1 && $password !== $file['password'] && $password !== $decoded_pass && !strpos("__" . $file['password'], "[$password]") && !strpos("__" . $decoded_pass, "[$password]")) {
311
+ $data['error'] = '<span style="font-size: 8pt"><i class="fas fa-sync"></i> ' . __('Wrong Password! Try Again.', 'download-manager') . "</span>";
312
  $file = array();
313
  }
314
  if ($plock == 1 && $password == '') {
315
+ $data['error'] = '<span class="color-red" style="font-size: 8pt"><i class="fas fa-sync"></i> ' . __('Wrong Password! Try Again.', 'download-manager') . "</span>";
316
  $file = array();
317
  }
318
  $ux = "";
319
  if ($plock == 1 && isset($file['ID'])) {
320
+ update_post_meta($file['ID'], "__wpdmkey_" . $key, 3);
321
  }
322
 
323
+ if (isset($file['ID']) && $file['ID'] != '') {
324
+ $pu = isset($file['password_usage']) && is_array($file['password_usage']) ? $file['password_usage'] : array();
325
+ $pul = isset($file['password_usage_limit']) ? (int)$file['password_usage_limit'] : 99999999999;
326
 
327
  if (is_array($pu) && isset($pu[$password]) && $pu[$password] >= $pul && $pul > 0)
328
+ $data['error'] = __('Password usages limit exceeded', 'download-manager');
329
  else {
330
+ if (!is_array($pu)) $pu = array();
331
  \WPDM\Session::set("pass_verified_" . $file['ID'], 1);
332
+ $pu[$password] = isset($pu[$password]) ? $pu[$password] + 1 : 1;
333
  update_post_meta($file['ID'], '__wpdm_password_usage', $pu);
334
  }
335
  }
344
  $adata = apply_filters("wpdmgetlink", $data, $file);
345
  $data = is_array($adata) ? $adata : $data;
346
 
347
+ if (!wpdm_is_ajax()) {
348
 
349
+ @setcookie("wpdm_getlink_data_" . $key, json_encode($data));
350
 
351
+ if (isset($data['downloadurl']) && $data['downloadurl'] != '') {
352
+ header("location: " . $data['downloadurl']);
353
+ die();
354
+ }
355
 
356
+ header("location: " . $_SERVER['HTTP_REFERER'] . "#nojs_popup|ckid:" . $key);
357
+ die();
358
+ }
359
 
360
  header("Content-type: application/json");
361
  die(json_encode($data));
362
  }
363
 
364
 
 
365
  function wpdm_package_link_legacy($params)
366
  {
367
  extract($params);
368
+ $posts = get_posts(array("post_type" => "wpdmpro", "meta_key" => "__wpdm_legacy_id", "meta_value" => $params['id']));
369
  $data = (array)$posts[0];
370
+ if (!isset($data['ID'])) return "";
371
  $data = wpdm_setup_package_data($data);
372
 
373
  if ($data['ID'] == '') {
376
 
377
  $templates = maybe_unserialize(get_option("_fm_link_templates", true));
378
 
379
+ if (!isset($template) || $template == "") $template = $data['template'];
380
 
381
+ if (isset($template) && isset($templates[$template]) && isset($templates[$template]['content'])) $template = $templates[$template]['content'];
382
 
383
 
384
  return "<div class='w3eden'>" . FetchTemplate($template, $data, 'link') . "</div>";
392
  */
393
  function wpdm_downloadable($content)
394
  {
395
+ if (defined('WPDM_THEME_SUPPORT') && WPDM_THEME_SUPPORT == true) return $content;
396
+ if (get_post_type(get_the_ID()) != 'wpdmpro') return $content;
397
 
398
  global $wpdb, $current_user, $post, $wp_query, $wpdm_package;
399
  if (isset($wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')]) && $wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')] != '')
405
  $login_msg = wpdm_escs(htmlspecialchars_decode($login_msg));
406
  $user = new WP_User(null);
407
  if (isset($_GET[get_option('__wpdm_purl_base', 'download')]) && $_GET[get_option('__wpdm_purl_base', 'download')] != '' && $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] == '')
408
+ $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] = esc_attr($_GET[get_option('__wpdm_purl_base', 'download')]);
409
  $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] = isset($wp_query->query_vars[get_option('__wpdm_purl_base', 'download')]) ? urldecode($wp_query->query_vars[get_option('__wpdm_purl_base', 'download')]) : '';
410
 
411
  if (is_singular('wpdmpro')) {
412
  if (get_option('_wpdm_custom_template') == 1 || current_theme_supports('wpdm')) return $content;
413
 
414
+ $template = get_post_meta(get_the_ID(), '__wpdm_page_template', true);
415
  $data = FetchTemplate($template, get_the_ID(), 'page');
416
  $siteurl = site_url('/');
417
+ return "<div class='w3eden'>{$data}</div>";
418
  }
419
 
420
  return $content;
428
  * @param $id
429
  * @return int
430
  */
431
+ function wpdm_package_filecount($id)
432
+ {
433
  return \WPDM\Package::fileCount($id);
434
 
435
  }
439
  * @param $id
440
  * @return float|int|mixed|string
441
  */
442
+ function wpdm_package_size($id)
443
+ {
444
  return \WPDM\Package::Size($id);
445
  }
446
 
450
  * @param $file
451
  * @return float|int|mixed|string
452
  */
453
+ function wpdm_file_size($file)
454
+ {
455
+ if (file_exists($file))
456
  $_size = filesize($file);
457
+ else if (file_exists(UPLOAD_DIR . $file))
458
+ $_size = filesize(UPLOAD_DIR . $file);
459
  else $_size = 0;
460
  $size = $_size / 1024;
461
  if ($size > 1024) $size = number_format($size / 1024, 2) . ' MB';
462
  else $size = number_format($size, 2) . ' KB';
463
+ if ($size === '0.00 KB')
464
+ $size = $_size . " bytes";
465
  return $size;
466
  }
467
 
468
 
 
469
  /**
470
  * @usage Returns icons for package file types
471
  * @param $id
472
  * @param bool $img
473
  * @return array|string
474
  */
475
+ function wpdm_package_filetypes($id, $img = true)
476
+ {
477
 
478
  return \WPDM\Package::fileTypes($id, $img);
479
 
487
  * @param string $continue
488
  * @return string
489
  */
490
+ function wpdm_get_excerpt($post, $length = 100, $word_break = false, $continue = "...")
491
+ {
492
  $post = is_object($post) ? $post : get_post($post);
493
+ if (!is_object($post)) return '';
494
  $excerpt = get_the_excerpt($post);
495
+ if (!$excerpt) $excerpt = $post->post_content;
496
  $excerpt = strip_tags($excerpt);
497
  $excerpt = substr(trim($excerpt), 0, $length);
498
+ if (!$word_break) {
499
  $excerpt = explode(" ", $excerpt);
500
  array_pop($excerpt);
501
  $excerpt = implode(" ", $excerpt);
502
  }
503
+ return $excerpt . $continue;
504
  }
505
 
506
 
509
  * @param $html
510
  * @return null|string|string[]
511
  */
512
+ function wpdm_escs($html)
513
+ {
514
+ $html = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $html);
515
  $html = stripslashes_deep($html);
516
  return $html;
517
  }
526
 
527
  function wpdm_valueof($var, $index, $params = [])
528
  {
529
+ $index = explode("/", $index);
530
  $default = is_string($params) ? $params : '';
531
  $default = is_array($params) && isset($params['default']) ? $params['default'] : $default;
532
+ if (count($index) > 1) {
533
  $val = $var;
534
+ foreach ($index as $key) {
535
+ $val = is_array($val) && isset($val[$key]) ? $val[$key] : false;
536
  }
537
  } else
538
  $val = isset($var[$index[0]]) ? $var[$index[0]] : $default;
539
 
540
+ if (is_array($params) && isset($params['validate'])) {
541
  if (!is_array($val))
542
  $val = wpdm_sanitize_var($val, $params['validate']);
543
  else
556
  */
557
  function wpdm_query_var($var, $params = array())
558
  {
559
+ $_var = explode("/", $var);
560
+ if (count($_var) > 1) {
561
  $val = $_REQUEST;
562
+ foreach ($_var as $key) {
563
+ $val = is_array($val) && isset($val[$key]) ? $val[$key] : false;
564
  }
565
  } else
566
  $val = isset($_REQUEST[$var]) ? $_REQUEST[$var] : null;
567
  $validate = is_string($params) ? $params : '';
568
  $validate = is_array($params) && isset($params['validate']) ? $params['validate'] : $validate;
569
 
570
+ if (!is_array($val))
571
  $val = wpdm_sanitize_var($val, $validate);
572
  else
573
  $val = wpdm_sanitize_array($val, $validate);
580
  * @param $array
581
  * @return mixed
582
  */
583
+ function wpdm_sanitize_array($array, $sanitize = 'kses')
584
+ {
585
+ if (!is_array($array)) return esc_attr($array);
586
+ foreach ($array as $key => &$value) {
587
  $validate = is_array($sanitize) && isset($sanitize[$key]) ? $sanitize[$key] : $sanitize;
588
+ if (is_array($value))
589
  wpdm_sanitize_array($value, $validate);
590
  else {
591
  $value = wpdm_sanitize_var($value, $validate);
600
  * @param $value
601
  * @return string
602
  */
603
+ function wpdm_sanitize_var($value, $sanitize = 'kses')
604
+ {
605
+ if (is_array($value))
606
  return wpdm_sanitize_array($value, $sanitize);
607
  else {
608
+ switch ($sanitize) {
609
  case 'int':
610
  case 'num':
611
  return (int)$value;
658
  }
659
 
660
 
 
 
661
  function wpdm_category($params)
662
  {
663
+ $params['order_field'] = isset($params['order_by']) ? $params['order_by'] : 'date';
664
  unset($params['order_by']);
665
  if (isset($params['item_per_page']) && !isset($params['items_per_page'])) $params['items_per_page'] = $params['item_per_page'];
666
  unset($params['item_per_page']);
685
  }
686
 
687
 
688
+ function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN', 'items_per_page' => 10, 'title' => false, 'desc' => false, 'order_field' => 'date', 'order' => 'desc', 'paging' => false, 'toolbar' => 1, 'template' => '', 'cols' => 3, 'colspad' => 2, 'colsphone' => 1))
689
  {
690
  //die("<pre>".print_r($params, 1));
691
  extract($params);
692
  $fnparams = $params;
693
+ if (!isset($id) || $id == "") return;
694
+ if (!isset($items_per_page)) $items_per_page = 10;
695
+ if (!isset($template)) $template = 'link-template-calltoaction3.php';
696
+ if (!isset($cols)) $cols = 1;
697
+ if (!isset($colspad)) $colspad = 1;
698
+ if (!isset($colsphone)) $colsphone = 1;
699
+ if (!isset($toolbar)) $toolbar = 1;
700
  $taxo = 'wpdmcategory';
701
+ if (isset($tag) && $tag == 1) $taxo = 'post_tag';
702
+ $cwd_class = "col-md-" . (int)(12 / $cols);
703
+ $cwdsm_class = "col-sm-" . (int)(12 / $colspad);
704
+ $cwdxs_class = "col-xs-" . (int)(12 / $colsphone);
705
 
706
  $id = trim($id, ", ");
707
  $cids = explode(",", $id);
711
  $order_field = isset($order_field) ? $order_field : 'date';
712
  $order_field = isset($_GET['orderby']) ? esc_attr($_GET['orderby']) : $order_field;
713
  $order = isset($order) ? $order : 'desc';
714
+ $order = isset($_GET['order']) ? esc_attr($_GET['order']) : $order;
715
+ $operator = isset($operator) ? $operator : 'IN';
716
+ $cpvar = 'cp_' . $cids[0];
717
+ $cp = wpdm_query_var($cpvar, 'num');
718
+ if (!$cp) $cp = 1;
719
 
720
  $params = array(
721
  'post_type' => 'wpdmpro',
733
  if (get_option('_wpdm_hide_all', 0) == 1) {
734
  $params['meta_query'] = array(
735
  array(
736
+ 'key' => '__wpdm_access',
737
+ 'value' => 'guest',
738
+ 'compare' => 'LIKE'
739
  )
740
  );
741
+ if (is_user_logged_in()) {
742
  global $current_user;
743
  $params['meta_query'][] = array(
744
  'key' => '__wpdm_access',
780
  $html = '';
781
  $templates = maybe_unserialize(get_option("_fm_link_templates", true));
782
 
783
+ if (isset($templates[$template])) $template = $templates[$template]['content'];
784
 
785
  global $post;
786
+ while ($packs->have_posts()) {
787
+ $packs->the_post();
788
 
789
  $pack = (array)$post;
790
+ $repeater = "<div class='{$cwd_class} {$cwdsm_class} {$cwdxs_class}'>" . FetchTemplate($template, $pack) . "</div>";
791
+ $html .= $repeater;
792
 
793
  }
794
  wp_reset_query();
795
 
796
  $html = "<div class='row'>{$html}</div>";
797
  $cname = array();
798
+ foreach ($cids as $cid) {
799
  $cat = get_term_by('slug', $cid, $taxo);
800
  $cname[] = $cat->name;
801
 
806
  $desc = '';
807
  $trm = get_term_by('slug', $cids[0], 'wpdmcategory');
808
 
809
+ if (isset($fnparams['title']) && $fnparams['title'] != false && intval($fnparams['title']) != 1) $cats = $fnparams['title'];
810
+ if (isset($fnparams['desc']) && $fnparams['desc'] != false && intval($fnparams['desc']) != 1) $desc = $fnparams['desc'];
811
+ if (isset($fnparams['desc']) && (int)$fnparams['desc'] == 1) $desc = $trm->description;
812
 
813
 
814
+ $cimg = '';
815
 
816
 
817
  $subcats = '';
818
  if (function_exists('wpdm_ap_categories') && $subcats == 1) {
819
  $schtml = wpdm_ap_categories(array('parent' => $id));
820
  if ($schtml != '') {
821
+ $subcats = "<fieldset class='cat-page-tilte'><legend>" . __('Sub-Categories', 'download-manager') . "</legend>" . $schtml . "<div style='clear:both'></div></fieldset>" . "<fieldset class='cat-page-tilte'><legend>" . __('Downloads', 'download-manager') . "</legend>";
822
  $efs = '</fieldset>';
823
  }
824
  }
835
  if (isset($_GET['src']) && $_GET['src'] != '') $burl .= 'src=' . esc_attr($_GET['src']) . '&';
836
  $orderby = isset($_GET['orderby']) ? esc_attr($_GET['orderby']) : 'date';
837
  $order = ucfirst($order);
838
+ $order_field = " " . __(ucwords(str_replace("_", " ", $order_field)), 'download-manager');
839
+ $ttitle = __('Title', 'download-manager');
840
+ $tdls = __('Downloads', 'download-manager');
841
+ $tcdate = __('Publish Date', 'download-manager');
842
+ $tudate = __('Update Date', 'download-manager');
843
+ $tasc = __('Asc', 'download-manager');
844
+ $tdsc = __('Desc', 'download-manager');
845
+ $tsrc = __('Search', 'download-manager');
846
+ $ord = __('Order', 'download-manager');
847
+ $order_by_label = __('Order By', 'download-manager');
848
+ $hasdesc = $desc != '' ? 'has-desc' : '';
849
  if ($toolbar || get_option('__wpdm_cat_tb') == 1) {
850
+ if ($toolbar != 'skinny') {
851
  $icon = \WPDM\libs\CategoryHandler::icon($trm->term_id);
852
+ $iconw = $desc != '' ? 64 : 32;
853
+ if ($icon != '') $icon = "<div class='pull-left'><img class='category-icon category-{$trm->term_id}' style='max-width: {$iconw}px' src='{$icon}' alt='{$trm->name}' /></div>";
854
  $toolbar = <<<TBR
855
  <div class="panel panel-default category-panel {$hasdesc}">
856
  <div class="panel-body">
885
 
886
  TBR;
887
  }
888
+ } else
 
889
  $toolbar = '';
890
+ return "<div class='w3eden'>" . $toolbar . $cimg . $subcats . $html . $pgn . "<div style='clear:both'></div></div>";
891
  }
892
 
893
 
 
894
  /**
895
  * @param $file
896
  * @return array|mixed
897
  */
898
+ function wpdm_basename($file)
899
+ {
900
+ if (strpos("~" . $file, "\\"))
901
  $basename = explode("\\", $file);
902
  else
903
+ $basename = explode("/", $file);
904
  $basename = end($basename);
905
  return $basename;
906
  }
926
  * @param null $extra
927
  * @return mixed|string|void
928
  */
929
+ function wpdm_post_thumb($size = '', $echo = true, $extra = null)
930
+ {
931
  global $post;
932
+ $size = $size ? $size : 'thumbnail';
933
+ $class = isset($extra['class']) ? $extra['class'] : '';
934
  $alt = $post->post_title;
935
+ if (is_array($size)) {
936
+ $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
 
937
  $large_image_url = $large_image_url[0];
938
+ if ($large_image_url != '') {
939
  $path = str_replace(site_url('/'), ABSPATH, $large_image_url);
940
  $thumb = wpdm_dynamic_thumb($path, $size);
941
  $thumb = str_replace(ABSPATH, site_url('/'), $thumb);
942
  $alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true);
943
+ $img = "<img src='" . $thumb . "' alt='{$alt}' class='{$class}' />";
944
+ if ($echo) {
945
+ echo $img;
946
+ return;
947
+ } else
948
  return $img;
949
  }
950
  }
951
+ if ($echo && has_post_thumbnail($post->ID))
952
+ echo get_the_post_thumbnail($post->ID, $size, $extra);
953
+ else if (!$echo && has_post_thumbnail($post->ID))
954
+ return get_the_post_thumbnail($post->ID, $size, $extra);
955
+ else if ($echo)
956
  echo "";
957
  else
958
  return "";
966
  * @param null $extra
967
  * @return mixed|string|void
968
  */
969
+ function wpdm_thumb($post, $size = '', $echo = true, $extra = null)
970
+ {
971
+ if (is_int($post))
972
+ $post = get_post($post);
973
+ $size = $size ? $size : 'thumbnail';
974
+ $class = isset($extra['class']) ? $extra['class'] : '';
975
  $alt = $post->post_title;
976
+ if (is_array($size)) {
977
+ $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
 
978
  $large_image_url = $large_image_url[0];
979
+ if ($large_image_url != '') {
980
  $path = str_replace(site_url('/'), ABSPATH, $large_image_url);
981
  $thumb = wpdm_dynamic_thumb($path, $size);
982
  $thumb = str_replace(ABSPATH, site_url('/'), $thumb);
983
  $alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true);
984
+ if ($echo === 'url') return $thumb;
985
+ $img = "<img src='" . $thumb . "' alt='{$alt}' class='{$class}' />";
986
+ if ($echo) {
987
+ echo $img;
988
+ return;
989
+ } else
990
  return $img;
991
  }
992
  }
993
+ if ($echo && has_post_thumbnail($post->ID))
994
+ echo get_the_post_thumbnail($post->ID, $size, $extra);
995
+ else if (!$echo && has_post_thumbnail($post->ID))
996
+ return get_the_post_thumbnail($post->ID, $size, $extra);
997
+ else if ($echo)
998
  echo "";
999
  else
1000
  return "";
1005
  * @param $data
1006
  * @return mixed|string
1007
  */
1008
+ function wpdm_option_field($data)
1009
+ {
1010
 
1011
+ $desc = isset($data['description']) ? "<em class='note'>{$data['description']}</em>" : "";
1012
 
1013
+ switch ($data['type']):
1014
  case 'text':
1015
  return "<input type='text' name='$data[name]' class='form-control' id='$data[id]' value='$data[value]' placeholder='{$data['placeholder']}' />$desc";
1016
  break;
1017
  case 'select':
1018
  case 'dropdown':
1019
  $html = "<select name='{$data['name']}' id='{$data['id']}' style='width:100%;min-width:150px;' >";
1020
+ foreach ($data['options'] as $value => $label) {
1021
 
1022
+ $html .= "<option value='{$value}' " . selected($data['selected'], $value, false) . ">$label</option>";
1023
  }
1024
  $html .= "</select>";
1025
+ return $html . $desc;
1026
  break;
1027
  case 'notice':
1028
+ return "<div class='alert alert-info' style='margin: 0'>$data[notice]</div>" . $desc;
1029
  case 'textarea':
1030
  return "<textarea name='$data[name]' id='$data[id]' class='form-control' style='min-height: 100px'>$data[value]</textarea>$desc";
1031
  break;
1032
  case 'checkbox':
1033
+ return "<input type='hidden' name='$data[name]' value='0' /><input type='checkbox' name='$data[name]' id='$data[id]' value='$data[value]' " . checked($data['checked'], $data['value'], false) . " />" . $desc;
1034
  break;
1035
  case 'callback':
1036
+ return call_user_func($data['dom_callback'], $data['dom_callback_params']) . $desc;
1037
  break;
1038
  case 'heading':
1039
+ return "<h3>" . $data['label'] . "</h3>";
1040
  break;
1041
  endswitch;
1042
  }
1045
  * @param $options
1046
  * @return string
1047
  */
1048
+ function wpdm_option_page($options)
1049
+ {
1050
  $html = "<div class='wpdm-settings-fields'>";
1051
+ foreach ($options as $id => $option) {
1052
+ if (in_array($option['type'], array('checkbox', 'radio')))
1053
+ $html .= "<div class='form-group'><label>" . wpdm_option_field($option) . " {$option['label']}</label></div>";
1054
+ else if ($option['type'] == 'heading')
1055
  $html .= "<h3>{$option['label']}</h3>";
1056
  else
1057
+ $html .= "<div class='form-group'><label>{$option['label']}</label>" . wpdm_option_field($option) . "</div>";
1058
  }
1059
+ $html .= "</div>";
1060
  return $html;
1061
  }
1062
 
1066
  * @param $options
1067
  * @return string
1068
  */
1069
+ function wpdm_settings_section($name, $options)
1070
+ {
1071
+ return "<div class='panel panel-default'><div class='panel-heading'>{$name}</div><div class='panel-body'>" . wpdm_option_page($options) . "</div></div>";
1072
  }
1073
 
1074
 
1101
  * @param $id
1102
  * @return bool
1103
  */
1104
+ function wpdm_is_locked($id)
1105
+ {
1106
 
1107
  return \WPDM\Package::isLocked($id);
1108
 
1128
  * @param string $type
1129
  * @return mixed|string|void
1130
  */
1131
+ function wpdm_fetch_template($template, $vars, $type = 'link')
1132
+ {
1133
  return \WPDM\Package::fetchTemplate($template, $vars, $type);
1134
  }
1135
 
1138
  * @usage Callback function for [wpdm_login_form] short-code
1139
  * @return string
1140
  */
1141
+ function wpdm_loginform()
1142
+ {
1143
+ return wpdm_login_form(array('redirect' => $_SERVER['REQUEST_URI']));
1144
  }
1145
 
1146
 
1160
  * @param $ID
1161
  * @return bool|mixed|null|void|WP_Post
1162
  */
1163
+ function wpdm_get_package($ID)
1164
+ {
1165
  return \WPDM\Package::Get($ID);
1166
  }
1167
 
1171
  * @param $meta
1172
  * @return mixed
1173
  */
1174
+ function get_package_data($ID, $key)
1175
+ {
1176
  return \WPDM\Package::Get($ID, $key);
1177
  }
1178
 
1191
  $password = $data[$_POST['wpdmfile']]['password'] != "" ? $data[$_POST['wpdmfile']]['password'] : $packagemeta['password'];
1192
  if ($password == $_POST['actioninddlpvr'] || strpos($password, "[" . $_POST['actioninddlpvr'] . "]") !== FALSE) {
1193
  $id = uniqid();
1194
+ update_post_meta($fileid, "__wpdmkey_" . $id, 8);
1195
  die("|ok|$id|");
1196
  } else
1197
  die('|error|');
1203
  */
1204
  function wpdm_generate_password()
1205
  {
1206
+ if (!current_user_can('manage_options') || !wpdm_is_ajax()) die();
1207
  include(wpdm_tpl_path('wpdm-generate-password.php'));
1208
  die();
1209
 
1238
  return $value;
1239
  }
1240
 
1241
+ function wpdm_view_countplus()
1242
+ {
1243
+ if (isset($_REQUEST['_nonce']) && wp_verify_nonce($_REQUEST['_nonce'], "__wpdm_view_count")) {
1244
 
1245
  $id = intval($_REQUEST['id']);
1246
  $views = (int)get_post_meta($id, '__wpdm_view_count', true);
1247
+ update_post_meta($id, '__wpdm_view_count', $views + 1);
1248
+ echo $views + 1;
1249
  die();
1250
 
1251
  }
1252
  }
1253
 
1254
 
1255
+ function wpdm_array_splice_assoc(&$input, $offset, $length, $replacement)
1256
+ {
1257
+ $replacement = (array)$replacement;
1258
  $key_indices = array_flip(array_keys($input));
1259
  if (isset($input[$offset]) && is_string($offset)) {
1260
  $offset = $key_indices[$offset];
1272
  * Added from v4.1.1
1273
  * WPDM add-on installer
1274
  */
1275
+ function wpdm_install_addon()
1276
+ {
1277
+ if (isset($_REQUEST['addon']) && current_user_can('manage_options') && wp_verify_nonce($_REQUEST['__wpdmpinn'], $_REQUEST['addon'] . NONCE_KEY)) {
1278
+ include_once(ABSPATH . 'wp-admin/includes/plugin.php');
1279
  include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1280
  include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1281
+ $upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
1282
+ $plugin_dir = isset($_REQUEST['dirname']) ? esc_attr($_REQUEST['dirname']) : false;
1283
+ if ($plugin_dir) {
1284
  $plugin_data = wpdm_plugin_data($plugin_dir);
1285
  $plugin_file = $plugin_data ? $plugin_data['plugin_index_file'] : false;
1286
  if ($plugin_file) {
1290
  delete_plugins(array($plugin_file));
1291
  }
1292
  }
1293
+ $downloadlink = 'https://www.wpdownloadmanager.com/?wpdmdl=' . (int)$_REQUEST['addon'];
1294
  $upgrader->install($downloadlink);
1295
  die();
1296
  } else {
1301
  /**
1302
  * @usage Active premium package add-on / shopping cart
1303
  */
1304
+ function wpdm_activate_shop()
1305
+ {
1306
+ if (current_user_can(WPDM_ADMIN_CAP)) {
1307
  include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1308
  include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1309
+ $upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
1310
  $downloadlink = 'https://www.wpdownloadmanager.com/?wpdmdl=15671';
1311
  ob_start();
1312
  echo "<div id='acto'>";
1313
+ if (file_exists(dirname(dirname(__FILE__)) . '/wpdm-premium-packages/'))
1314
  $upgrader->upgrade($downloadlink);
1315
  else
1316
  $upgrader->install($downloadlink);
1317
  echo '</div><style>#acto .wrap { display: none; }</style>';
1318
  $data = ob_get_clean();
1319
+ if (file_exists(dirname(WPDM_BASE_DIR) . '/wpdm-premium-packages/wpdm-premium-packages.php')) {
1320
  activate_plugin('wpdm-premium-packages/wpdm-premium-packages.php');
1321
  echo "Congratulation! Your Digital Store is Activated. <a href='' class='btn btn-warning'>Refresh The Page!</a>";
1322
  } else
1336
  * @return string
1337
  * @usage Generates thumbnail html from PDF file attached with a Package. [ From v4.1.3 ]
1338
  */
1339
+ function wpdm_pdf_preview($pid, $w, $h, $echo = true)
1340
+ {
1341
 
1342
  $post = get_post($pid);
1343
  $files = get_post_meta($pid, '__wpdm_files', true);
1348
  $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($pid), 'full');
1349
  $preview = $thumb['0'];
1350
 
1351
+ if ($ext == 'pdf')
1352
+ $pdf_thumb = wpdm_pdf_thumbnail($pdf, $pid);
1353
  else $pdf_thumb = $preview;
1354
 
1355
+ $imsrc = wpdm_dynamic_thumb($pdf_thumb, array($w, $h));
1356
 
1357
+ if (!$echo)
1358
  return "<img src='{$imsrc}' alt='{$post->post_title}'/>";
1359
 
1360
  echo "<img src='{$imsrc}' alt='{$post->post_title}'/>";
1367
  * @return string
1368
  * @usage Generates thumbnail from PDF file. [ From v4.1.3 ]
1369
  */
1370
+ function wpdm_pdf_thumbnail($pdf, $id)
1371
+ {
1372
  return \WPDM\libs\FileSystem::pdfThumbnail($pdf, $id);
1373
  }
1374
 
1375
 
1376
+ function wpdm_media_field($data)
1377
+ {
1378
  ob_start();
1379
  $attrs = '';
1380
+ if (isset($data['attrs'])) {
1381
+ foreach ($data['attrs'] as $attr => $value) {
1382
  $attrs .= "$attr='$value' ";
1383
  }
1384
  }
1385
  ?>
1386
  <div class="input-group">
1387
+ <input placeholder="<?php echo $data['placeholder']; ?>" <?php echo $attrs; ?> type="url"
1388
+ name="<?php echo $data['name']; ?>"
1389
+ id="<?php echo isset($data['id']) ? $data['id'] : ($id = uniqid()); ?>" class="form-control"
1390
+ value="<?php echo isset($data['value']) ? $data['value'] : ''; ?>"/>
1391
  <span class="input-group-btn">
1392
+ <button class="btn btn-secondary btn-media-upload" type="button"
1393
+ rel="#<?php echo isset($data['id']) ? $data['id'] : $id; ?>"><i
1394
+ class="far fa-image"></i></button>
1395
  </span>
1396
  </div>
1397
  <?php
1398
  return ob_get_clean();
1399
  }
1400
 
1401
+ function wpdm_image_selector($data)
1402
+ {
1403
  ob_start();
1404
  $attrs = '';
1405
+ if (isset($data['attrs'])) {
1406
+ foreach ($data['attrs'] as $attr => $value) {
1407
  $attrs .= "$attr='$value' ";
1408
  }
1409
  }
1411
  ?>
1412
  <div class="panel panel-default text-center image-selector-panel" style="width: 250px">
1413
  <div class="panel-body">
1414
+ <img id="<?php echo isset($data['id']) ? $data['id'] : $id; ?>"
1415
+ src="<?php echo isset($data['value']) && $data['value'] != '' ? $data['value'] : WPDM_BASE_URL . 'assets/images/image.png'; ?>"/>
1416
  </div>
1417
  <div class="panel-footer">
1418
+ <input id="<?php echo isset($data['id']) ? $data['id'] : $id; ?>_hidden" type="hidden"
1419
+ name="<?php echo $data['name']; ?>"
1420
+ value="<?php echo isset($data['value']) ? $data['value'] : ''; ?>"/>
1421
+ <button class="btn btn-info btn-block btn-image-selector" type="button"
1422
+ rel="#<?php echo isset($data['id']) ? $data['id'] : $id; ?>"><i
1423
+ class="far fa-image"></i> <?php isset($data['btnlabel']) ? $data['btnlabel'] : _e('Select Image', 'download-manager'); ?>
1424
+ </button>
1425
  </div>
1426
  </div>
1427
  <?php
1428
  return ob_get_clean();
1429
  }
1430
 
1431
+ function wpdm_image_uploader($data)
1432
+ {
1433
  ob_start();
1434
  $attrs = '';
1435
+ if (isset($data['attrs'])) {
1436
+ foreach ($data['attrs'] as $attr => $value) {
1437
  $attrs .= "$attr='$value' ";
1438
  }
1439
  }
1442
  <div id="wpdm-upload-ui" class="panel panel-default text-center image-selector-panel" style="width: 250px">
1443
  <div id="wpdm-drag-drop-area">
1444
  <div class="panel-body">
1445
+ <img id="<?php echo isset($data['id']) ? $data['id'] : $id; ?>"
1446
+ src="<?php echo isset($data['value']) && $data['value'] != '' ? $data['value'] : WPDM_BASE_URL . 'assets/images/image.png'; ?>"/>
1447
  </div>
1448
  <div class="panel-footer">
1449
+ <input id="<?php echo isset($data['id']) ? $data['id'] : $id; ?>_hidden" type="hidden"
1450
+ name="<?php echo $data['name']; ?>"
1451
+ value="<?php echo isset($data['value']) ? $data['value'] : ''; ?>"/>
1452
+
1453
+ <button id="wpdm-browse-button" style="font-size: 9px;text-transform: unset" type="button"
1454
+ class="btn btn-info btn-block"><?php echo isset($data['btnlabel']) ? $data['btnlabel'] : __('SELECT IMAGE', 'download-manager'); ?></button>
1455
+ <div class="progress" id="wmprogressbar"
1456
+ style="height: 30px !important;border-radius: 3px !important;margin: 0;position: relative;background: #0d406799;display: none;box-shadow: none">
1457
+ <div id="wmprogress" class="progress-bar progress-bar-striped progress-bar-animated"
1458
+ role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
1459
+ style="width: 0%;line-height: 30px;background-color: #007bff"></div>
1460
+ <div class="fetfont"
1461
+ style="font-size:9px;position: absolute;line-height: 30px;height: 30px;width: 100%;z-index: 999;text-align: center;color: #ffffff;font-weight: 800;letter-spacing: 1px">
1462
+ UPLOADING... <span id="wmloaded">0</span>%
1463
+ </div>
1464
  </div>
1465
 
1466
  <?php
1467
 
1468
  $plupload_init = array(
1469
+ 'runtimes' => 'html5,silverlight,flash,html4',
1470
+ 'browse_button' => 'wpdm-browse-button',
1471
+ 'container' => 'wpdm-upload-ui',
1472
+ 'drop_element' => 'wpdm-drag-drop-area',
1473
+ 'file_data_name' => 'wpdm_file',
1474
+ 'multiple_queues' => false,
1475
+ 'url' => admin_url('admin-ajax.php'),
1476
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
1477
  'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
1478
+ 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => 'png,jpg,jpeg,gif')),
1479
+ 'multipart' => true,
1480
+ 'urlstream_upload' => true,
1481
 
1482
  // additional post data to send to our ajax hook
1483
+ 'multipart_params' => array(
1484
  '_ajax_nonce' => wp_create_nonce(NONCE_KEY),
1485
+ 'action' => $data['action'], // the ajax action name
1486
  ),
1487
  );
1488
 
1489
+ $plupload_init['max_file_size'] = wp_max_upload_size() . 'b';
1490
 
1491
  // we should probably not apply this filter, plugins may expect wp's media uploader...
1492
  $plupload_init = apply_filters('plupload_init', $plupload_init); ?>
1493
 
1494
  <script type="text/javascript">
1495
 
1496
+ jQuery(function ($) {
1497
 
1498
  // create the uploader and pass the config from above
1499
  var uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?>);
1500
 
1501
  // checks if browser supports drag and drop upload, makes some css adjustments if necessary
1502
+ uploader.bind('Init', function (up) {
1503
  var uploaddiv = $('#wpdm-upload-ui');
1504
 
1505
+ if (up.features.dragdrop) {
1506
  uploaddiv.addClass('drag-drop');
1507
  $('#drag-drop-area')
1508
+ .bind('dragover.wp-uploader', function () {
1509
+ uploaddiv.addClass('drag-over');
1510
+ })
1511
+ .bind('dragleave.wp-uploader, drop.wp-uploader', function () {
1512
+ uploaddiv.removeClass('drag-over');
1513
+ });
1514
+
1515
+ } else {
1516
  uploaddiv.removeClass('drag-drop');
1517
  $('#drag-drop-area').unbind('.wp-uploader');
1518
  }
1520
 
1521
  uploader.init();
1522
 
1523
+ uploader.bind('Error', function (uploader, error) {
1524
  wpdm_bootModal('Error', error.message);
1525
  $('#wmprogressbar').hide();
1526
  $('#wpdm-browse-button').show();
1527
  });
1528
 
1529
  // a file was added in the queue
1530
+ uploader.bind('FilesAdded', function (up, files) {
1531
  //var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
1532
 
1533
  $('#wpdm-browse-button').hide(); //attr('disabled', 'disabled');
1534
  $('#wmprogressbar').show();
1535
 
1536
+ plupload.each(files, function (file) {
1537
+ $('#wmprogress').css('width', file.percent + "%");
1538
  $('#wmloaded').html(file.percent);
1539
  //jQuery('#wpdm-browse-button').hide(); //.html('<span id="' + file.id + '"><i class="fas fa-sun fa-spin"></i> <?php _e('Uploading', 'download-manager'); ?> (<span>' + plupload.formatSize(0) + '</span>/' + plupload.formatSize(file.size) + ') </span>');
1540
  });
1543
  up.start();
1544
  });
1545
 
1546
+ uploader.bind('UploadProgress', function (up, file) {
1547
  //jQuery('#' + file.id + " span").html(plupload.formatSize(parseInt(file.size * file.percent / 100)));
1548
+ $('#wmprogress').css('width', file.percent + "%");
1549
  $('#wmloaded').html(file.percent);
1550
  });
1551
 
1552
 
1553
  // a file was uploaded
1554
+ uploader.bind('FileUploaded', function (up, file, response) {
1555
  res = JSON.parse(response.response);
1556
+ $('#<?php echo isset($data['id']) ? $data['id'] : $id; ?>').attr('src', res.image_url);
1557
  $('#wmprogressbar').hide();
1558
+ $('#wpdm-browse-button').show(); //removeAttr('disabled').html('<?php echo isset($data['btnlabel']) ? $data['btnlabel'] : __('SELECT IMAGE', 'download-manager'); ?>');
1559
 
1560
  });
1561
 
1577
  /**
1578
  * @usage Show admin notices
1579
  */
1580
+ function wpdm_admin_notices()
1581
+ {
1582
  global $wp_query;
1583
+ if (get_post_type() == 'wpdmpro' && isset($wp_query->query_vars['posts_per_page'])) {
1584
  ?>
1585
  <div class="updated" style="border: 2px solid #ffffff !important;border-radius: 0;">
1586
  <p>
1587
  <strong>Download Manager Pro!</strong><br/>
1588
+ <i><a href="https://www.wpdownloadmanager.com/?affid=admin&amp;domain=localhost" target="_blank">Get
1589
+ Download Manager Pro Version Now! </a></i>
1590
+ <a style="float:right;margin-top: -23px;margin-right: -6px;border: 0 none;border-radius: 0;box-shadow: none;text-shadow: none !important;font-weight: bold"
1591
+ class="button button-primary button-hero"
1592
+ href="https://www.wpdownloadmanager.com/?affid=admin&amp;domain=localhost#features" target="_blank">Checkout
1593
+ The Features Here &rarr;</a>
1594
  </p>
1595
  </div>
1596
  <?php
1598
  }
1599
 
1600
 
 
1601
  /**
1602
  * @usage Show Login Form
1603
  */
1604
+ function wpdm_login_form($params = array())
1605
+ {
1606
  return WPDM()->shortCode->loginForm($params);
1607
  }
1608
 
1609
+ function wpdm_user_dashboard_url()
1610
+ {
1611
  $id = get_option('__wpdm_user_dashboard', 0);
1612
+ if ($id > 0) {
1613
  $url = get_permalink($id);
1614
+ } else $url = home_url('/');
 
1615
  return $url;
1616
  }
1617
 
1618
+ function wpdm_registration_url()
1619
+ {
1620
  $id = get_option('__wpdm_register_url', 0);
1621
+ if ($id > 0) {
1622
  $url = get_permalink($id);
1623
 
1624
+ } else $url = wp_registration_url();
 
1625
  return $url;
1626
  }
1627
 
1628
+ function wpdm_login_url($redirect = '')
1629
+ {
1630
  $id = get_option('__wpdm_login_url', 0);
1631
+ if ($id > 0) {
1632
  $url = get_permalink($id);
1633
+ if ($redirect != '')
1634
+ $url .= (strstr($url, '?') ? '&' : '?') . 'redirect_to=' . $redirect;
1635
+ } else $url = wp_login_url($redirect);
 
1636
  return $url;
1637
  }
1638
 
1639
+ function wpdm_lostpassword_url()
1640
+ {
1641
  return add_query_arg(array('action' => 'lostpassword'), wpdm_login_url());
1642
  }
1643
 
1644
+ function wpdm_logout_url($redirect = '')
1645
+ {
1646
+ $logout_url = home_url("/?logout=" . wp_create_nonce(NONCE_KEY));
1647
+ return $redirect != '' ? add_query_arg(array('redirect_to' => $redirect), $logout_url) : $logout_url;
1648
  }
1649
 
1650
 
1651
+ function wpdm_user_logged_in($msg)
1652
+ {
1653
  echo $msg;
1654
  }
1655
 
1656
 
 
1657
  /**
1658
  * @usage Returns download manager template file path
1659
  * @param $file
1660
  * @param string $tpldir
1661
  * @return string
1662
  */
1663
+ function wpdm_tpl_path1($file, $tpldir = '')
1664
+ {
1665
+ if (file_exists(get_stylesheet_directory() . '/download-manager/' . $file))
1666
+ $path = get_stylesheet_directory() . '/download-manager/' . $file;
1667
+ else if (file_exists(get_template_directory() . '/download-manager/' . $file))
1668
+ $path = get_template_directory() . '/download-manager/' . $file;
1669
+ else if ($tpldir != '' && file_exists($tpldir . '/' . $file))
1670
+ $path = $tpldir . '/' . $file;
1671
+ else if ($tpldir != '' && file_exists(get_template_directory() . '/download-manager/' . $tpldir . '/' . $file))
1672
+ $path = get_template_directory() . '/download-manager/' . $tpldir . '/' . $file;
1673
+ else $path = WPDM_BASE_DIR . 'tpls/' . $file;
1674
 
1675
  return $path;
1676
 
1682
  * @param string $tpldir
1683
  * @return string
1684
  */
1685
+ function wpdm_tpl_path($file, $tpldir = '', $fallback = '')
1686
+ {
1687
+ if (file_exists(get_stylesheet_directory() . '/download-manager/' . $file))
1688
+ $path = get_stylesheet_directory() . '/download-manager/' . $file;
1689
+ else if (file_exists(get_template_directory() . '/download-manager/' . $file))
1690
+ $path = get_template_directory() . '/download-manager/' . $file;
1691
+ else if ($tpldir !== '' && file_exists($tpldir . '/' . $file))
1692
+ $path = $tpldir . '/' . $file;
1693
+ else if ($tpldir != '' && file_exists(get_template_directory() . '/download-manager/' . $tpldir . '/' . $file))
1694
+ $path = get_template_directory() . '/download-manager/' . $tpldir . '/' . $file;
1695
+ else $path = WPDM_TPL_DIR . $file;
1696
 
1697
  /* Fallack template directory*/
1698
+ if ($fallback == '') $fallback = WPDM_TPL_FALLBACK;
1699
+ if ($fallback !== '' && !file_exists($path))
1700
+ $path = $fallback . "/" . $file;
1701
 
1702
  //if(!file_exists($path))
1703
  //wpdmdd($path);
1710
  * @param $range
1711
  * @return bool
1712
  */
1713
+ function wpdm_ip_in_range($ip, $range)
1714
+ {
1715
  // Check IP range
1716
 
1717
  list($subnet, $bits) = explode('/', $range);
1718
+ if (!$bits || (int)$bits < 1) return false;
1719
  // Convert subnet to binary string of $bits length
1720
  $subnet = unpack('H*', @inet_pton($subnet)); // Subnet in Hex
1721
+ foreach ($subnet as $i => $h) $subnet[$i] = base_convert($h, 16, 2); // Array of Binary
1722
  $subnet = substr(implode('', $subnet), 0, $bits); // Subnet in Binary, only network bits
1723
 
1724
  // Convert remote IP to binary string of $bits length
1725
  $ip = unpack('H*', @inet_pton($ip)); // IP in Hex
1726
+ foreach ($ip as $i => $h) $ip[$i] = base_convert($h, 16, 2); // Array of Binary
1727
  $ip = substr(implode('', $ip), 0, $bits); // IP in Binary, only network bits
1728
 
1729
  // Check network bits match
1730
+ if ($subnet == $ip) {
1731
  return true;
1732
  }
1733
  return false;
1737
  * @param null $ip
1738
  * @return bool
1739
  */
1740
+ function wpdm_ip_blocked($ip = null)
1741
+ {
1742
+ $ip = $ip ? $ip : wpdm_get_client_ip();
1743
  $allblocked = get_option('__wpdm_blocked_ips', '');
1744
  $allblocked = explode("\n", str_replace("\r", "", $allblocked));
1745
  $isblocked = false;
1746
  foreach ($allblocked as $blocked) {
1747
+ if (strstr($blocked, '/'))
1748
  $isblocked = wpdm_ip_in_range($ip, $blocked);
1749
+ else if (strstr($blocked, '*')) {
1750
+ preg_match('/' . $blocked . '/', $ip, $matches);
1751
+ $isblocked = count($matches) > 0 ? true : false;
1752
+ } else if ($ip == $blocked)
1753
  $isblocked = true;
1754
 
1755
+ if ($isblocked == true) return $isblocked;
1756
 
1757
  }
1758
  return $isblocked;
1761
  /**
1762
  * @return string or bool
1763
  */
1764
+ function wpdm_get_client_ip()
1765
+ {
1766
  $ipaddress = '';
1767
  if (isset($_SERVER['HTTP_CLIENT_IP']))
1768
  $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
1769
+ else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
1770
  $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
1771
+ else if (isset($_SERVER['HTTP_X_FORWARDED']))
1772
  $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
1773
+ else if (isset($_SERVER['HTTP_FORWARDED_FOR']))
1774
  $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
1775
+ else if (isset($_SERVER['HTTP_FORWARDED']))
1776
  $ipaddress = $_SERVER['HTTP_FORWARDED'];
1777
+ else if (isset($_SERVER['REMOTE_ADDR']))
1778
  $ipaddress = $_SERVER['REMOTE_ADDR'];
1779
  else
1780
  $ipaddress = false;
1788
  * @return bool|int
1789
  * @since 4.7.4
1790
  */
1791
+ function is_wpdmkey_valid($ID, $_key, $update = false)
1792
+ {
1793
+ if ($_key == '') return 0; // Invalid
1794
 
1795
+ $key = "__wpdmkey_" . $_key;
1796
  $xlimit = get_post_meta($ID, $key, true);
1797
 
1798
+ if (!$xlimit) return 0; // Invalid
1799
 
1800
  $xlimit = maybe_unserialize($xlimit);
1801
+ if (!is_array($xlimit)) return 0;
1802
 
1803
+ $limit = isset($xlimit['use']) ? $xlimit['use'] : 0;
1804
 
1805
  $expired = false;
1806
 
1807
  if ($limit <= 0) {
1808
  delete_post_meta($ID, $key);
1809
  return -1; // Limit exceeded
1810
+ } else {
 
1811
 
1812
+ $limit--;
1813
  $xlimit['use'] = $limit;
1814
 
1815
+ if ($xlimit['expire'] < time()) {
1816
  $xlimit['use'] = $limit = 0;
1817
  $expired = true;
1818
  }
1819
+ if ($update)
1820
  update_post_meta($ID, $key, $xlimit);
1821
+ if ($expired) return -2; // Time expired
1822
  }
1823
  return 1;
1824
  }
1825
 
1826
 
1827
+ function wpdm_is_url($url)
1828
+ {
1829
+ $result = (false !== filter_var($url, FILTER_VALIDATE_URL));
1830
+ return apply_filters('wpdm_is_url', $result, $url);
1831
  }
1832
 
1833
  /**
1834
  * @param null $uid
1835
  * @return int
1836
  */
1837
+ function wpdm_total_downloads($uid = null)
1838
+ {
1839
  global $wpdb;
1840
+ if (isset($uid) && $uid > 0)
1841
  $download_count = $wpdb->get_var("select sum(pm.meta_value) from {$wpdb->prefix}postmeta pm, {$wpdb->prefix}posts p where meta_key='__wpdm_download_count' and p.ID = pm.post_id and p.post_author = '{$uid}'");
1842
  else
1843
  $download_count = $wpdb->get_var("select sum(meta_value) from {$wpdb->prefix}postmeta where meta_key='__wpdm_download_count'");
1848
  * @param null $uid
1849
  * @return mixed
1850
  */
1851
+ function wpdm_total_views($uid = null)
1852
+ {
1853
  global $wpdb;
1854
+ if (isset($uid) && $uid > 0)
1855
  $download_count = $wpdb->get_var("select sum(pm.meta_value) from {$wpdb->prefix}postmeta pm, {$wpdb->prefix}posts p where meta_key='__wpdm_view_count' and p.ID = pm.post_id and p.post_author = '{$uid}'");
1856
  else
1857
  $download_count = $wpdb->get_var("select sum(meta_value) from {$wpdb->prefix}postmeta where meta_key='__wpdm_view_count'");
1865
  * @param string $var
1866
  * @return string
1867
  */
1868
+ function wpdm_paginate_links($total, $items_per_page, $current_page = 1, $var = 'cp', $params = array())
1869
+ {
1870
 
1871
+ $pages = ceil($total / $items_per_page);
1872
 
1873
  $args = array(
1874
  //'base' => '%_%',
1875
+ 'format' => "?{$var}=%#%",
1876
+ 'total' => $pages,
1877
+ 'current' => $current_page,
1878
  //'show_all' => false,
1879
  //'end_size' => 2,
1880
  //'mid_size' => 1,
1881
  //'prev_next' => true,
1882
+ 'prev_text' => isset($params['prev_text']) ? $params['prev_text'] : __('Previous'),
1883
+ 'next_text' => isset($params['prev_text']) ? $params['next_text'] : __('Next'),
1884
+ 'type' => 'array',
1885
  //'add_args' => false,
1886
  //'add_fragment' => '',
1887
  //'before_page_number' => '',
1891
  $pags = paginate_links($args);
1892
  //wpdmprecho($pags);
1893
  $phtml = "";
1894
+ if (is_array($pags)) {
1895
  foreach ($pags as $pagl) {
1896
+ if (isset($params['container'])) {
1897
  $pagl = str_replace("<a", "<a data-container='{$params['container']}'", $pagl);
1898
  }
1899
  $phtml .= "<li>{$pagl}</li>";
1900
  }
1901
  }
1902
+ $async = isset($params['async']) && $params['async'] ? ' async' : '';
1903
  $phtml = "<div class='text-center'><ul class='pagination wpdm-pagination pagination-centered text-center{$async}'>{$phtml}</ul></div>";
1904
  return $phtml;
1905
  }
1906
 
1907
 
1908
+ function wpdm_download_button_style($p = null, $pacakge_ID = null)
1909
+ {
1910
+ if (is_singular('wpdmpro') || $p === true)
1911
  $ui_button = get_option('__wpdm_ui_download_button');
1912
  else
1913
  $ui_button = get_option('__wpdm_ui_download_button_sc');
1914
+ $class = "btn " . (isset($ui_button['color']) ? $ui_button['color'] : 'btn-primary') . " " . (isset($ui_button['size']) ? $ui_button['size'] : '');
1915
  $class = apply_filters("wpdm_download_button_style", $class, $pacakge_ID);
1916
  return $class;
1917
  }
1918
 
1919
+ function wpdm_hex2rgb($hex)
1920
+ {
1921
  list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x");
1922
  return "$r, $g, $b";
1923
  }
1924
+
1925
+ /** dev functions **/
1926
+ function wpdmecho($data)
1927
+ {
1928
+ echo "<pre>";
1929
+ print_r($data);
1930
+ echo "</pre>";
1931
+ }
1932
+
1933
+ function wpdmdd($data)
1934
+ {
1935
+ wpdmecho($data);
1936
+ die();
1937
+ }